diff options
author | Bernard Normier <bernard@zeroc.com> | 2007-02-01 17:09:49 +0000 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2007-02-01 17:09:49 +0000 |
commit | abada90e3f84dc703b8ddc9efcbed8a946fadead (patch) | |
tree | 2c6f9dccd510ea97cb927a7bd635422efaae547a /cpp/src/Ice/PropertiesI.cpp | |
parent | removing trace message (diff) | |
download | ice-abada90e3f84dc703b8ddc9efcbed8a946fadead.tar.bz2 ice-abada90e3f84dc703b8ddc9efcbed8a946fadead.tar.xz ice-abada90e3f84dc703b8ddc9efcbed8a946fadead.zip |
Expanded tabs into spaces
Diffstat (limited to 'cpp/src/Ice/PropertiesI.cpp')
-rw-r--r-- | cpp/src/Ice/PropertiesI.cpp | 142 |
1 files changed, 71 insertions, 71 deletions
diff --git a/cpp/src/Ice/PropertiesI.cpp b/cpp/src/Ice/PropertiesI.cpp index 84b0f29bce3..86ddccf7cae 100644 --- a/cpp/src/Ice/PropertiesI.cpp +++ b/cpp/src/Ice/PropertiesI.cpp @@ -28,11 +28,11 @@ Ice::PropertiesI::getProperty(const string& key) map<string, string>::const_iterator p = _properties.find(key); if(p != _properties.end()) { - return p->second; + return p->second; } else { - return string(); + return string(); } } @@ -44,11 +44,11 @@ Ice::PropertiesI::getPropertyWithDefault(const string& key, const string& value) map<string, string>::const_iterator p = _properties.find(key); if(p != _properties.end()) { - return p->second; + return p->second; } else { - return value; + return value; } } @@ -66,11 +66,11 @@ Ice::PropertiesI::getPropertyAsIntWithDefault(const string& key, Int value) map<string, string>::const_iterator p = _properties.find(key); if(p != _properties.end()) { - istringstream v(p->second); - if(!(v >> value) || !v.eof()) - { - return 0; - } + istringstream v(p->second); + if(!(v >> value) || !v.eof()) + { + return 0; + } } return value; @@ -99,7 +99,7 @@ Ice::PropertiesI::setProperty(const string& key, const string& value) { if(key.empty()) { - return; + return; } // @@ -109,28 +109,28 @@ Ice::PropertiesI::setProperty(const string& key, const string& value) string::size_type dotPos = key.find('.'); if(dotPos != string::npos) { - string prefix = key.substr(0, dotPos); - for(const char* const** i = IceInternal::PropertyNames::validProps; *i != 0; ++i) - { - string pattern(*i[0]); - dotPos = pattern.find('.'); - assert(dotPos != string::npos); - string propPrefix = pattern.substr(0, dotPos); - if(propPrefix != prefix) - { - continue; - } - - bool found = false; - for(const char* const* j = *i; *j != 0 && !found; ++j) - { - found = IceUtil::match(key, *j); - } - if(!found) - { - logger->warning("unknown property: " + key); - } - } + string prefix = key.substr(0, dotPos); + for(const char* const** i = IceInternal::PropertyNames::validProps; *i != 0; ++i) + { + string pattern(*i[0]); + dotPos = pattern.find('.'); + assert(dotPos != string::npos); + string propPrefix = pattern.substr(0, dotPos); + if(propPrefix != prefix) + { + continue; + } + + bool found = false; + for(const char* const* j = *i; *j != 0 && !found; ++j) + { + found = IceUtil::match(key, *j); + } + if(!found) + { + logger->warning("unknown property: " + key); + } + } } IceUtil::Mutex::Lock sync(*this); @@ -140,11 +140,11 @@ Ice::PropertiesI::setProperty(const string& key, const string& value) // if(!value.empty()) { - _properties[key] = value; + _properties[key] = value; } else { - _properties.erase(key); + _properties.erase(key); } } @@ -158,7 +158,7 @@ Ice::PropertiesI::getCommandLineOptions() map<string, string>::const_iterator p; for(p = _properties.begin(); p != _properties.end(); ++p) { - result.push_back("--" + p->first + "=" + p->second); + result.push_back("--" + p->first + "=" + p->second); } return result; } @@ -169,7 +169,7 @@ Ice::PropertiesI::parseCommandLineOptions(const string& prefix, const StringSeq& string pfx = prefix; if(!pfx.empty() && pfx[pfx.size() - 1] != '.') { - pfx += '.'; + pfx += '.'; } pfx = "--" + pfx; @@ -215,7 +215,7 @@ Ice::PropertiesI::load(const std::string& file) if(!in) { FileException ex(__FILE__, __LINE__); - ex.path = file; + ex.path = file; ex.error = getSystemErrno(); throw ex; } @@ -223,7 +223,7 @@ Ice::PropertiesI::load(const std::string& file) char line[1024]; while(in.getline(line, 1024)) { - parseLine(line, _converter); + parseLine(line, _converter); } } @@ -250,24 +250,24 @@ Ice::PropertiesI::PropertiesI(StringSeq& args, const PropertiesPtr& defaults, co { if(defaults != 0) { - _properties = defaults->getPropertiesForPrefix(""); + _properties = defaults->getPropertiesForPrefix(""); } StringSeq::iterator q = args.begin(); if(_properties.find("Ice.ProgramName") == _properties.end()) { - if(q != args.end()) - { - // - // Use the first argument as the value for Ice.ProgramName. Replace - // any backslashes in this value with forward slashes, in case this - // value is used by the event logger. - // - string name = *q; - replace(name.begin(), name.end(), '\\', '/'); - setProperty("Ice.ProgramName", name); - } + if(q != args.end()) + { + // + // Use the first argument as the value for Ice.ProgramName. Replace + // any backslashes in this value with forward slashes, in case this + // value is used by the event logger. + // + string name = *q; + replace(name.begin(), name.end(), '\\', '/'); + setProperty("Ice.ProgramName", name); + } } StringSeq tmp; @@ -283,27 +283,27 @@ Ice::PropertiesI::PropertiesI(StringSeq& args, const PropertiesPtr& defaults, co s += "=1"; } parseLine(s.substr(2), 0); - loadConfigFiles = true; + loadConfigFiles = true; } else { - tmp.push_back(s); + tmp.push_back(s); } - ++q; + ++q; } args = tmp; if(!loadConfigFiles) { - // - // If Ice.Config is not set, load from ICE_CONFIG (if set) - // - loadConfigFiles = (_properties.find("Ice.Config") == _properties.end()); + // + // If Ice.Config is not set, load from ICE_CONFIG (if set) + // + loadConfigFiles = (_properties.find("Ice.Config") == _properties.end()); } if(loadConfigFiles) { - loadConfig(); + loadConfig(); } args = parseIceCommandLineOptions(args); @@ -319,25 +319,25 @@ Ice::PropertiesI::parseLine(const string& line, const StringConverterPtr& conver string::size_type idx = s.find('#'); if(idx != string::npos) { - s.erase(idx); + s.erase(idx); } idx = s.find_last_not_of(delim); if(idx != string::npos && idx + 1 < s.length()) { - s.erase(idx + 1); + s.erase(idx + 1); } string::size_type beg = s.find_first_not_of(delim); if(beg == string::npos) { - return; + return; } string::size_type end = s.find_first_of(delim + "=", beg); if(end == string::npos) { - return; + return; } string key = s.substr(beg, end - beg); @@ -345,7 +345,7 @@ Ice::PropertiesI::parseLine(const string& line, const StringConverterPtr& conver end = s.find('=', end); if(end == string::npos) { - return; + return; } ++end; @@ -353,20 +353,20 @@ Ice::PropertiesI::parseLine(const string& line, const StringConverterPtr& conver beg = s.find_first_not_of(delim, end); if(beg != string::npos) { - end = s.length(); - value = s.substr(beg, end - beg); + end = s.length(); + value = s.substr(beg, end - beg); } if(converter) { string tmp; - converter->fromUTF8(reinterpret_cast<const Byte*>(key.data()), - reinterpret_cast<const Byte*>(key.data() + key.size()), tmp); - key.swap(tmp); + converter->fromUTF8(reinterpret_cast<const Byte*>(key.data()), + reinterpret_cast<const Byte*>(key.data() + key.size()), tmp); + key.swap(tmp); - converter->fromUTF8(reinterpret_cast<const Byte*>(value.data()), - reinterpret_cast<const Byte*>(value.data() + value.size()), tmp); - value.swap(tmp); + converter->fromUTF8(reinterpret_cast<const Byte*>(value.data()), + reinterpret_cast<const Byte*>(value.data() + value.size()), tmp); + value.swap(tmp); } setProperty(key, value); |