Browse Source

No need to duplicate this...

Michael Hansen 10 years ago
parent
commit
3892a84f52
  1. 16
      Sources/Plasma/PubUtilLib/plContainer/plConfigInfo.h
  2. 51
      Sources/Plasma/PubUtilLib/plContainer/plConfigInfoLogging.cpp

16
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 <typename _Type>
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<plString>& values, const plString & section, const plString & key, const plString & desc);
#if USE_MULT_SECTIONS

51
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<plString>& values, const plString & section, const plString & key, const plString & desc)
{
plString descwdef = plFormat("\"Multiple Entries\" # {}", desc);

Loading…
Cancel
Save