24 std::string fullLine, command;
25 std::string leftSide, rightSide;
27 std::string::size_type length;
28 bool partiallyRead(
false);
31 if (in.getline(line, 256) || !in.bad()) {
34 fullLine.append(line);
37 partiallyRead = (in.fail() && !in.bad());
38 if (partiallyRead && !in.eof()) {
39 in.clear(in.rdstate() & ~
std::ios::failbit);
51 length = fullLine.find(
'#');
52 if (length == std::string::npos) {
54 }
else if (length > 0) {
55 command = fullLine.substr(0, length);
61 length = command.find(
'=');
62 if (length != std::string::npos) {
64 rightSide =
StringUtil::trim(command.substr(length + 1, command.size() - length));
79 length = leftSide.find(
'.');
80 if (leftSide.substr(0, length) ==
"log4j" ||
81 leftSide.substr(0, length) ==
"log4cpp")
82 leftSide = leftSide.substr(length + 1);
85 insert(value_type(leftSide, rightSide));
90 for(const_iterator i = begin(); i != end(); ++i) {
91 out << (*i).first <<
"=" << (*i).second << std::endl;
96 const_iterator key = find(property);
97 return (key == end()) ? defaultValue : std::atoi((*key).second.c_str());
101 const_iterator key = find(property);
102 return (key == end()) ? defaultValue : ((*key).second ==
"true");
106 const char* defaultValue) {
107 const_iterator key = find(property);
108 return (key == end()) ? std::string(defaultValue) : (*key).second;
114 std::string::size_type
left = 0;
115 std::string::size_type right = value.find(
"${", left);
116 if (right == std::string::npos) {
122 result += value.substr(left, right - left);
123 if (right == std::string::npos) {
128 right = value.find(
'}', left);
129 if (right == std::string::npos) {
131 result += value.substr(left - 2);
134 const std::string key = value.substr(left, right - left);
138 char* value = std::getenv(key.c_str());
142 const_iterator it = find(key);
146 result += (*it).second;
153 right = value.find(
"${", left);
virtual void save(std::ostream &out)
virtual void _substituteVariables(std::string &value)
static std::string trim(const std::string &s)
LOG4CPP_EXPORT CategoryStream & left(CategoryStream &os)
virtual int getInt(const std::string &property, int defaultValue)
virtual void load(std::istream &in)
virtual std::string getString(const std::string &property, const char *defaultValue)
virtual bool getBool(const std::string &property, bool defaultValue)