本文整理汇总了C++中UtlHashMap类的典型用法代码示例。如果您正苦于以下问题:C++ UtlHashMap类的具体用法?C++ UtlHashMap怎么用?C++ UtlHashMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UtlHashMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: take
UtlContainable* UtlHashMapIterator::key() const
{
UtlContainable* currentKey = NULL;
UtlContainer::acquireIteratorConnectionLock();
OsLock take(const_cast<OsBSem&>(mContainerRefLock));
UtlHashMap* myHashMap = dynamic_cast<UtlHashMap*>(mpMyContainer);
if (myHashMap)
{
OsLock container(myHashMap->mContainerLock);
UtlContainer::releaseIteratorConnectionLock();
if ( (mPosition < myHashMap->numberOfBuckets())
&& (mpCurrentPair)
&& (mPairIsValid)
)
{
currentKey = mpCurrentPair->data;
}
}
else
{
UtlContainer::releaseIteratorConnectionLock();
}
return currentKey;
}
示例2: iterator
void XmlRpcResponse::cleanUp(UtlContainable* value)
{
if (value)
{
if (value->isInstanceOf(UtlHashMap::TYPE))
{
UtlHashMap* map = dynamic_cast<UtlHashMap*>(value);
UtlHashMapIterator iterator(*map);
UtlString* key;
while ((key = dynamic_cast<UtlString*>(iterator())))
{
UtlContainable *pName;
UtlContainable *member;
pName = map->removeKeyAndValue(key, member);
delete pName;
cleanUp(member);
}
}
else if (value->isInstanceOf(UtlSList::TYPE))
{
UtlSList* array = dynamic_cast<UtlSList*>(value);
UtlContainable *element;
while ((element = array->get()/* pop */))
{
cleanUp(element);
}
}
delete value;
}
}
示例3: UtlString
void
DialByNameDB::getContacts (
const UtlString& digitString,
ResultSet& rResultSet ) const
{
// This should erase the contents of the existing resultset
rResultSet.destroyAll();
if ( !digitString.isNull() && (m_pFastDB != NULL) )
{
// Check the TableInfo table to see whether we need to reload
// the Tables from the Credential/Permission tables
SIPDBManager* pSIPDBManager = SIPDBManager::getInstance();
if ( pSIPDBManager->getDatabaseChangedFlag( "credential" ) ||
pSIPDBManager->getDatabaseChangedFlag( "permission" ) )
{
// Reload this IMDB and rese the changed flags
// in the credential and permission tables
this->load();
}
// Thread Local Storage
m_pFastDB->attach();
// Search to see if we have a Credential Row
dbCursor< DialByNameRow > cursor;
dbQuery query;
UtlString queryString = "np_digits like '" + digitString + "%'";
query = queryString;
if ( cursor.select(query) > 0 ) {
do {
UtlHashMap record;
UtlString* np_identityValue =
new UtlString ( cursor->np_identity );
UtlString* np_contactValue =
new UtlString ( cursor->np_contact );
UtlString* np_digitsValue =
new UtlString ( cursor->np_digits );
// Memory Leak fixes, make shallow copies of static keys
UtlString* np_identityKey = new UtlString( gNp_identityKey );
UtlString* np_contactKey = new UtlString( gNp_contactKey );
UtlString* np_digitsKey = new UtlString( gNp_digitsKey );
record.insertKeyAndValue (
np_identityKey, np_identityValue );
record.insertKeyAndValue (
np_contactKey, np_contactValue );
record.insertKeyAndValue (
np_digitsKey, np_digitsValue );
rResultSet.addValue(record);
} while ( cursor.next() );
}
// Commit the rows to memory - multiprocess workaround
m_pFastDB->detach(0);
}
}
示例4: addPermission
void addPermission(ResultSet& permissions, const char* permissionValue)
{
UtlHashMap record;
record.insertKeyAndValue(new UtlString("identity"),
new UtlString("dummy identity"));
record.insertKeyAndValue(new UtlString("permission"),
new UtlString(permissionValue));
permissions.addValue(record);
}
示例5: insertRow
UtlBoolean
ExtensionDB::insertRow (const UtlHashMap& nvPairs)
{
// Note we do not need the identity object here
// as it is inferred from the uri
return insertRow (
Url( *((UtlString*)nvPairs.findValue(&gUriKey)) ),
*((UtlString*)nvPairs.findValue(&gExtensionKey)) );
}
示例6: insertRow
UtlBoolean
AliasDB::insertRow (const UtlHashMap& nvPairs)
{
// Note we do not need the identity object here
// as it is inferred from the uri
UtlString identity, contact;
identity = *((UtlString*)nvPairs.findValue(&gIdentityKey));
contact = *((UtlString*)nvPairs.findValue(&gContactKey));
return insertRow ( Url( identity ), Url( contact ) );
}
示例7: while
void
ResultSet::destroyAll()
{
// the pRecord is actually a UtlHashMap
UtlHashMap* pRecord;
while ((pRecord = dynamic_cast<UtlHashMap*>(get())))
{
pRecord->destroyAll();
delete pRecord;
}
}
示例8: getResult
void getResult( ResultSet& resultSet
,int index
,const char* key
,UtlString& result
)
{
UtlHashMap hash;
resultSet.getIndex( index, hash );
UtlString theKey(key);
result = *((UtlString*)hash.findValue(&theKey));
}
示例9: insertRow
UtlBoolean
CredentialDB::insertRow (const UtlHashMap& nvPairs)
{
// Note: identity inferred from the uri
return insertRow (
Url (*((UtlString*)nvPairs.findValue(&gUriKey))),
*((UtlString*)nvPairs.findValue(&gRealmKey)),
*((UtlString*)nvPairs.findValue(&gUseridKey)),
*((UtlString*)nvPairs.findValue(&gPasstokenKey)),
*((UtlString*)nvPairs.findValue(&gPintokenKey)),
*((UtlString*)nvPairs.findValue(&gAuthtypeKey)));
}
示例10: UtlString
void
AliasDB::getAliases (
const Url& contactIdentity,
ResultSet& rResultSet ) const
{
UtlString contactIdentityStr;
contactIdentity.getIdentity(contactIdentityStr);
// This should erase the contents of the existing resultset
rResultSet.clear();
if ( !contactIdentityStr.isNull() && (m_pFastDB != NULL) )
{
// Thread Local Storage
m_pFastDB->attach();
// Match a all rows where the contact identity matches
UtlString queryString = "contact like '%" + contactIdentityStr + "%'";
dbQuery query;
query=queryString;
// Search to see if we have a Credential Row
dbCursor< AliasRow > cursor;
if ( cursor.select(query) > 0 )
{
do {
UtlHashMap record;
UtlString* identityValue =
new UtlString ( cursor->identity );
UtlString* contactValue =
new UtlString ( cursor->contact );
// Memory Leak fixes, make shallow copies of static keys
UtlString* identityKey = new UtlString( gIdentityKey );
UtlString* contactKey = new UtlString( gContactKey );
record.insertKeyAndValue (
identityKey, identityValue );
record.insertKeyAndValue (
contactKey, contactValue );
rResultSet.addValue(record);
} while ( cursor.next() );
}
// Commit the rows to memory - multiprocess workaround
m_pFastDB->detach(0);
}
}
示例11: UtlHashMap
void
ResultSet::addValue( const UtlHashMap& record )
{
UtlHashMap* pNewRecord = new UtlHashMap() ;
UtlContainable* pObj ;
// Proceed with shallow copy
UtlHashMapIterator itor(const_cast<UtlHashMap&>(record)) ;
while ((pObj = (UtlContainable*) itor()) != NULL)
{
pNewRecord->insertKeyAndValue(itor.key(), itor.value()) ;
}
append(pNewRecord) ;
}
示例12: requestGet
void requestGet(Url& url, UtlSList& names)
{
XmlRpcRequest* request;
XmlRpcResponse response;
request = new XmlRpcRequest(url, "configurationParameter.get");
request->addParam(&DataSet);
if (!names.isEmpty())
{
request->addParam(&names);
}
if (!request->execute(response/*, &pSocket*/))
{
exitFault(response);
}
else
{
UtlContainable* value;
if (response.getResponse(value))
{
UtlHashMap* paramList = dynamic_cast<UtlHashMap*>(value);
if (paramList)
{
UtlHashMapIterator params(*paramList);
UtlString* name;
while ((name = dynamic_cast<UtlString*>(params())))
{
UtlString* value = dynamic_cast<UtlString*>(paramList->findValue(name));
printf("%s : %s\n", name->data(), value->data());
}
}
else
{
fprintf(stderr, "Incorrect type returned.\n");
exit(1);
}
}
else
{
fprintf(stderr, "No value returned.\n");
exit(1);
}
}
delete request;
request = NULL;
}
示例13: insertRow
UtlBoolean
DialByNameDB::insertRow ( const UtlHashMap& nvPairs ) const
{
// Note we do not need the identity object here
// as it is inferred from the uri
return insertRow (
Url( *((UtlString*)nvPairs.findValue(&gNp_contactKey)) ) );
}
示例14: assert
OsStatus
ResultSet::getIndex(
const int& index,
UtlHashMap& rRecord) const
{
// The record must be empty. We can't clear the content because we don't own it.
assert(rRecord.isEmpty());
OsStatus result = OS_FAILED;
UtlHashMap *m;
if ((m = dynamic_cast<UtlHashMap*>(at(index))))
{
m->copyInto(rRecord);
result = OS_SUCCESS;
}
return result;
}
示例15: UtlString
void
PermissionDB::getIdentities (
const UtlString& permission,
ResultSet& rResultSet ) const
{
// This should erase the contents of the existing resultset
rResultSet.destroyAll();
if ( !permission.isNull() && (m_pFastDB != NULL) )
{
// Thread Local Storage
m_pFastDB->attach();
dbQuery query;
// Primary Key is the uriPermission's identity
query="permission=", permission;
// Search to see if we have a Credential Row
dbCursor< PermissionRow > cursor;
if ( cursor.select(query) > 0 )
{
do {
UtlHashMap record;
UtlString* identityValue =
new UtlString ( cursor->identity );
UtlString* permissionValue =
new UtlString ( cursor->permission );
// Memory Leak fixes, make shallow copies of static keys
UtlString* identityKey = new UtlString( gIdentityKey );
UtlString* permissionKey = new UtlString( gPermissionKey );
record.insertKeyAndValue (
identityKey, identityValue );
record.insertKeyAndValue (
permissionKey, permissionValue );
rResultSet.addValue(record);
} while ( cursor.next() );
}
// Commit the rows to memory - multiprocess workaround
m_pFastDB->detach(0);
}
}