implemented value probing in SkvEnv
This commit is contained in:
@ -29,6 +29,7 @@
|
||||
#include <qse/cmn/main.h>
|
||||
#include <qse/cmn/mbwc.h>
|
||||
#include <qse/cmn/str.h>
|
||||
#include <qse/cmn/String.hpp>
|
||||
|
||||
#include <locale.h>
|
||||
#if defined(_WIN32)
|
||||
@ -37,24 +38,32 @@
|
||||
|
||||
class MyEnv: public QSE::SkvEnv
|
||||
{
|
||||
|
||||
public:
|
||||
int probe_agent_name (const qse_char_t* name)
|
||||
{
|
||||
qse_printf (QSE_T("probing agent_name %s\n"), name);
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
MyEnv myenv;
|
||||
|
||||
static int env_main (int argc, qse_char_t* argv[])
|
||||
{
|
||||
myenv.addItem (QSE_T("main*target"), QSE_T("file"), QSE_NULL);
|
||||
myenv.addItem (QSE_T("main*targetq"), QSE_T("file"), QSE_NULL);
|
||||
myenv.addItem (QSE_T("main*target"), QSE_T("file"));
|
||||
myenv.addItem (QSE_T("main*targetq"), QSE_T("file"));
|
||||
myenv.addItem (QSE_T("agent*name"), QSE_T("my-agent"), (MyEnv::ProbeProc)&MyEnv::probe_agent_name);
|
||||
|
||||
myenv.load (QSE_T("myenv.conf"));
|
||||
|
||||
//myenv.setValue(QSE_T("main*target"), QSE_T("qqqqqq"));
|
||||
//myenv.setValue(QSE_T("main*target"), QSE_T("abcdefg"));
|
||||
//myenv.setValue(QSE_T("main*targetq"), QSE_T("zozo"));
|
||||
QSE::String x (myenv.getValue(QSE_T("main*target")));
|
||||
x.append (QSE_T("-jj"));
|
||||
myenv.setValue(QSE_T("main*target"), x);
|
||||
|
||||
const qse_char_t* v = myenv.getValue(QSE_T("main*target"));
|
||||
qse_printf (QSE_T("%s\n"), (v? v: QSE_T("<null>")));
|
||||
|
||||
myenv.store (QSE_T("myenv.conf"));
|
||||
myenv.store (QSE_T("myenv.conf"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user