|
|
@ -48,9 +48,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
|
|
#include <stdarg.h> |
|
|
|
#include <stdarg.h> |
|
|
|
#include <sstream> |
|
|
|
#include <sstream> |
|
|
|
|
|
|
|
|
|
|
|
const std::string& plConfigInfo::GlobalSection() |
|
|
|
const plString& plConfigInfo::GlobalSection() |
|
|
|
{ |
|
|
|
{ |
|
|
|
static std::string section("global"); |
|
|
|
static plString section("global"); |
|
|
|
return section; |
|
|
|
return section; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -74,32 +74,32 @@ void plConfigInfo::Clear() |
|
|
|
fSections.clear(); |
|
|
|
fSections.clear(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void plConfigInfo::RemoveSection(const std::string & section) |
|
|
|
void plConfigInfo::RemoveSection(const plString & section) |
|
|
|
{ |
|
|
|
{ |
|
|
|
fSections.erase(section.c_str()); |
|
|
|
fSections.erase(section); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void plConfigInfo::RemoveKey(const std::string & section, const std::string & key) |
|
|
|
void plConfigInfo::RemoveKey(const plString & section, const plString & key) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Sections::iterator si = fSections.find(section.c_str()); |
|
|
|
Sections::iterator si = fSections.find(section); |
|
|
|
if (si != fSections.end()) |
|
|
|
if (si != fSections.end()) |
|
|
|
fSections[section.c_str()].RemoveKey(key); |
|
|
|
fSections[section].RemoveKey(key); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool plConfigInfo::HasSection(const std::string & section) const |
|
|
|
bool plConfigInfo::HasSection(const plString & section) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
return fSections.find(section.c_str())!=fSections.end(); |
|
|
|
return fSections.find(section)!=fSections.end(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool plConfigInfo::HasKey(const std::string & section, const std::string & key) |
|
|
|
bool plConfigInfo::HasKey(const plString & section, const plString & key) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Sections::iterator si = fSections.find(section.c_str()); |
|
|
|
Sections::iterator si = fSections.find(section); |
|
|
|
if (si == fSections.end()) |
|
|
|
if (si == fSections.end()) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
return (si->second.HasKey(key)); |
|
|
|
return (si->second.HasKey(key)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool plConfigInfo::HasKeyAny(const std::string & key) |
|
|
|
bool plConfigInfo::HasKeyAny(const plString & key) |
|
|
|
{ |
|
|
|
{ |
|
|
|
for (Sections::iterator si=fSections.begin(); si!=fSections.end(); ++si) |
|
|
|
for (Sections::iterator si=fSections.begin(); si!=fSections.end(); ++si) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -109,12 +109,12 @@ bool plConfigInfo::HasKeyAny(const std::string & key) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool plConfigInfo::HasKeyIn(const std::string & key, const char * section1, ...) |
|
|
|
bool plConfigInfo::HasKeyIn(const plString & key, const char * section1, ...) |
|
|
|
{ |
|
|
|
{ |
|
|
|
const char * section = section1; |
|
|
|
const char * section = section1; |
|
|
|
va_list va; |
|
|
|
va_list va; |
|
|
|
va_start(va,section1); |
|
|
|
va_start(va,section1); |
|
|
|
std::vector<std::string> sections; |
|
|
|
std::vector<plString> sections; |
|
|
|
while (section) |
|
|
|
while (section) |
|
|
|
{ |
|
|
|
{ |
|
|
|
sections.push_back( section ); |
|
|
|
sections.push_back( section ); |
|
|
@ -124,114 +124,105 @@ bool plConfigInfo::HasKeyIn(const std::string & key, const char * section1, ...) |
|
|
|
return HasKeyIn( key, sections ); |
|
|
|
return HasKeyIn( key, sections ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool plConfigInfo::HasKeyIn(const std::string & key, const std::vector<std::string> & sections ) |
|
|
|
bool plConfigInfo::HasKeyIn(const plString & key, const std::vector<plString> & sections ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
for ( int i=0; i<sections.size(); i++ ) |
|
|
|
for ( int i=0; i<sections.size(); i++ ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
const char * section = sections[i].c_str(); |
|
|
|
if (HasSection(sections[i])) |
|
|
|
if (HasSection(section)) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
if (fSections[section].HasKey(key)) |
|
|
|
if (fSections[sections[i]].HasKey(key)) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool plConfigInfo::KeyHasValue(const std::string & section, const std::string & key, const std::string & value) |
|
|
|
bool plConfigInfo::KeyHasValue(const plString & section, const plString & key, const plString & value) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Sections::iterator si = fSections.find(section.c_str()); |
|
|
|
Sections::iterator si = fSections.find(section); |
|
|
|
if (si == fSections.end()) |
|
|
|
if (si == fSections.end()) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
return si->second.KeyHasValue(key,value); |
|
|
|
return si->second.KeyHasValue(key,value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool plConfigInfo::KeyHasValue(const std::string & section, const std::string & key, int value) |
|
|
|
bool plConfigInfo::KeyHasValue(const plString & section, const plString & key, int value) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Sections::iterator si = fSections.find(section.c_str()); |
|
|
|
Sections::iterator si = fSections.find(section); |
|
|
|
if (si == fSections.end()) |
|
|
|
if (si == fSections.end()) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
return si->second.KeyHasValue(key,value); |
|
|
|
return si->second.KeyHasValue(key,value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool plConfigInfo::KeyHasValue(const std::string & section, const std::string & key, double value) |
|
|
|
bool plConfigInfo::KeyHasValue(const plString & section, const plString & key, double value) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Sections::iterator si = fSections.find(section.c_str()); |
|
|
|
Sections::iterator si = fSections.find(section); |
|
|
|
if (si == fSections.end()) |
|
|
|
if (si == fSections.end()) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
return si->second.KeyHasValue(key,value); |
|
|
|
return si->second.KeyHasValue(key,value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool plConfigInfo::AddValue(const std::string & section, const std::string & key, const std::string & value, KAddValueMode mode) |
|
|
|
bool plConfigInfo::AddValue(const plString & section, const plString & key, const plString & value, KAddValueMode mode) |
|
|
|
{ |
|
|
|
{ |
|
|
|
fSections[section.c_str()].AddValue(key,value,mode); |
|
|
|
return fSections[section].AddValue(key,value,mode); |
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool plConfigInfo::AddValue(const std::string & section, const std::string & key, int value, KAddValueMode mode) |
|
|
|
bool plConfigInfo::AddValue(const plString & section, const plString & key, int value, KAddValueMode mode) |
|
|
|
{ |
|
|
|
{ |
|
|
|
char buf[20]; |
|
|
|
return fSections[section].AddValue(key,value,mode); |
|
|
|
sprintf(buf, "%d", value); |
|
|
|
|
|
|
|
std::string v(buf); |
|
|
|
|
|
|
|
return AddValue(section,key,v,mode);
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool plConfigInfo::AddValue(const std::string & section, const std::string & key, double value, KAddValueMode mode) |
|
|
|
bool plConfigInfo::AddValue(const plString & section, const plString & key, double value, KAddValueMode mode) |
|
|
|
{ |
|
|
|
{ |
|
|
|
char buf[30]; |
|
|
|
return fSections[section].AddValue(key,value,mode); |
|
|
|
sprintf(buf, "%f", value); |
|
|
|
|
|
|
|
std::string v(buf); |
|
|
|
|
|
|
|
return AddValue(section,key,v,mode);
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool plConfigInfo::AddValues(const std::string & section, const std::string & key, const std::vector<std::string> & values, KAddValueMode mode) |
|
|
|
bool plConfigInfo::AddValues(const plString & section, const plString & key, const std::vector<plString> & values, KAddValueMode mode) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return fSections[section.c_str()].AddValues(key,values); |
|
|
|
return fSections[section].AddValues(key,values); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
plKeysAndValues plConfigInfo::GetSection(const std::string & section, bool & found) |
|
|
|
plKeysAndValues plConfigInfo::GetSection(const plString & section, bool & found) |
|
|
|
{ |
|
|
|
{ |
|
|
|
found = HasSection(section); |
|
|
|
found = HasSection(section); |
|
|
|
if (found) |
|
|
|
if (found) |
|
|
|
return fSections[section.c_str()]; |
|
|
|
return fSections[section]; |
|
|
|
else |
|
|
|
else |
|
|
|
return plKeysAndValues(); // empty
|
|
|
|
return plKeysAndValues(); // empty
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
std::vector<std::string> plConfigInfo::GetSectionNames() |
|
|
|
std::vector<plString> plConfigInfo::GetSectionNames() |
|
|
|
{ |
|
|
|
{ |
|
|
|
std::vector<std::string> results; |
|
|
|
std::vector<plString> results; |
|
|
|
for (Sections::const_iterator ii=fSections.begin(); ii!=fSections.end(); ++ii) |
|
|
|
for (Sections::const_iterator ii=fSections.begin(); ii!=fSections.end(); ++ii) |
|
|
|
results.push_back(ii->first.c_str()); |
|
|
|
results.push_back(ii->first); |
|
|
|
return results; |
|
|
|
return results; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
std::string plConfigInfo::GetValue(const std::string & section, const std::string & key, const std::string & defval, bool * outFound) const |
|
|
|
plString plConfigInfo::GetValue(const plString & section, const plString & key, const plString & defval, bool * outFound) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
return fSections[section.c_str()].GetValue(key,defval,outFound); |
|
|
|
return fSections[section].GetValue(key,defval,outFound); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int plConfigInfo::GetValue(const std::string & section, const std::string & key, int defval, bool * outFound) const |
|
|
|
int plConfigInfo::GetValue(const plString & section, const plString & key, int defval, bool * outFound) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
return fSections[section.c_str()].GetValue(key,defval,outFound); |
|
|
|
return fSections[section].GetValue(key,defval,outFound); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
double plConfigInfo::GetValue(const std::string & section, const std::string & key, double defval, bool * outFound) const |
|
|
|
double plConfigInfo::GetValue(const plString & section, const plString & key, double defval, bool * outFound) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
return fSections[section.c_str()].GetValue(key,defval,outFound); |
|
|
|
return fSections[section].GetValue(key,defval,outFound); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
std::vector<std::string> plConfigInfo::GetAllValues(const std::string & section, const std::string & key) const |
|
|
|
std::vector<plString> plConfigInfo::GetAllValues(const plString & section, const plString & key) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
Sections::iterator si = fSections.find(section.c_str()); |
|
|
|
Sections::iterator si = fSections.find(section); |
|
|
|
if (si != fSections.end()) |
|
|
|
if (si != fSections.end()) |
|
|
|
return si->second.GetAllValues(key); |
|
|
|
return si->second.GetAllValues(key); |
|
|
|
std::vector<std::string> empty; |
|
|
|
return std::vector<plString>(); |
|
|
|
return empty; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::string plConfigInfo::GetValueAny(const std::string & key, const std::string & defval, bool * outFound) const |
|
|
|
plString plConfigInfo::GetValueAny(const plString & key, const plString & defval, bool * outFound) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (outFound) *outFound=false; |
|
|
|
if (outFound) *outFound=false; |
|
|
|
for (Sections::iterator si=fSections.begin(); si!=fSections.end(); ++si) |
|
|
|
for (Sections::iterator si=fSections.begin(); si!=fSections.end(); ++si) |
|
|
@ -240,7 +231,7 @@ std::string plConfigInfo::GetValueAny(const std::string & key, const std::string |
|
|
|
return defval; |
|
|
|
return defval; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int plConfigInfo::GetValueAny(const std::string & key, int defval, bool * outFound) const |
|
|
|
int plConfigInfo::GetValueAny(const plString & key, int defval, bool * outFound) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (outFound) *outFound=false; |
|
|
|
if (outFound) *outFound=false; |
|
|
|
for (Sections::iterator si=fSections.begin(); si!=fSections.end(); ++si) |
|
|
|
for (Sections::iterator si=fSections.begin(); si!=fSections.end(); ++si) |
|
|
@ -249,7 +240,7 @@ int plConfigInfo::GetValueAny(const std::string & key, int defval, bool * outFou |
|
|
|
return defval; |
|
|
|
return defval; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
double plConfigInfo::GetValueAny(const std::string & key, double defval, bool * outFound) const |
|
|
|
double plConfigInfo::GetValueAny(const plString & key, double defval, bool * outFound) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (outFound) *outFound=false; |
|
|
|
if (outFound) *outFound=false; |
|
|
|
for (Sections::iterator si=fSections.begin(); si!=fSections.end(); ++si) |
|
|
|
for (Sections::iterator si=fSections.begin(); si!=fSections.end(); ++si) |
|
|
@ -258,17 +249,16 @@ double plConfigInfo::GetValueAny(const std::string & key, double defval, bool * |
|
|
|
return defval; |
|
|
|
return defval; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
std::vector<std::string> plConfigInfo::GetAllValuesAny(const std::string & key) const |
|
|
|
std::vector<plString> plConfigInfo::GetAllValuesAny(const plString & key) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
for (Sections::iterator si=fSections.begin(); si!=fSections.end(); ++si) |
|
|
|
for (Sections::iterator si=fSections.begin(); si!=fSections.end(); ++si) |
|
|
|
if (si->second.HasKey(key)) |
|
|
|
if (si->second.HasKey(key)) |
|
|
|
return si->second.GetAllValues(key); |
|
|
|
return si->second.GetAllValues(key); |
|
|
|
std::vector<std::string> empty; |
|
|
|
return std::vector<plString>(); |
|
|
|
return empty; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::string plConfigInfo::GetValueIn(const std::string & key, const std::string & defval, bool * outFound, const char * section1, ...) const |
|
|
|
plString plConfigInfo::GetValueIn(const plString & key, const plString & defval, bool * outFound, const char * section1, ...) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (outFound) *outFound=false; |
|
|
|
if (outFound) *outFound=false; |
|
|
|
const char * section = section1; |
|
|
|
const char * section = section1; |
|
|
@ -288,14 +278,14 @@ std::string plConfigInfo::GetValueIn(const std::string & key, const std::string |
|
|
|
return defval; |
|
|
|
return defval; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
std::string plConfigInfo::GetValueIn(const std::string & key, const std::string & defval, bool * outFound, const std::vector<std::string> & sections ) const |
|
|
|
plString plConfigInfo::GetValueIn(const plString & key, const plString & defval, bool * outFound, const std::vector<plString> & sections ) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (outFound) *outFound=false; |
|
|
|
if (outFound) *outFound=false; |
|
|
|
for ( int i=0; i<sections.size(); i++ ) |
|
|
|
for ( int i=0; i<sections.size(); i++ ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (HasSection(sections[i])) |
|
|
|
if (HasSection(sections[i])) |
|
|
|
{ |
|
|
|
{ |
|
|
|
plKeysAndValues & kv = fSections[sections[i].c_str()]; |
|
|
|
plKeysAndValues & kv = fSections[sections[i]]; |
|
|
|
if (kv.HasKey(key)) |
|
|
|
if (kv.HasKey(key)) |
|
|
|
return kv.GetValue(key,defval,outFound); |
|
|
|
return kv.GetValue(key,defval,outFound); |
|
|
|
} |
|
|
|
} |
|
|
@ -303,7 +293,7 @@ std::string plConfigInfo::GetValueIn(const std::string & key, const std::string |
|
|
|
return defval; |
|
|
|
return defval; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int plConfigInfo::GetValueIn(const std::string & key, int defval, bool * outFound, const char * section1, ...) const |
|
|
|
int plConfigInfo::GetValueIn(const plString & key, int defval, bool * outFound, const char * section1, ...) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (outFound) *outFound=false; |
|
|
|
if (outFound) *outFound=false; |
|
|
|
const char * section = section1; |
|
|
|
const char * section = section1; |
|
|
@ -323,14 +313,14 @@ int plConfigInfo::GetValueIn(const std::string & key, int defval, bool * outFoun |
|
|
|
return defval; |
|
|
|
return defval; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int plConfigInfo::GetValueIn(const std::string & key, int defval, bool * outFound, const std::vector<std::string> & sections ) const |
|
|
|
int plConfigInfo::GetValueIn(const plString & key, int defval, bool * outFound, const std::vector<plString> & sections ) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (outFound) *outFound=false; |
|
|
|
if (outFound) *outFound=false; |
|
|
|
for ( int i=0; i<sections.size(); i++ ) |
|
|
|
for ( int i=0; i<sections.size(); i++ ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (HasSection(sections[i])) |
|
|
|
if (HasSection(sections[i])) |
|
|
|
{ |
|
|
|
{ |
|
|
|
plKeysAndValues & kv = fSections[sections[i].c_str()]; |
|
|
|
plKeysAndValues & kv = fSections[sections[i]]; |
|
|
|
if (kv.HasKey(key)) |
|
|
|
if (kv.HasKey(key)) |
|
|
|
return kv.GetValue(key,defval,outFound); |
|
|
|
return kv.GetValue(key,defval,outFound); |
|
|
|
} |
|
|
|
} |
|
|
@ -338,7 +328,7 @@ int plConfigInfo::GetValueIn(const std::string & key, int defval, bool * outFoun |
|
|
|
return defval; |
|
|
|
return defval; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
double plConfigInfo::GetValueIn(const std::string & key, double defval, bool * outFound, const char * section1, ...) const |
|
|
|
double plConfigInfo::GetValueIn(const plString & key, double defval, bool * outFound, const char * section1, ...) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (outFound) *outFound=false; |
|
|
|
if (outFound) *outFound=false; |
|
|
|
const char * section = section1; |
|
|
|
const char * section = section1; |
|
|
@ -358,14 +348,14 @@ double plConfigInfo::GetValueIn(const std::string & key, double defval, bool * o |
|
|
|
return defval; |
|
|
|
return defval; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
double plConfigInfo::GetValueIn(const std::string & key, double defval, bool * outFound, const std::vector<std::string> & sections ) const |
|
|
|
double plConfigInfo::GetValueIn(const plString & key, double defval, bool * outFound, const std::vector<plString> & sections ) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (outFound) *outFound=false; |
|
|
|
if (outFound) *outFound=false; |
|
|
|
for ( int i=0; i<sections.size(); i++ ) |
|
|
|
for ( int i=0; i<sections.size(); i++ ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (HasSection(sections[i])) |
|
|
|
if (HasSection(sections[i])) |
|
|
|
{ |
|
|
|
{ |
|
|
|
plKeysAndValues & kv = fSections[sections[i].c_str()]; |
|
|
|
plKeysAndValues & kv = fSections[sections[i]]; |
|
|
|
if (kv.HasKey(key)) |
|
|
|
if (kv.HasKey(key)) |
|
|
|
return kv.GetValue(key,defval,outFound); |
|
|
|
return kv.GetValue(key,defval,outFound); |
|
|
|
} |
|
|
|
} |
|
|
@ -373,12 +363,12 @@ double plConfigInfo::GetValueIn(const std::string & key, double defval, bool * o |
|
|
|
return defval; |
|
|
|
return defval; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
std::vector<std::string> plConfigInfo::GetAllValuesIn(const std::string & key, const char * section1, ...) |
|
|
|
std::vector<plString> plConfigInfo::GetAllValuesIn(const plString & key, const char * section1, ...) |
|
|
|
{ |
|
|
|
{ |
|
|
|
const char * section = section1; |
|
|
|
const char * section = section1; |
|
|
|
va_list sections; |
|
|
|
va_list sections; |
|
|
|
va_start(sections,section1); |
|
|
|
va_start(sections,section1); |
|
|
|
std::vector<std::string> result; |
|
|
|
std::vector<plString> result; |
|
|
|
while (section) |
|
|
|
while (section) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (HasSection(section)) |
|
|
|
if (HasSection(section)) |
|
|
@ -386,7 +376,7 @@ std::vector<std::string> plConfigInfo::GetAllValuesIn(const std::string & key, c |
|
|
|
plKeysAndValues & kv = fSections[section]; |
|
|
|
plKeysAndValues & kv = fSections[section]; |
|
|
|
if (kv.HasKey(key)) |
|
|
|
if (kv.HasKey(key)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
std::vector<std::string> values = kv.GetAllValues(key); |
|
|
|
std::vector<plString> values = kv.GetAllValues(key); |
|
|
|
result.insert(result.end(),values.begin(),values.end()); |
|
|
|
result.insert(result.end(),values.begin(),values.end()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -403,7 +393,7 @@ bool plConfigInfo::GetSectionIterators(Sections::const_iterator & iter, Sections |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool plConfigInfo::GetKeyIterators(const xtl::istring & section, Keys::const_iterator & iter, Keys::const_iterator & end) const |
|
|
|
bool plConfigInfo::GetKeyIterators(const plString & section, Keys::const_iterator & iter, Keys::const_iterator & end) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
Sections::const_iterator si = fSections.find(section); |
|
|
|
Sections::const_iterator si = fSections.find(section); |
|
|
|
if (si==fSections.end()) |
|
|
|
if (si==fSections.end()) |
|
|
@ -411,7 +401,7 @@ bool plConfigInfo::GetKeyIterators(const xtl::istring & section, Keys::const_ite |
|
|
|
return fSections[section].GetKeyIterators(iter, end); |
|
|
|
return fSections[section].GetKeyIterators(iter, end); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool plConfigInfo::GetValueIterators(const xtl::istring & section, const xtl::istring & key, Values::const_iterator & iter, Values::const_iterator & end) const |
|
|
|
bool plConfigInfo::GetValueIterators(const plString & section, const plString & key, Values::const_iterator & iter, Values::const_iterator & end) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
Sections::const_iterator si = fSections.find(section); |
|
|
|
Sections::const_iterator si = fSections.find(section); |
|
|
|
if (si==fSections.end()) |
|
|
|
if (si==fSections.end()) |
|
|
@ -432,63 +422,62 @@ bool plConfigInfo::WriteTo(plConfigSource * src) |
|
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////
|
|
|
|
////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
void plConfigSource::SplitAt(std::string & key, std::string & value, char splitter, std::string & in) |
|
|
|
void plConfigSource::SplitAt(plString & key, plString & value, char splitter, plString & in) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if(in.length() == 0) |
|
|
|
if (in.IsEmpty()) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
int t = in.find(splitter); |
|
|
|
int t = in.Find(splitter); |
|
|
|
if(t == std::string::npos) |
|
|
|
if (t < 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
key = in; |
|
|
|
key = in; |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
key.assign(in.substr(0,t)); |
|
|
|
key = in.Left(t); |
|
|
|
value.assign(in.substr(t+1,in.size()-t-1));
|
|
|
|
value = in.Substr(t+1,in.GetSize()-t-1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool plConfigSource::ReadString(const std::string & in) |
|
|
|
bool plConfigSource::ReadString(const plString & in) |
|
|
|
{ |
|
|
|
{ |
|
|
|
std::string work = in; |
|
|
|
plString work = in.Trim(); |
|
|
|
xtl::trim(work); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// comment
|
|
|
|
// comment
|
|
|
|
if (work[0] == '#') |
|
|
|
if (work.CharAt(0) == '#') |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
// comment
|
|
|
|
// comment
|
|
|
|
if (work[0] == ';') |
|
|
|
if (work.CharAt(0) == ';') |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
// section
|
|
|
|
// section
|
|
|
|
if (work[0] == '[') |
|
|
|
if (work.CharAt(0) == '[') |
|
|
|
{ |
|
|
|
{ |
|
|
|
int close = work.find_first_of("]"); |
|
|
|
int close = work.Find("]"); |
|
|
|
if(close == std::string::npos) |
|
|
|
if (close < 0) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
fCurrSection = work.substr(1,close-1); |
|
|
|
fCurrSection = work.Substr(1, close-1); |
|
|
|
fEffectiveSection = fCurrSection; |
|
|
|
fEffectiveSection = fCurrSection; |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// key=value
|
|
|
|
// key=value
|
|
|
|
std::string key, value; |
|
|
|
plString key, value; |
|
|
|
SplitAt(key, value, '=', work); |
|
|
|
SplitAt(key, value, '=', work); |
|
|
|
|
|
|
|
|
|
|
|
// dot notation makes section change for this key=value only.
|
|
|
|
// dot notation makes section change for this key=value only.
|
|
|
|
int t = key.find('.'); |
|
|
|
int t = key.Find('.'); |
|
|
|
if (t>0 && t<key.size()-1) |
|
|
|
if (t>0 && t<key.GetSize()-1) |
|
|
|
{ |
|
|
|
{ |
|
|
|
fEffectiveSection.assign(key.substr(0,t)); |
|
|
|
fEffectiveSection = key.Left(t); |
|
|
|
key.assign(key.substr(t+1)); |
|
|
|
key = key.Substr(t+1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool ret=ReadPair(key, value); |
|
|
|
bool ret=ReadPair(key, value); |
|
|
|
fEffectiveSection = fCurrSection; |
|
|
|
fEffectiveSection = fCurrSection; |
|
|
|
|
|
|
|
|
|
|
|
if(ret && strcmp("LoadIni",key.c_str()) == 0) |
|
|
|
if(ret && key.Compare("LoadIni") == 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ret = ReadSubSource( value.c_str() ); |
|
|
|
ret = ReadSubSource( value.c_str() ); |
|
|
|
} |
|
|
|
} |
|
|
@ -496,15 +485,14 @@ bool plConfigSource::ReadString(const std::string & in) |
|
|
|
return ret; |
|
|
|
return ret; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool plConfigSource::ReadPair(std::string & key, std::string & value) |
|
|
|
bool plConfigSource::ReadPair(plString & key, plString & value) |
|
|
|
{ |
|
|
|
{ |
|
|
|
hsAssert(fConfigInfo, "plConfigSource::ProcessPair: fConfigInfo not set."); |
|
|
|
hsAssert(fConfigInfo, "plConfigSource::ProcessPair: fConfigInfo not set."); |
|
|
|
|
|
|
|
|
|
|
|
xtl::trim(key); |
|
|
|
key = key.Trim(); |
|
|
|
xtl::trim(value); |
|
|
|
value = value.Trim().Trim("\"'"); |
|
|
|
xtl::trim(value,"\"'"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (key.size() == 0) |
|
|
|
if (key.IsEmpty()) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
return fConfigInfo->AddValue(fEffectiveSection, key, value, fAddMode); |
|
|
|
return fConfigInfo->AddValue(fEffectiveSection, key, value, fAddMode); |
|
|
@ -542,7 +530,7 @@ bool plConfigSource::WriteOutOf(plConfigInfo & configInfo) |
|
|
|
plCmdLineConfigSource::plCmdLineConfigSource(int argc, char ** argv, const char * mySection) |
|
|
|
plCmdLineConfigSource::plCmdLineConfigSource(int argc, char ** argv, const char * mySection) |
|
|
|
: fArgc(argc) |
|
|
|
: fArgc(argc) |
|
|
|
, fArgv(argv) |
|
|
|
, fArgv(argv) |
|
|
|
, fMySection(mySection?mySection:"") |
|
|
|
, fMySection(mySection) |
|
|
|
{} |
|
|
|
{} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -560,7 +548,7 @@ bool plCmdLineConfigSource::ReadInto(plConfigInfo & configInfo, KAddValueMode mo |
|
|
|
if(argc < 1) |
|
|
|
if(argc < 1) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
fConfigInfo->AddValue(fEffectiveSection.c_str(), "ARGV0", *argv, fAddMode); |
|
|
|
fConfigInfo->AddValue(fEffectiveSection, "ARGV0", *argv, fAddMode); |
|
|
|
argc--; |
|
|
|
argc--; |
|
|
|
argv++; |
|
|
|
argv++; |
|
|
|
|
|
|
|
|
|
|
@ -582,7 +570,7 @@ bool plCmdLineConfigSource::ReadInto(plConfigInfo & configInfo, KAddValueMode mo |
|
|
|
|
|
|
|
|
|
|
|
plEnvConfigSource::plEnvConfigSource(char ** envp, const char * mySection) |
|
|
|
plEnvConfigSource::plEnvConfigSource(char ** envp, const char * mySection) |
|
|
|
: fEnvp(envp) |
|
|
|
: fEnvp(envp) |
|
|
|
, fMySection(mySection?mySection:"") |
|
|
|
, fMySection(mySection) |
|
|
|
{} |
|
|
|
{} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -617,7 +605,7 @@ bool plIniConfigSource::ReadInto(plConfigInfo & configInfo, KAddValueMode mode) |
|
|
|
fCurrSection = plConfigInfo::GlobalSection(); |
|
|
|
fCurrSection = plConfigInfo::GlobalSection(); |
|
|
|
fEffectiveSection = fCurrSection; |
|
|
|
fEffectiveSection = fCurrSection; |
|
|
|
|
|
|
|
|
|
|
|
if(fFileName.size() < 2) |
|
|
|
if(fFileName.GetSize() < 2) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -760,33 +748,34 @@ bool plIniStreamConfigSource::WriteOutOf(plConfigInfo & configInfo) |
|
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////
|
|
|
|
/////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
plIniSectionConfigSource::plIniSectionConfigSource(const char * iniFileName, std::vector<std::string> & sections) |
|
|
|
plIniSectionConfigSource::plIniSectionConfigSource(const char * iniFileName, std::vector<plString> & sections) |
|
|
|
: plIniConfigSource(iniFileName) |
|
|
|
: plIniConfigSource(iniFileName) |
|
|
|
{ |
|
|
|
{ |
|
|
|
for (int i=0; i<sections.size(); i++) |
|
|
|
for (int i=0; i<sections.size(); i++) |
|
|
|
fSections.push_back(sections[i].c_str()); |
|
|
|
fSections.push_back(sections[i]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool plIniSectionConfigSource::ReadPair(std::string & key, std::string & value) |
|
|
|
bool plIniSectionConfigSource::ReadPair(plString & key, plString & value) |
|
|
|
{ |
|
|
|
{ |
|
|
|
hsAssert(fConfigInfo, "plConfigSource::ProcessPair: fConfigInfo not set."); |
|
|
|
hsAssert(fConfigInfo, "plConfigSource::ProcessPair: fConfigInfo not set."); |
|
|
|
|
|
|
|
|
|
|
|
// the current section must be in list of sections.
|
|
|
|
// the current section must be in list of sections.
|
|
|
|
std::vector<xtl::istring>::iterator ii = std::find(fSections.begin(), fSections.end(), fCurrSection.c_str()); |
|
|
|
Sections::iterator ii = std::find_if(fSections.begin(), fSections.end(), |
|
|
|
|
|
|
|
[this](const plString &v) { return v.CompareI(fCurrSection) == 0; } |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
if (ii==fSections.end()) |
|
|
|
if (ii==fSections.end()) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
xtl::trim(key); |
|
|
|
key = key.Trim(); |
|
|
|
xtl::trim(value); |
|
|
|
value = value.Trim().Trim("\"'"); |
|
|
|
xtl::trim(value,"\"'"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (key.size() == 0) |
|
|
|
if (key.IsEmpty()) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
if (key == "section") |
|
|
|
if (key.CompareI("section") == 0) |
|
|
|
fSections.push_back(value.c_str()); |
|
|
|
fSections.push_back(value); |
|
|
|
|
|
|
|
|
|
|
|
return fConfigInfo->AddValue(fEffectiveSection, key, value, fAddMode); |
|
|
|
return fConfigInfo->AddValue(fEffectiveSection, key, value, fAddMode); |
|
|
|
} |
|
|
|
} |
|
|
@ -794,10 +783,7 @@ bool plIniSectionConfigSource::ReadPair(std::string & key, std::string & value) |
|
|
|
|
|
|
|
|
|
|
|
bool plIniSectionConfigSource::ReadSubSource( const char * name ) |
|
|
|
bool plIniSectionConfigSource::ReadSubSource( const char * name ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
std::vector<std::string> sections; |
|
|
|
plIniSectionConfigSource src(name, fSections); |
|
|
|
for ( int i=0; i<fSections.size(); i++ ) |
|
|
|
|
|
|
|
sections.push_back( fSections[i].c_str() ); |
|
|
|
|
|
|
|
plIniSectionConfigSource src(name, sections); |
|
|
|
|
|
|
|
return fConfigInfo->ReadFrom(&src); |
|
|
|
return fConfigInfo->ReadFrom(&src); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -809,21 +795,20 @@ plIniNoSectionsConfigSource::plIniNoSectionsConfigSource(const char * filename) |
|
|
|
fEffectiveSection = fCurrSection = ""; |
|
|
|
fEffectiveSection = fCurrSection = ""; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool plIniNoSectionsConfigSource::ReadString(const std::string & in) |
|
|
|
bool plIniNoSectionsConfigSource::ReadString(const plString & in) |
|
|
|
{ |
|
|
|
{ |
|
|
|
std::string work = in; |
|
|
|
plString work = in.Trim(); |
|
|
|
xtl::trim(work); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ignore comments
|
|
|
|
// ignore comments
|
|
|
|
if (work[0]=='#' || work[0]==';') |
|
|
|
if (work.CharAt(0)=='#' || work.CharAt(0)==';') |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
// ignore sections
|
|
|
|
// ignore sections
|
|
|
|
if (work[0] == '[') |
|
|
|
if (work.CharAt(0) == '[') |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
// parse key value
|
|
|
|
// parse key value
|
|
|
|
std::string key, value; |
|
|
|
plString key, value; |
|
|
|
SplitAt(key, value, '=', work); |
|
|
|
SplitAt(key, value, '=', work); |
|
|
|
|
|
|
|
|
|
|
|
return ReadPair(key, value); |
|
|
|
return ReadPair(key, value); |
|
|
@ -834,7 +819,7 @@ bool plIniNoSectionsConfigSource::ReadInto(plConfigInfo & configInfo, KAddValueM |
|
|
|
if (!plConfigSource::ReadInto(configInfo, mode)) |
|
|
|
if (!plConfigSource::ReadInto(configInfo, mode)) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
if(fFileName.size() < 2) |
|
|
|
if (fFileName.GetSize() < 2) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
std::ifstream file; |
|
|
|
std::ifstream file; |
|
|
@ -944,11 +929,11 @@ void plConfigValueBase::ConfigRead(plConfigInfo * opts) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (fReadEvaluate()) |
|
|
|
if (fReadEvaluate()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
std::string value; |
|
|
|
plString value; |
|
|
|
bool found; |
|
|
|
bool found; |
|
|
|
value = opts->GetValue(GetConfigGroup(),GetConfigName(),"",&found); |
|
|
|
value = opts->GetValue(GetConfigGroup(),GetConfigName(),"",&found); |
|
|
|
if (found) |
|
|
|
if (found) |
|
|
|
SetValue(fReadModify(value).c_str()); |
|
|
|
SetValue(fReadModify(value)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -960,12 +945,12 @@ void plConfigValueBase::ConfigWrite(plConfigInfo * opts) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void plConfigValueBase::SetValue(const char * value) |
|
|
|
void plConfigValueBase::SetValue(const plString & value) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ISetValue(fSetModify(value).c_str()); |
|
|
|
ISetValue(fSetModify(value)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
std::string plConfigValueBase::GetValue() const |
|
|
|
plString plConfigValueBase::GetValue() const |
|
|
|
{ |
|
|
|
{ |
|
|
|
return fGetModify(IGetValue()); |
|
|
|
return fGetModify(IGetValue()); |
|
|
|
} |
|
|
|
} |
|
|
@ -1030,7 +1015,7 @@ bool plConfigGroup::Write(plConfigSource * src) |
|
|
|
|
|
|
|
|
|
|
|
void plConfigGroup::AddItem(plConfigValueBase * item, const char * name) |
|
|
|
void plConfigGroup::AddItem(plConfigValueBase * item, const char * name) |
|
|
|
{ |
|
|
|
{ |
|
|
|
item->SetConfigGroup(fGroupName.c_str()); |
|
|
|
item->SetConfigGroup(fGroupName); |
|
|
|
if (name) |
|
|
|
if (name) |
|
|
|
item->SetConfigName(name); |
|
|
|
item->SetConfigName(name); |
|
|
|
fItems.push_back(item); |
|
|
|
fItems.push_back(item); |
|
|
@ -1071,29 +1056,28 @@ void plConfigAggregateValue::AddItems( |
|
|
|
if (item7) AddItem(item7); |
|
|
|
if (item7) AddItem(item7); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void plConfigAggregateValue::ISetValue(const char * value) |
|
|
|
void plConfigAggregateValue::ISetValue(const plString & value) |
|
|
|
{ |
|
|
|
{ |
|
|
|
std::string work = value; |
|
|
|
plString work = value.Trim(); |
|
|
|
int p=0,i=0; |
|
|
|
int p=0,i=0; |
|
|
|
do |
|
|
|
do |
|
|
|
{ |
|
|
|
{ |
|
|
|
xtl::trim(work); |
|
|
|
p = work.Find(" "); |
|
|
|
p = work.find(" "); |
|
|
|
fItems[i]->SetValue(work.Left(p)); |
|
|
|
fItems[i]->SetValue(work.substr(0,p).c_str()); |
|
|
|
work = work.Substr(p).TrimLeft(); |
|
|
|
work.erase(0,p); |
|
|
|
|
|
|
|
i++; |
|
|
|
i++; |
|
|
|
} while (i<fItems.size() && p!=std::string::npos); |
|
|
|
} while (i<fItems.size() && p>=0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
std::string plConfigAggregateValue::IGetValue() const |
|
|
|
plString plConfigAggregateValue::IGetValue() const |
|
|
|
{ |
|
|
|
{ |
|
|
|
std::string value; |
|
|
|
plStringStream value; |
|
|
|
for (int i=0; i<fItems.size(); i++) |
|
|
|
for (int i=0; i<fItems.size(); i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
value.append(fItems[i]->GetValue()); |
|
|
|
value << fItems[i]->GetValue(); |
|
|
|
value.append(" "); |
|
|
|
value << ' '; |
|
|
|
} |
|
|
|
} |
|
|
|
return xtl::trim(value); |
|
|
|
return value.GetString().Trim(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void plConfigAggregateValue::AddItem(plConfigValueBase * item) |
|
|
|
void plConfigAggregateValue::AddItem(plConfigValueBase * item) |
|
|
@ -1103,7 +1087,7 @@ void plConfigAggregateValue::AddItem(plConfigValueBase * item) |
|
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
plWWWAuthenticateConfigSource::plWWWAuthenticateConfigSource(const std::string& auth) |
|
|
|
plWWWAuthenticateConfigSource::plWWWAuthenticateConfigSource(const plString& auth) |
|
|
|
: fAuth(auth) |
|
|
|
: fAuth(auth) |
|
|
|
{ |
|
|
|
{ |
|
|
|
fEffectiveSection = fCurrSection = ""; |
|
|
|
fEffectiveSection = fCurrSection = ""; |
|
|
@ -1119,21 +1103,20 @@ bool plWWWAuthenticateConfigSource::ReadInto(plConfigInfo & configInfo, KAddValu |
|
|
|
|
|
|
|
|
|
|
|
unsigned int i = 0; |
|
|
|
unsigned int i = 0; |
|
|
|
|
|
|
|
|
|
|
|
while (i < fAuth.size()) |
|
|
|
while (i < fAuth.GetSize()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
bool inQuote = false; |
|
|
|
bool inQuote = false; |
|
|
|
unsigned int begin = i,end; |
|
|
|
unsigned int begin = i,end; |
|
|
|
while (i < fAuth.size()
|
|
|
|
while (i < fAuth.GetSize() |
|
|
|
&& ((fAuth[i] != ',' && !inQuote) || inQuote)) |
|
|
|
&& ((fAuth.CharAt(i) != ',' && !inQuote) || inQuote)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (fAuth[i] == '"') |
|
|
|
if (fAuth.CharAt(i) == '"') |
|
|
|
inQuote = ! inQuote; |
|
|
|
inQuote = ! inQuote; |
|
|
|
i++; |
|
|
|
i++; |
|
|
|
} |
|
|
|
} |
|
|
|
end = i; |
|
|
|
end = i; |
|
|
|
|
|
|
|
|
|
|
|
std::string buf; |
|
|
|
plString buf = fAuth.Substr(begin, end-begin); |
|
|
|
buf.assign(fAuth,begin,end-begin); |
|
|
|
|
|
|
|
if(!ReadString(buf.c_str())) |
|
|
|
if(!ReadString(buf.c_str())) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// TODO log warning here
|
|
|
|
// TODO log warning here
|
|
|
|