Switch to unified view

a/src/conftree.h b/src/conftree.h
...
...
119
     * Build the object by reading content from file.
119
     * Build the object by reading content from file.
120
     * @param filename file to open
120
     * @param filename file to open
121
     * @param readonly if true open readonly, else rw
121
     * @param readonly if true open readonly, else rw
122
     * @param tildexp  try tilde (home dir) expansion for subkey values
122
     * @param tildexp  try tilde (home dir) expansion for subkey values
123
     */
123
     */
124
    ConfSimple(const char *fname, int readonly = 0, bool tildexp = false);
124
    ConfSimple(const char *fname, int readonly = 0, bool tildexp = false,
125
               bool trimvalues = true);
125
126
126
    /**
127
    /**
127
     * Build the object by reading content from a string
128
     * Build the object by reading content from a string
128
     * @param data points to the data to parse.
129
     * @param data points to the data to parse.
129
     * @param readonly if true open readonly, else rw
130
     * @param readonly if true open readonly, else rw
130
     * @param tildexp  try tilde (home dir) expansion for subsection names
131
     * @param tildexp  try tilde (home dir) expansion for subsection names
131
     */
132
     */
132
    ConfSimple(const string& data, int readonly = 0, bool tildexp = false);
133
    ConfSimple(const string& data, int readonly = 0, bool tildexp = false,
134
               bool trimvalues = true);
133
135
134
    /**
136
    /**
135
     * Build an empty object. This will be memory only, with no backing store.
137
     * Build an empty object. This will be memory only, with no backing store.
136
     * @param readonly if true open read only, else rw
138
     * @param readonly if true open read only, else rw
137
     * @param tildexp  try tilde (home dir) expansion for subsection names
139
     * @param tildexp  try tilde (home dir) expansion for subsection names
138
     */
140
     */
139
    ConfSimple(int readonly = 0, bool tildexp = false);
141
    ConfSimple(int readonly = 0, bool tildexp = false,
142
               bool trimvalues = true);
140
143
141
    virtual ~ConfSimple() {};
144
    virtual ~ConfSimple() {};
142
145
143
    /** Origin file changed. Only makes sense if we read the data from a file */
146
    /** Origin file changed. Only makes sense if we read the data from a file */
144
    virtual bool sourceChanged() const;
147
    virtual bool sourceChanged() const;
...
...
279
    /**
282
    /**
280
     * Assignement. This is expensive
283
     * Assignement. This is expensive
281
     */
284
     */
282
    ConfSimple& operator=(const ConfSimple& rhs) {
285
    ConfSimple& operator=(const ConfSimple& rhs) {
283
        if (this != &rhs && (status = rhs.status) != STATUS_ERROR) {
286
        if (this != &rhs && (status = rhs.status) != STATUS_ERROR) {
287
            dotildexpand = rhs.dotildexpand;
288
            trimvalues = rhs.trimvalues;
284
            m_filename = rhs.m_filename;
289
            m_filename = rhs.m_filename;
285
            m_submaps = rhs.m_submaps;
290
            m_submaps = rhs.m_submaps;
286
        }
291
        }
287
        return *this;
292
        return *this;
288
    }
293
    }
...
...
297
        return m_order;
302
        return m_order;
298
    }
303
    }
299
    
304
    
300
protected:
305
protected:
301
    bool dotildexpand;
306
    bool dotildexpand;
307
    bool trimvalues;
302
    StatusCode status;
308
    StatusCode status;
303
private:
309
private:
304
    // Set if we're working with a file
310
    // Set if we're working with a file
305
    string                            m_filename;
311
    string                            m_filename;
306
    time_t                            m_fmtime;
312
    time_t                            m_fmtime;
...
...
343
class ConfTree : public ConfSimple {
349
class ConfTree : public ConfSimple {
344
350
345
public:
351
public:
346
    /* The constructors just call ConfSimple's, asking for key tilde
352
    /* The constructors just call ConfSimple's, asking for key tilde
347
     * expansion */
353
     * expansion */
348
    ConfTree(const char *fname, int readonly = 0)
354
    ConfTree(const char *fname, int readonly = 0, bool trimvalues=true)
349
        : ConfSimple(fname, readonly, true) {}
355
        : ConfSimple(fname, readonly, true, trimvalues) {}
350
    ConfTree(const string& data, int readonly = 0)
356
    ConfTree(const string& data, int readonly = 0, bool trimvalues=true)
351
        : ConfSimple(data, readonly, true) {}
357
        : ConfSimple(data, readonly, true, trimvalues) {}
352
    ConfTree(int readonly = 0)
358
    ConfTree(int readonly = 0, bool trimvalues=true)
353
        : ConfSimple(readonly, true) {}
359
        : ConfSimple(readonly, true, trimvalues) {}
354
    virtual ~ConfTree() {};
360
    virtual ~ConfTree() {};
355
    ConfTree(const ConfTree& r) : ConfSimple(r) {};
361
    ConfTree(const ConfTree& r) : ConfSimple(r) {};
356
    ConfTree& operator=(const ConfTree& r) {
362
    ConfTree& operator=(const ConfTree& r) {
357
        ConfSimple::operator=(r);
363
        ConfSimple::operator=(r);
358
        return *this;
364
        return *this;