Switch to unified view

a/src/qtgui/confgui/conflinkrcl.h b/src/qtgui/confgui/conflinkrcl.h
1
#ifndef _CONFLINKRCL_H_INCLUDED_
1
#ifndef _CONFLINKRCL_H_INCLUDED_
2
#define _CONFLINKRCL_H_INCLUDED_
2
#define _CONFLINKRCL_H_INCLUDED_
3
/* @(#$Id: conflinkrcl.h,v 1.2 2007-09-29 09:06:53 dockes Exp $  (C) 2004 J.F.Dockes */
3
/* @(#$Id: conflinkrcl.h,v 1.3 2007-10-09 11:08:17 dockes Exp $  (C) 2004 J.F.Dockes */
4
4
5
/** 
5
/** 
6
 * A Gui-to-Data link class for RclConfig
6
 * A Gui-to-Data link class for ConfTree
7
 * Has a subkey pointer member which makes it easy to change the
7
 * Has a subkey pointer member which makes it easy to change the
8
 * current subkey for a number at a time.
8
 * current subkey for a number at a time.
9
 */
9
 */
10
#include "confgui.h"
10
#include "confgui.h"
11
#include "rclconfig.h"
11
#include "conftree.h"
12
#include "debuglog.h"
12
#include "debuglog.h"
13
13
14
namespace confgui {
14
namespace confgui {
15
15
16
class ConfLinkRclRep : public ConfLinkRep {
16
class ConfLinkRclRep : public ConfLinkRep {
17
public:
17
public:
18
    ConfLinkRclRep(RclConfig *conf, const string& nm, 
18
    ConfLinkRclRep(ConfNull *conf, const string& nm, 
19
           string *sk = 0)
19
           string *sk = 0)
20
    : m_conf(conf), m_nm(nm), m_sk(sk)
20
    : m_conf(conf), m_nm(nm), m_sk(sk)
21
    {
21
    {
22
    }
22
    }
23
    virtual ~ConfLinkRclRep() {}
23
    virtual ~ConfLinkRclRep() {}
24
24
25
    virtual bool set(const string& val) 
25
    virtual bool set(const string& val) 
26
    {
26
    {
27
    if (!m_conf)
27
    if (!m_conf)
28
        return false;
28
        return false;
29
  LOGDEB1(("Setting [%s] value to [%s]\n", 
29
  LOGDEB1(("Setting [%s] value to [%s]\n",  m_nm.c_str(), val.c_str()));
30
      m_nm.c_str(), val.c_str()));
31
  m_conf->setKeyDir(m_sk ? *m_sk : "");
32
    bool ret = m_conf->setConfParam(m_nm, val);
30
    bool ret = m_conf->set(m_nm, val, m_sk?*m_sk:"");
33
    if (!ret)
31
    if (!ret)
34
        LOGERR(("Value set failed\n"));
32
        LOGERR(("Value set failed\n"));
35
    return ret;
33
    return ret;
36
    }
34
    }
37
    virtual bool get(string& val) 
35
    virtual bool get(string& val) 
38
    {
36
    {
39
    if (!m_conf)
37
    if (!m_conf)
40
        return false;
38
        return false;
41
  m_conf->setKeyDir(m_sk ? *m_sk : "");
42
    bool ret = m_conf->getConfParam(m_nm, val);
39
    bool ret = m_conf->get(m_nm, val, m_sk?*m_sk:"");
43
  LOGDEB1(("Got [%s] for [%s]\n", 
40
  LOGDEB1(("ConfLinkRcl::get: [%s] sk [%s] -> [%s]\n", 
41
       m_nm.c_str(), m_sk?m_sk->c_str():"",
44
        ret ? val.c_str() : "no value", m_nm.c_str()));
42
         ret ? val.c_str() : "no value"));
45
    return ret;
43
    return ret;
46
    }
44
    }
47
private:
45
private:
48
    RclConfig    *m_conf;
46
    ConfNull     *m_conf;
49
    const string  m_nm;
47
    const string  m_nm;
50
    const string *m_sk;
48
    const string *m_sk;
51
};
49
};
52
50
53
} // Namespace confgui
51
} // Namespace confgui