本文整理汇总了C++中CXMLNode::GetAttributeValue方法的典型用法代码示例。如果您正苦于以下问题:C++ CXMLNode::GetAttributeValue方法的具体用法?C++ CXMLNode::GetAttributeValue怎么用?C++ CXMLNode::GetAttributeValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CXMLNode
的用法示例。
在下文中一共展示了CXMLNode::GetAttributeValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RefreshAutoPermissions
///////////////////////////////////////////////////////////////
//
// CResource::RefreshAutoPermissions
//
// Update group and acl used aclrequest items
//
///////////////////////////////////////////////////////////////
bool CResource::RefreshAutoPermissions ( CXMLNode* pNodeAclRequest )
{
// Ensure group and acl exist
CAccessControlListGroup* pAutoGroup = g_pGame->GetACLManager()->AddGroup ( GetAutoGroupName () );
pAutoGroup->AddACL ( GetAutoAcl () );
pAutoGroup->AddObject ( GetName ().c_str (), CAccessControlListGroupObject::OBJECT_TYPE_RESOURCE );
// Track unused right names
std::vector < CAclRightName > unusedRightNameMap;
std::vector < SAclRequest > unusedRequestList;
GetAclRequests ( unusedRequestList );
for ( uint i = 0 ; i < unusedRequestList.size () ; i++ )
unusedRightNameMap.push_back ( unusedRequestList[i].rightName );
// Track any pending requests
bool bHasPending = false;
for ( uint uiIndex = 0 ; true ; uiIndex++ )
{
CXMLNode* pNodeRight = pNodeAclRequest->FindSubNode ( "right", uiIndex );
if ( !pNodeRight )
break;
// Find existing
SAclRequest request ( CAclRightName ( pNodeRight->GetAttributeValue ( "name" ) ) );
if ( !FindAclRequest ( request ) )
{
// Add new request
request.bAccess = false;
request.bPending = true;
request.strWho = "";
request.strDate = "";
// Validate request
if ( !request.rightName.IsValid () || !StringToBool ( pNodeRight->GetAttributeValue ( "access" ) ) )
{
CLogger::ErrorPrintf ( "Invalid aclrequest line in %s (%s)\n", GetName ().c_str (), *request.rightName.GetFullName () );
return false;
}
CommitAclRequest ( request );
}
// This right is used
ListRemove ( unusedRightNameMap, request.rightName );
// Update flag
bHasPending |= request.bPending;
}
// Remove rights not requested
for ( std::vector < CAclRightName >::iterator iter = unusedRightNameMap.begin () ; iter != unusedRightNameMap.end () ; ++iter )
GetAutoAcl ()->RemoveRight ( iter->GetName (), iter->GetType () );
// If any rights are pending, print message
if ( bHasPending )
{
CLogger::LogPrintf ( "Resource '%s' requests some acl rights. Use the command 'aclrequest list %s'\n", GetName ().c_str (), GetName ().c_str () );
}
return bHasPending;
}