From 3892a84f5275423a7f50ae4f4f8258f939a66ec6 Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Sat, 24 May 2014 23:54:29 -0700 Subject: [PATCH] No need to duplicate this... --- .../PubUtilLib/plContainer/plConfigInfo.h | 16 ++++-- .../plContainer/plConfigInfoLogging.cpp | 51 ------------------- 2 files changed, 11 insertions(+), 56 deletions(-) diff --git a/Sources/Plasma/PubUtilLib/plContainer/plConfigInfo.h b/Sources/Plasma/PubUtilLib/plContainer/plConfigInfo.h index 9391baa1..71c7778c 100644 --- a/Sources/Plasma/PubUtilLib/plContainer/plConfigInfo.h +++ b/Sources/Plasma/PubUtilLib/plContainer/plConfigInfo.h @@ -142,11 +142,17 @@ public: plConfigInfo* GetConfigInfo() { return &fConfigInfo; } plConfigInfo* GetConfigInfoLog() { return &fLog; } - bool GetValue(plString& retval, const plString & section, const plString & key, const plString & desc, const plString& defval = ""); - bool GetValue(int& retval, const plString & section, const plString & key, const plString & desc, int defval); - bool GetValue(bool& retval, const plString & section, const plString & key, const plString & desc, bool defval); - bool GetValue(float& retval, const plString & section, const plString & key, const plString & desc, float defval); - bool GetValue(double& retval, const plString & section, const plString & key, const plString & desc, double defval); + template + bool GetValue(_Type& retval, const plString & section, const plString & key, const plString & desc, const _Type& defval = _Type()) + { + plString descwdef = plFormat("{} # {}", defval, desc); + fLog.AddValue(section, key, descwdef, kReplaceIfExists); + + bool found; + retval = fConfigInfo.GetValue(section, key, defval, &found); + return found; + } + bool GetAllValues(std::vector& values, const plString & section, const plString & key, const plString & desc); #if USE_MULT_SECTIONS diff --git a/Sources/Plasma/PubUtilLib/plContainer/plConfigInfoLogging.cpp b/Sources/Plasma/PubUtilLib/plContainer/plConfigInfoLogging.cpp index 11236a1e..d8394d6f 100644 --- a/Sources/Plasma/PubUtilLib/plContainer/plConfigInfoLogging.cpp +++ b/Sources/Plasma/PubUtilLib/plContainer/plConfigInfoLogging.cpp @@ -49,57 +49,6 @@ plConfigInfoLogging::~plConfigInfoLogging() { } -bool plConfigInfoLogging::GetValue(plString& retval, const plString & section, const plString & key, const plString & desc, const plString& defval) -{ - plString descwdef = plString::Format("%s # %s",defval.c_str(),desc.c_str()); - fLog.AddValue(section,key,descwdef,kReplaceIfExists); - - bool found; - retval = fConfigInfo.GetValue(section,key,defval,&found); - return found; -} - -bool plConfigInfoLogging::GetValue(int& retval, const plString & section, const plString & key, const plString & desc, int defval) -{ - plString descwdef = plString::Format("%d # %s",defval,desc.c_str()); - fLog.AddValue(section,key,descwdef,kReplaceIfExists); - - bool found; - retval = fConfigInfo.GetValue(section,key,defval,&found); - return found; -} - -bool plConfigInfoLogging::GetValue(bool& retval, const plString & section, const plString & key, const plString & desc, bool defval) -{ - plString descwdef = plString::Format("%d # %s",defval,desc.c_str()); - fLog.AddValue(section,key,descwdef,kReplaceIfExists); - - bool found; - retval = ( fConfigInfo.GetValue(section,key,(int)defval,&found)!=0 ); - return found; -} - -bool plConfigInfoLogging::GetValue(float& retval, const plString & section, const plString & key, const plString & desc, float defval) -{ - plString descwdef = plString::Format("%f # %s",defval,desc.c_str()); - fLog.AddValue(section,key,descwdef,kReplaceIfExists); - - bool found; - double retvald = fConfigInfo.GetValue(section,key,defval,&found); - retval = (float)retvald; - return found; -} - -bool plConfigInfoLogging::GetValue(double& retval, const plString & section, const plString & key, const plString & desc, double defval) -{ - plString descwdef = plString::Format("%f # %s",defval,desc.c_str()); - fLog.AddValue(section,key,descwdef,kReplaceIfExists); - - bool found; - retval = fConfigInfo.GetValue(section,key,defval,&found); - return found; -} - bool plConfigInfoLogging::GetAllValues(std::vector& values, const plString & section, const plString & key, const plString & desc) { plString descwdef = plFormat("\"Multiple Entries\" # {}", desc);