本文整理汇总了C++中OsConfigDb::getNext方法的典型用法代码示例。如果您正苦于以下问题:C++ OsConfigDb::getNext方法的具体用法?C++ OsConfigDb::getNext怎么用?C++ OsConfigDb::getNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OsConfigDb
的用法示例。
在下文中一共展示了OsConfigDb::getNext方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readConfig
void SipImpliedSubscriptions::readConfig( OsConfigDb& configDb )
{
OsConfigDb impliedSubscriptionConfig;
OsStatus found;
UtlString key;
UtlString name;
UtlString recognizer;
configuredUserAgents.reset();
// extract the database of implied message waiting subscriptions
configDb.getSubHash( ConfigPrefix
,impliedSubscriptionConfig
);
for ( key = "", found = impliedSubscriptionConfig.getNext( key
,name
,recognizer
);
found == OS_SUCCESS;
key = name, found = impliedSubscriptionConfig.getNext( key
,name
,recognizer
)
)
{
OsSysLog::add( FAC_SIP, PRI_INFO
,"%s::readConfig name=\"%s\" recognizer=\"%s\""
,mLogName.data(), name.data(), recognizer.data()
);
configuredUserAgents.add( name, recognizer, mLogName );
}
}
示例2: readConfig
/// Read (or re-read) whatever configuration the hook requires.
void TestPlugin::readConfig( OsConfigDb& configDb )
{
UtlString key;
UtlString value;
if (mConfigured)
{
mConfiguration.destroyAll();
}
UtlString place;
for (; configDb.getNext(place, key, value) == OS_SUCCESS; place = key)
{
mConfiguration.insertKeyAndValue(new UtlString(key), new UtlString(value));
}
mConfigured = true;
}
示例3: execute
//.........这里部分代码省略.........
{
// at least one name was not found - return an error.
UtlString faultMsg;
faultMsg.append("parameter name '");
faultMsg.append(*requestedName);
faultMsg.append("' not found");
response.setFault(ConfigRPC::nameNotFound, faultMsg.data());
status = XmlRpcMethod::FAILED;
}
selectedParams.destroyAll();
}
else
{
// The second parameter was not a list
response.setFault( ConfigRPC::invalidType
,"namelist parameter is not an array"
);
status = XmlRpcMethod::FAILED;
}
}
else // no parameter names specified
{
// return all names
UtlHashMap allParams;
UtlString lastKey;
OsStatus iterateStatus;
UtlString* paramName;
UtlString* paramValue;
bool notEmpty = false;
for ( ( paramName = new UtlString()
,paramValue = new UtlString()
,iterateStatus = dataset.getNext(lastKey, *paramName, *paramValue)
);
OS_SUCCESS == iterateStatus;
( lastKey = *paramName
,paramName = new UtlString()
,paramValue = new UtlString()
,iterateStatus = dataset.getNext(lastKey, *paramName, *paramValue)
)
)
{
notEmpty = true; // got at least one parameter
// put it into the result array
allParams.insertKeyAndValue(paramName, paramValue);
}
// on the final iteration these were not used
delete paramName;
delete paramValue;
if (notEmpty)
{
response.setResponse(&allParams);
allParams.destroyAll();
}
else
{
// there is no way to send a well-formed but empty response,
// so a 'get all' on an empty dataset returns a fault.
UtlString faultMsg;
faultMsg.append("dataset '");
faultMsg.append(*dbName);
faultMsg.append("' has no parameters");
response.setFault(ConfigRPC::emptyDataset, faultMsg);
status = XmlRpcMethod::FAILED;
示例4: readConfig
void PluginHooks::readConfig(OsConfigDb& configDb)
{
OsSysLog::add(FAC_KERNEL, PRI_DEBUG, "PluginHooks::readConfig" );
// Move any existing hooks from the current configured list to
// a temporary holding list.
UtlSList existingHooks;
UtlContainable* existingHook;
UtlSortedListIterator nextHook(mConfiguredHooks);
while (existingHook = nextHook())
{
existingHooks.append(mConfiguredHooks.removeReference(existingHook));
}
// the mConfiguredHooks list is now empty
// Walk the current configuration,
// any existing hook is moved back to the mConfiguredHooks list,
// newly configured hooks are added,
// each configured hook is called to read its own configuration.
UtlString hookPrefix(mPrefix);
hookPrefix.append(HOOK_LIB_PREFIX);
OsConfigDb allHooks;
OsSysLog::add(FAC_KERNEL, PRI_DEBUG,
"PluginHooks::readConfig looking up hooks '%s'",
hookPrefix.data()
);
if (OS_SUCCESS == configDb.getSubHash(hookPrefix, allHooks)) // any hooks configured for prefix?
{
UtlString lastHook;
UtlString hookName;
UtlString hookLibrary;
// walk each hook and attempt to load and configure it
for ( lastHook = "";
OS_SUCCESS == allHooks.getNext(lastHook, hookName, hookLibrary);
lastHook = hookName
)
{
ConfiguredHook* thisHook;
if (NULL == (thisHook = dynamic_cast<ConfiguredHook*>(existingHooks.remove(&hookName))))
{
// not an existing hook, so create a new one
OsSysLog::add(FAC_KERNEL, PRI_DEBUG,
"PluginHooks: loading '%s'", hookName.data()
);
thisHook = new ConfiguredHook(hookName, mFactory, hookLibrary);
}
// put the hook onto the list of active hooks
mConfiguredHooks.insert(thisHook);
// (re)configure the hook
thisHook->readConfig(mPrefix, configDb);
}
}
else
{
OsSysLog::add(FAC_KERNEL, PRI_INFO,
"PluginHooks: no '%s' hooks configured", mPrefix.data()
);
}
// discard any hooks that are no longer in the configuration
existingHooks.destroyAll();
}
示例5: testAccessors
void testAccessors()
{
OsConfigDb *pDb = new OsConfigDb();
// the get() method is tested by testManipulators()
// test the getNext() method
//
// We put the following block in its own scope so that the UtlString
// references (stored in "name" and "value") are released as a side effect
// of going out of scope. Otherwise, it will look like a memory leak.
{
UtlString name;
UtlString value;
pDb->set("Key3", "Value3"); // add several entries (not in
pDb->set("Key2", "Value2"); // alphabetical or reverse alphabetical
pDb->set("Key4", "Value4"); // order
pDb->set("Key1", "Value1");
CPPUNIT_ASSERT_MESSAGE("verify that the database is not empty",
!pDb->isEmpty());
CPPUNIT_ASSERT_MESSAGE("has four entries", pDb->numEntries()==4);
OsStatus res = pDb->getNext("", name, value); // call getNext("", ...)
CPPUNIT_ASSERT_MESSAGE("verify that Key1/Value1",
res == OS_SUCCESS &&
name.compareTo("Key1") == 0 && // is returned
value.compareTo("Value1") == 0);
res = pDb->getNext("Key1", name, value);
CPPUNIT_ASSERT_MESSAGE("call getNext(\"Key1\", ...)",
res == OS_SUCCESS && // verify that Key2/Value2
name.compareTo("Key2") == 0 && // is returned
value.compareTo("Value2") == 0);
res = pDb->getNext("Key2", name, value);
CPPUNIT_ASSERT_MESSAGE("call getNext(\"Key2\", ...)",
res == OS_SUCCESS && // verify that Key3/Value3
name.compareTo("Key3") == 0 && // is returned
value.compareTo("Value3") == 0);
res = pDb->getNext("Key3", name, value);
CPPUNIT_ASSERT_MESSAGE("call getNext(\"Key3\", ...)",
res == OS_SUCCESS &&
name.compareTo("Key4") == 0 &&
value.compareTo("Value4") == 0);
res = pDb->getNext("Key4", name, value);
CPPUNIT_ASSERT_MESSAGE("call getNext(\"Key4\", ...)",
res == OS_NO_MORE_DATA &&
name.compareTo("") == 0 &&
value.compareTo("") == 0);
res = pDb->getNext("XXX", name, value);
CPPUNIT_ASSERT_MESSAGE("call getNext with a key not in the database and verify",
res == OS_NOT_FOUND &&
name.compareTo("") == 0 && // that empty strings are
value.compareTo("") == 0); // returned for the next name
// and value pair.
delete pDb; // delete the database
name.remove(0);
value.remove(0);
}
}