本文整理汇总了C++中UtlHashMap::contains方法的典型用法代码示例。如果您正苦于以下问题:C++ UtlHashMap::contains方法的具体用法?C++ UtlHashMap::contains怎么用?C++ UtlHashMap::contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UtlHashMap
的用法示例。
在下文中一共展示了UtlHashMap::contains方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lock
OsStatus
CredentialDB::load()
{
// Critical Section here
OsLock lock( sLockMutex );
OsStatus result = OS_SUCCESS;
if ( m_pFastDB != NULL )
{
// Clean out the existing DB rows before loading
// a new set from persistent storage
removeAllRows ();
UtlString fileName = OsPath::separator + mDatabaseName + ".xml";
UtlString pathName = SipXecsService::Path(SipXecsService::DatabaseDirType,
fileName.data());
OsSysLog::add(FAC_DB, PRI_DEBUG, "CredentialDB::load loading \"%s\"",
pathName.data());
TiXmlDocument doc ( pathName );
// Verify that we can load the file (i.e it must exist)
if( doc.LoadFile() )
{
// the checksum is used to determine if the db changed between reloads
int loadChecksum = 0;
TiXmlNode * rootNode = doc.FirstChild ("items");
if (rootNode != NULL)
{
// the folder node contains at least the name/displayname/
// and autodelete elements, it may contain others
for( TiXmlNode *itemNode = rootNode->FirstChild( "item" );
itemNode;
itemNode = itemNode->NextSibling( "item" ) )
{
// Create a hash dictionary for element attributes
UtlHashMap nvPairs;
for( TiXmlNode *elementNode = itemNode->FirstChild();
elementNode;
elementNode = elementNode->NextSibling() )
{
// Bypass comments and other element types only interested
// in parsing element attributes
if ( elementNode->Type() == TiXmlNode::ELEMENT )
{
UtlString elementName = elementNode->Value();
UtlString elementValue;
result = SIPDBManager::getAttributeValue (
*itemNode, elementName, elementValue);
// update the load checksum
loadChecksum += ( elementName.hash() + elementValue.hash() );
if (result == OS_SUCCESS)
{
UtlString* collectableKey =
new UtlString( elementName );
UtlString* collectableValue =
new UtlString( elementValue );
nvPairs.insertKeyAndValue (
collectableKey, collectableValue );
} else if ( elementNode->FirstChild() == NULL )
{
// Null Element value creaete a special
// char string we have key and value so insert
UtlString* collectableKey =
new UtlString( elementName );
UtlString* collectableValue =
new UtlString( SPECIAL_IMDB_NULL_VALUE );
nvPairs.insertKeyAndValue (
collectableKey, collectableValue );
}
}
}
// If this is an old credentials file, it may not contain
// the pintoken element - if not, duplicate the passtoken
// to create it.
if (!nvPairs.contains(&gPintokenKey))
{
UtlString* pintokenKey = new UtlString(gPintokenKey);
UtlString* pintokenValue
= new UtlString(*((UtlString*)nvPairs.findValue(&gPasstokenKey)));
nvPairs.insertKeyAndValue(pintokenKey, pintokenValue);
}
// Insert the item row into the IMDB
insertRow ( nvPairs );
}
}
// Update the tableInfo table and determine if the db has
// changed as a result of the reload (setting the
// changed tableInfo field
SIPDBManager::getInstance()->
updateDatabaseInfo(
mDatabaseName, loadChecksum);
} else
{
//.........这里部分代码省略.........