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