Switch to unified view

a/src/utils/conftree.h b/src/utils/conftree.h
...
...
106
     */
106
     */
107
    virtual std::list<string> getNames(const string &sk);
107
    virtual std::list<string> getNames(const string &sk);
108
108
109
    virtual std::string getFilename() {return filename;}
109
    virtual std::string getFilename() {return filename;}
110
110
111
    /**
112
     * Copy constructor. Expensive but less so than a full rebuild
113
     */
114
    ConfSimple(const ConfSimple &rhs) : data(0) {
115
  if ((status = rhs.status) == STATUS_ERROR)
116
      return;
117
  filename = rhs.filename;
118
  if (rhs.data) {
119
      data = new string(*(rhs.data));
120
  }
121
  submaps = rhs.submaps;
122
    }
123
124
    /**
125
     * Assignement. This is expensive
126
     */
127
    ConfSimple& operator=(const ConfSimple &rhs) {
128
  if (this != &rhs && (status = rhs.status) != STATUS_ERROR) {
129
      delete data;
130
      data = 0;
131
      filename = rhs.filename;
132
      if (rhs.data) {
133
      data = new string(*(rhs.data));
134
      }
135
      submaps = rhs.submaps;
136
  }
137
  return *this;
138
    }
139
111
 protected:
140
 protected:
112
    bool dotildexpand;
141
    bool dotildexpand;
113
 private:
142
 private:
143
    StatusCode status;
114
    string filename; // set if we're working with a file
144
    string filename; // set if we're working with a file
115
    string *data;    // set if we're working with an in-memory string
145
    string *data;    // set if we're working with an in-memory string
116
    map<string, map<string, string> > submaps;
146
    map<string, map<string, string> > submaps;
117
    StatusCode status;
147
118
    void parseinput(std::istream &input);
148
    void parseinput(std::istream &input);
119
};
149
};
120
150
121
/**
151
/**
122
 * This is a configuration class which attaches tree-like signification to the
152
 * This is a configuration class which attaches tree-like signification to the
...
...
139
169
140
 public:
170
 public:
141
    /**
171
    /**
142
     * Build the object by reading content from file.
172
     * Build the object by reading content from file.
143
     */
173
     */
144
    ConfTree(const char *fname, int readonly = 0)
174
    ConfTree(const char *fname, int readonly = 0) 
145
    : ConfSimple(fname, readonly, true) {}
175
    : ConfSimple(fname, readonly, true) {}
146
    virtual ~ConfTree() {};
176
    virtual ~ConfTree() {};
177
    ConfTree(const ConfTree& r)   : ConfSimple(r) {};
178
    ConfTree& operator=(const ConfTree& r) {
179
  ConfSimple::operator=(r);
180
  return *this;
181
    }
147
182
148
    /** 
183
    /** 
149
     * Get value for named parameter, from specified subsection, or its 
184
     * Get value for named parameter, from specified subsection, or its 
150
     * parents.
185
     * parents.
151
     * @return 0 if name not found, 1 else
186
     * @return 0 if name not found, 1 else