本文整理汇总了C++中UtlHashMap::findValue方法的典型用法代码示例。如果您正苦于以下问题:C++ UtlHashMap::findValue方法的具体用法?C++ UtlHashMap::findValue怎么用?C++ UtlHashMap::findValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UtlHashMap
的用法示例。
在下文中一共展示了UtlHashMap::findValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getOneRowByLocationCodeTest
void getOneRowByLocationCodeTest()
{
SipDbTestContext sipDbTestContext(TEST_DATA_DIR "/locationdata",
TEST_WORK_DIR "/locationdata"
);
sipDbTestContext.inputFile("dummy_loc_db.xml" );
LocationDB* pLocDb = LocationDB::getInstance("dummy_loc_db");
UtlHashMap hashmap;
CPPUNIT_ASSERT( !pLocDb->getRowByLocationCode( "5144", hashmap ) );
CPPUNIT_ASSERT( pLocDb->getRowByLocationCode( "514", hashmap ) );
CPPUNIT_ASSERT( hashmap.entries() == 4 );
UtlString* pTempString;
UtlString key;
key = "name";
pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
CPPUNIT_ASSERT( pTempString );
ASSERT_STR_EQUAL( "Montreal", pTempString->data() );
key = "description";
pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
CPPUNIT_ASSERT( pTempString );
ASSERT_STR_EQUAL( "Go Habs Go!", pTempString->data() );
key = "locationcode";
pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
CPPUNIT_ASSERT( pTempString );
ASSERT_STR_EQUAL( "514", pTempString->data() );
key = "subnets";
pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
CPPUNIT_ASSERT( pTempString );
ASSERT_STR_EQUAL( "10.10.10.0/24,11.11.11.0/24,12.12.12.0/24", pTempString->data() );
}
示例2: 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)) );
}
示例3: 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 ) );
}
示例4: 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)));
}
示例5: getOneRowByNameTest
void getOneRowByNameTest()
{
SipDbTestContext sipDbTestContext(TEST_DATA_DIR "/locationdata",
TEST_WORK_DIR "/locationdata"
);
sipDbTestContext.inputFile("dummy_loc_db.xml" );
LocationDB* pLocDb = LocationDB::getInstance("dummy_loc_db");
UtlHashMap hashmap;
CPPUNIT_ASSERT( !pLocDb->getRowByName( "Washington", hashmap ) );
CPPUNIT_ASSERT( pLocDb->getRowByName( "Ottawa", hashmap ) );
CPPUNIT_ASSERT( hashmap.entries() == 4 );
UtlString* pTempString;
UtlString key;
key = "name";
pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
CPPUNIT_ASSERT( pTempString );
ASSERT_STR_EQUAL( "Ottawa", pTempString->data() );
key = "description";
pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
CPPUNIT_ASSERT( pTempString );
ASSERT_STR_EQUAL( "One crazy location", pTempString->data() );
key = "locationcode";
pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
CPPUNIT_ASSERT( pTempString );
ASSERT_STR_EQUAL( "613", pTempString->data() );
key = "subnets";
pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
CPPUNIT_ASSERT( pTempString );
ASSERT_STR_EQUAL( "172.30.0.0/16,22.22.22.22/32", pTempString->data() );
// get a second location row
CPPUNIT_ASSERT( pLocDb->getRowByName( "Quebec", hashmap ) );
CPPUNIT_ASSERT( hashmap.entries() == 4 );
key = "name";
pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
CPPUNIT_ASSERT( pTempString );
ASSERT_STR_EQUAL( "Quebec", pTempString->data() );
key = "description";
pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
CPPUNIT_ASSERT( pTempString );
ASSERT_STR_EQUAL( "Happy 400th anniversary", pTempString->data() );
key = "locationcode";
pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
CPPUNIT_ASSERT( pTempString );
ASSERT_STR_EQUAL( "418", pTempString->data() );
key = "subnets";
pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
CPPUNIT_ASSERT( pTempString );
ASSERT_STR_EQUAL( SPECIAL_IMDB_NULL_VALUE, pTempString->data() );
}
示例6: 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)) ) );
}
示例7: strtoll
void
RegistrationDB::insertRow(const UtlHashMap& nvPairs)
{
// For integer values, default to 0 if the datum is missing in the input.
UtlString* expStr = (UtlString*) nvPairs.findValue(&gExpiresKey);
UtlString* cseqStr = (UtlString*) nvPairs.findValue(&gCseqKey);
// If the IMDB does not specify a Q-Value, "%" will be found here
// (representing a null IMDB column).
UtlString* qvalue = (UtlString*) nvPairs.findValue(&gQvalueKey);
UtlString* updateNumberStr = (UtlString*) nvPairs.findValue(&gUpdateNumberKey);
// Note that updateNumberStr is likely to start with 0x, so we
// need the full functionality of strtoll here, not just a
// decimal-to-binary conversion. But strtoll is in C99, so it
// should be OK.
Int64 updateNumber =
updateNumberStr ? strtoll(updateNumberStr->data(), NULL, 0) : 0;
// Get the remaining fields so that we can substitute the null string
// if the fetched value is 0 (the null pointer) because the field
// is not present in the disk file.
UtlString* contact = (UtlString*) nvPairs.findValue(&gContactKey);
UtlString* callId = (UtlString*) nvPairs.findValue(&gCallidKey);
UtlString* instanceId = (UtlString*) nvPairs.findValue(&gInstanceIdKey);
UtlString* gruu = (UtlString*) nvPairs.findValue(&gGruuKey);
UtlString* path = (UtlString*) nvPairs.findValue(&gPathKey);
UtlString* primary = (UtlString*) nvPairs.findValue(&gPrimaryKey);
// Note: identity inferred from the uri
updateBinding(
Url(*((UtlString*)nvPairs.findValue(&gUriKey))),
contact ? *contact : nullString,
qvalue ? *qvalue : percent,
callId ? *callId : nullString,
cseqStr ? atoi(cseqStr->data()) : 0,
expStr ? atoi(expStr->data()) : 0,
instanceId ? *instanceId : nullString,
gruu ? *gruu : nullString,
path ? *path : nullString,
primary ? *primary : nullString,
updateNumber
);
}
示例8: insertRow
UtlBoolean
UserForwardDB::insertRow (const UtlHashMap& nvPairs)
{
// Note we do not need the identity object here
// as it is inferred from the uri
UtlString identity, cfwdtime;
identity = *(dynamic_cast <UtlString*> (nvPairs.findValue(&gIdentityKey)));
cfwdtime = *(dynamic_cast <UtlString*> (nvPairs.findValue(&gCfwdtimeKey)));
return insertRow ( Url( identity ), cfwdtime );
}
示例9: 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));
}
示例10: 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;
}
示例11: lock
OsStatus
DialByNameDB::load() const
{
// 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 ();
// Query all Identities with 'AutoAttendant' permission set
PermissionDB * pPermissionDB = PermissionDB::getInstance();
ResultSet permissionsResultSet;
pPermissionDB->getIdentities ( "AutoAttendant", permissionsResultSet );
CredentialDB * pCredentialDB = CredentialDB::getInstance();
ResultSet credentialsResultSet;
UtlString identity, permission;
int numAutoAttendees = permissionsResultSet.getSize();
for (int index = 0; index < numAutoAttendees; index++)
{
// get the next identity
UtlString identityKey("identity");
UtlHashMap record;
permissionsResultSet.getIndex( index, record );
UtlString identity = *((UtlString*)record.findValue(&identityKey));
Url identityUrl (identity);
pCredentialDB->
getAllCredentials (
identityUrl,
credentialsResultSet );
// we should only have one credential! we're
// only interested in the uri column's display name
if ( credentialsResultSet.getSize() == 1)
{
UtlString uriKey("uri");
UtlHashMap record;
credentialsResultSet.getIndex( 0, record );
UtlString uri = *((UtlString*)record.findValue(&uriKey));
// must have a display name present before inserting a row
// @TODO convert to url and get display name
UtlHashMap nvPairs;
if (!uri.isNull())
{
// Null Element value create a special
// char string we have key and value so insert
UtlString* contactValue =
new UtlString( uri );
// Memory Leak fixes, make shallow copies of static keys
UtlString* contactKey =
new UtlString( gNp_contactKey );
nvPairs.insertKeyAndValue (
contactKey, contactValue );
}
// Insert the item row into the IMDB
insertRow ( nvPairs );
}
}
// Reset the changed flags after a successful load
SIPDBManager::getInstance()->
setDatabaseChangedFlag("credential", FALSE);
SIPDBManager::getInstance()->
setDatabaseChangedFlag("permission", FALSE);
} else
{
result = OS_FAILED;
}
return result;
}
示例12: if
OsStatus
ManageNotificationsWebCGI::getManageNotificationsUI(UtlString* out)
{
// Construct the status message
UtlString statusStr = " ";
if( m_status == ADD_NOTIFICATION_SUCCESS )
statusStr = "Email address added successfully" ;
else if( m_status == EDIT_NOTIFICATION_SUCCESS )
statusStr = "Email address modified successfully" ;
else if( m_status == DELETE_NOTIFICATION_SUCCESS )
statusStr = "Email address deleted successfully" ;
else if( m_status == DELETE_NOTIFICATION_FAILED )
statusStr = "Failed to delete the email address. Please try again." ;
UtlString dynamicHtml = HTML_BEGIN \
WEBPAGE_SNIPPET1 \
"Manage Notifications" \
WEBPAGE_SNIPPET2 \
"notify_by_email_page.htm" \
WEBPAGE_SNIPPET3 ;
MailboxManager* pMailboxManager = MailboxManager::getInstance();
if( TRUE ) // email notification is always enabled now
{
// Get the list of contacts
UtlBoolean contactsFound = FALSE ;
UtlHashMap contactsHashDictionary;
pMailboxManager->getNotificationContactList (
m_mailboxIdentity,
&contactsHashDictionary );
if( contactsHashDictionary.entries() > 0 )
{
// Get the sorted contacts list
// Get the sorted list of contacts.
UtlSortedList* contactList = (UtlSortedList*) contactsHashDictionary.
findValue( new UtlString("sortedcontacts") );
if (contactList != NULL)
{
if( contactList->entries() > 0)
{
contactsFound = TRUE ;
// Add code for displaying the status and
// the table header for listing the contacts.
dynamicHtml += statusStr +
WEBPAGE_SNIPPET4 +
"<tr> \n" \
"<th>Email Address</th>\n" \
"<th width=\"15%\">Edit</th>\n" \
"<th width=\"15%\">Delete</th>\n" \
"</tr>\n" ;
}
while( contactList->entries() > 0 )
{
UtlString* rwAddress =
(UtlString*) contactList->removeAt(0);
UtlString address = rwAddress->data();
if( contactsHashDictionary.findValue( rwAddress ) != NULL )
{
UtlHashMap* contactDetails = (UtlHashMap*) contactsHashDictionary.
findValue( rwAddress );
// Construct the HTML code
UtlString htmlCode ;
getNotificationsUIHtmlCode( address, contactDetails, htmlCode ) ;
dynamicHtml += htmlCode ;
}
}
delete contactList ;
}
}
if( !contactsFound )
{
statusStr += "<br><br>Notifications can be sent to your email when you receive a new voicemail.<br>Click on the button below to specify your email address";
dynamicHtml += statusStr + "</td></tr>" ;
}
dynamicHtml += "</table>\n" \
"</td></tr>\n" \
"<tr>\n" \
"<td colspan=\"2\"> \n" \
"<form action=\"" + m_cgiUrl + "\" method=\"post\">\n" \
"<input type=\"hidden\" name=\"action\" value=\"getaddnotificationui\">\n" \
"<input type=\"hidden\" name=\"fromweb\" value=\"yes\">\n" \
"<input type=\"submit\" value=\"Add Notification\">\n" \
"</form>\n" \
"</td> \n" \
"</tr> \n" ;
}
else
//.........这里部分代码省略.........
示例13: pingOpenfire
OsStatus SipRedirectorPresenceRouting::pingOpenfire( void )
{
OsStatus rc = OS_FAILED;
UtlString presenceMonitorUrlAsString = mLocalPresenceMonitorServerUrl.toString();
XmlRpcRequest pingRequest( mOpenFirePresenceServerUrl, PING_METHOD );
pingRequest.addParam( &mLogName );
XmlRpcResponse pingResponse;
if( pingRequest.execute( pingResponse ) == true )
{
UtlContainable* pValue = NULL;
if ( !pingResponse.getResponse( pValue ) || !pValue )
{
OsSysLog::add(FAC_NAT, PRI_CRIT, "SipRedirectorPresenceRouting::pingOpenfire response had no result.");
}
else
{
UtlString keyName;
UtlHashMap* pMap = dynamic_cast<UtlHashMap*>( pValue );
if ( !pMap )
{
OsSysLog::add(FAC_NAT, PRI_ERR,
"SipRedirectorPresenceRouting::pingOpenfire response result had unexpected type: %s",
pValue->getContainableType() );
}
else
{
// extract status code and check it.
keyName = STATUS_CODE;
UtlString* pStatusCode = dynamic_cast<UtlString*>( pMap->findValue( &keyName ) );
if( pStatusCode->compareTo( STATUS_CODE_VALUE_OK, UtlString::ignoreCase ) == 0 )
{
keyName = INSTANCE_HANDLE;
UtlString* pInstanceHandle = dynamic_cast<UtlString*>( pMap->findValue( &keyName ) );
if( pInstanceHandle )
{
if( mOpenfireInstanceHandle.compareTo( NIL_INSTANCE_HANDLE_VALUE ) == 0 )
{
// This is the first instance handle we get from openfire, save it
mOpenfireInstanceHandle = *pInstanceHandle;
rc = OS_SUCCESS;
}
else
{
// check if the openfire handle we received matches the one we have on record
if( mOpenfireInstanceHandle.compareTo( *pInstanceHandle ) == 0 )
{
// there is a match; everything is fine.
rc = OS_SUCCESS;
}
else
{
// mistmatch - likely caused by openfire resetting behind our back.
// fail the ping to cause a re-register with openfire
mOpenfireInstanceHandle = *pInstanceHandle;
rc = OS_FAILED; // rc already set to OS_FAILED; added for readability
}
}
}
}
}
}
}
return rc;
}
示例14: getContent
UtlBoolean SipPublishContentMgr::getContent(const char* resourceId,
const char* eventTypeKey,
const char* eventType,
UtlBoolean fullState,
const UtlString& acceptHeaderValue,
HttpBody*& content,
UtlBoolean& isDefaultContent,
UtlString* availableMediaTypes)
{
UtlBoolean foundContent = FALSE;
PublishContentContainer* container = NULL;
isDefaultContent = FALSE;
UtlString key;
key.append(resourceId);
key.append(CONTENT_KEY_SEPARATOR);
key.append(eventTypeKey);
lock();
UtlHashBag* pContent;
if (fullState)
{
// Full content (this is the usual case)
pContent = &mContentEntries;
}
else
{
// Partial content (used for partial dialog events)
pContent = &mPartialContentEntries;
}
// See if resource-specific content exists
container =
dynamic_cast <PublishContentContainer*> (pContent->find(&key));
// There is no resource-specific content. Check if the default
// constructor exists.
if (container == NULL)
{
// Construct the key for the default data.
UtlString default_key;
default_key.append(CONTENT_KEY_SEPARATOR);
default_key.append(eventTypeKey);
// Look up the constructor.
UtlHashMap* pDefaultConstructors;
if (fullState)
{
// Full content (this is the usual case)
pDefaultConstructors = &mDefaultContentConstructors;
}
else
{
// Partial content (used for partial dialog events)
pDefaultConstructors = &mDefaultPartialContentConstructors;
}
SipPublishContentMgrDefaultConstructor* constructor =
dynamic_cast <SipPublishContentMgrDefaultConstructor*>
(pDefaultConstructors->findValue(&default_key));
// If it exists, call it to publish content for this resource/event.
if (constructor)
{
constructor->generateDefaultContent(this, resourceId,
eventTypeKey, eventType);
}
// See if resource-specific content exists now.
container =
dynamic_cast <PublishContentContainer*> (pContent->find(&key));
// If content was found, still mark it as default content.
if (container)
{
isDefaultContent = TRUE;
}
// If still no content was found, check if (fixed) default content exists.
else
{
container =
dynamic_cast <PublishContentContainer*>
(mDefaultContentEntries.find(&default_key));
if(container)
{
isDefaultContent = TRUE;
}
}
}
// Within the container, choose the correct content.
if (container)
{
if (acceptHeaderValue.compareTo(acceptAllTypes) != 0)
{
// Search for the first content in the container whose
// MIME type is in the acceptable list.
UtlSListIterator contentIterator(container->mEventContent);
HttpBody* bodyPtr;
while (!foundContent &&
//.........这里部分代码省略.........
示例15: linkTopologyResources
int MpTopologyGraph::linkTopologyResources(MpResourceTopology& resourceTopology,
UtlHashBag& newResources,
UtlBoolean replaceNumInName,
int resourceNum)
{
// Link the resources
int connectionIndex = 0;
UtlString outputResourceName;
UtlString inputResourceName;
int outputResourcePortIndex;
int inputResourcePortIndex;
MpResource* outputResource = NULL;
MpResource* inputResource = NULL;
OsStatus result;
UtlHashMap newConnectionIds;
#ifdef TEST_PRINT
osPrintf("%d new resources in the list\n", newResources.entries());
UtlHashBagIterator iterator(newResources);
MpResource* containerResource = NULL;
while(containerResource = (MpResource*) iterator())
{
osPrintf("found list resource: \"%s\" value: \"%s\"\n",
containerResource->getName().data(), containerResource->data());
}
#endif
while(resourceTopology.getConnection(connectionIndex,
outputResourceName,
outputResourcePortIndex,
inputResourceName,
inputResourcePortIndex) == OS_SUCCESS)
{
if(replaceNumInName)
{
resourceTopology.replaceNumInName(outputResourceName, resourceNum);
resourceTopology.replaceNumInName(inputResourceName, resourceNum);
}
// Look in the container of new resources first as this is more
// efficient and new resources are not added immediately to a running
// flowgraph
outputResource = (MpResource*) newResources.find(&outputResourceName);
if(outputResource == NULL)
{
result = lookupResource(outputResourceName, outputResource);
if(result != OS_SUCCESS)
{
int virtPortIdx = outputResourcePortIndex>=0?outputResourcePortIndex:-1;
int realPortIdx;
result = lookupVirtualOutput(outputResourceName, virtPortIdx,
outputResource, realPortIdx);
if (result == OS_SUCCESS && outputResourcePortIndex>=0)
{
outputResourcePortIndex = realPortIdx;
}
}
assert(result == OS_SUCCESS);
}
inputResource = (MpResource*) newResources.find(&inputResourceName);
if(inputResource == NULL)
{
result = lookupResource(inputResourceName, inputResource);
if(result != OS_SUCCESS)
{
int virtPortIdx = inputResourcePortIndex>=0?inputResourcePortIndex:-1;
int realPortIdx;
result = lookupVirtualInput(inputResourceName, virtPortIdx,
inputResource, realPortIdx);
if (result == OS_SUCCESS && inputResourcePortIndex>=0)
{
inputResourcePortIndex = realPortIdx;
}
}
assert(result == OS_SUCCESS);
}
assert(outputResource);
assert(inputResource);
if(outputResource && inputResource)
{
if(outputResourcePortIndex == MpResourceTopology::MP_TOPOLOGY_NEXT_AVAILABLE_PORT)
{
outputResourcePortIndex = outputResource->reserveFirstUnconnectedOutput();
assert(outputResourcePortIndex >= 0);
}
else if(outputResourcePortIndex < MpResourceTopology::MP_TOPOLOGY_NEXT_AVAILABLE_PORT)
{
// First see if a real port is already in the dictionary
UtlInt searchKey(outputResourcePortIndex);
UtlInt* foundValue = NULL;
if((foundValue = (UtlInt*) newConnectionIds.findValue(&searchKey)))
{
// Use the mapped index
outputResourcePortIndex = foundValue->getValue();
}
else
{
// Find an available port and add it to the map
int realPortNum = outputResource->reserveFirstUnconnectedOutput();
//.........这里部分代码省略.........