本文整理汇总了C++中STRING::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ STRING::empty方法的具体用法?C++ STRING::empty怎么用?C++ STRING::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类STRING
的用法示例。
在下文中一共展示了STRING::empty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetLocale
///////////////////////////////////////////////////////////////////////////////
/// \brief
/// Return currently defined locale for user, or default locale.
///
STRING MgException::GetLocale() throw()
{
STRING locale;
MG_TRY()
if (NULL != sm_localeCallbackFunc)
{
locale = (*sm_localeCallbackFunc)();
}
MG_CATCH_AND_RELEASE()
if (locale.empty())
{
MG_TRY()
MgConfiguration* configuration = MgConfiguration::GetInstance();
if (NULL != configuration && configuration->IsFileLoaded())
{
configuration->GetStringValue(
MgFoundationConfigProperties::GeneralPropertiesSection,
MgFoundationConfigProperties::GeneralPropertyDefaultMessageLocale,
locale,
MgFoundationConfigProperties::DefaultGeneralPropertyDefaultMessageLocale);
}
MG_CATCH_AND_RELEASE()
if (locale.empty())
{
locale = MgResources::DefaultMessageLocale;
}
}
示例2: InitializeCommonParameters
/// <summary>
/// Initializes the common parameters and parameters specific to this request.
/// </summary>
/// <param name="name">Input
/// MgHttpRequest
/// This contains all the parameters of the request.
/// </param>
/// <returns>
/// nothing
/// </returns>
MgHttpMoveResource::MgHttpMoveResource(MgHttpRequest *hRequest)
{
InitializeCommonParameters(hRequest);
Ptr<MgHttpRequestParam> hrParam = m_hRequest->GetRequestParam();
assert(hrParam != 0);
// Get Source Resource Id name
m_sourceResourceId = hrParam->GetParameterValue(MgHttpResourceStrings::reqSourceResourceId);
// Get Destination Resource Id name
m_destResourceId = hrParam->GetParameterValue(MgHttpResourceStrings::reqDestinationResourceId);
// Get the flag to determine whether or not the destination resource
// should be overwritten if it exists.
m_overwrite = ::atoi(MgUtil::WideCharToMultiByte(
hrParam->GetParameterValue(
MgHttpResourceStrings::reqOverwrite)).c_str()) != 0;
// In order to maintain backward compatibility, the Cascade flag
// will be set to false by default if it is not specified.
STRING cascadeParam = hrParam->GetParameterValue(MgHttpResourceStrings::reqCascade);
m_cascade = (!cascadeParam.empty() && 0 != MgUtil::StringToInt32(cascadeParam));
}
示例3: ValidateAuthorOrSelf
void MgServerSiteService::ValidateAuthorOrSelf(CREFSTRING user, CREFSTRING group)
{
bool bAllowed = false;
Ptr<MgUserInformation> userInfo = MgUserInformation::GetCurrentUserInfo();
STRING currUser = userInfo->GetUserName();
if (currUser.empty())
{
currUser = GetUserForSession();
}
// Is user an Author or Admin?
Ptr<MgSecurityCache> securityCache = GetResourceService().CreateSecurityCache();
Ptr<MgStringCollection> roles = new MgStringCollection;
roles->Add(MgRole::Administrator);
roles->Add(MgRole::Author);
if (securityCache->IsUserInRoles(currUser, roles))
{
bAllowed = true;
}
// Are we looking ourselves up?
if (group.empty() && currUser == user)
{
bAllowed = true;
}
if (!bAllowed)
{
throw new MgUnauthorizedAccessException(L"MgServerSiteService.ValidateAuthorOrSelf",
__LINE__, __WFILE__, NULL, L"", NULL);
}
}
示例4: UnescapeHex
void UnescapeHex(const STRING& str, size_t& i, STRING& Ret, BOOL Unicode)
{
STRING Num;
// hexadecimal
if (iswxdigit(str[i]))
{
Num += str[i];
++i;
if (iswxdigit(str[i]))
{
Num += str[i];
++i;
if (Unicode)
{
if (iswxdigit(str[i]))
{
Num += str[i];
++i;
if (iswxdigit(str[i]))
{
Num += str[i];
++i;
}
}
}
}
}
if (!Num.empty())
{
Ret += (WCHAR)wcstoul(&Num[0], NULL, 16);
}
}
示例5: GetUserForSession
STRING MgServerSiteService::GetUserForSession()
{
STRING session;
STRING userId;
Ptr<MgUserInformation> currUserInfo = MgUserInformation::GetCurrentUserInfo();
assert(NULL != currUserInfo);
MG_SITE_SERVICE_TRY()
MG_LOG_TRACE_ENTRY(L"MgServerSiteService::GetUserForSession()");
session = currUserInfo->GetMgSessionId();
if (!session.empty())
{
userId = MgSessionManager::GetUserName(session);
}
else
{
MgStringCollection arguments;
arguments.Add(L"1");
arguments.Add(session);
throw new MgInvalidArgumentException(L"MgServerSiteService.GetUserForSession()",
__LINE__, __WFILE__, &arguments, L"MgInvalidSessionsId", NULL);
}
MG_SITE_SERVICE_CATCH_AND_THROW(L"MgServerSiteService.GetUserForSession")
return userId;
}
示例6: if
/*
* Constructor.
*/
CAnimation::CAnimation(const STRING file):
m_users(1)
{
extern STRING g_projectPath;
renderFrame = &CAnimation::renderAnmFrame;
if (!file.empty())
{
const STRING ext = getExtension(file);
if (_ftcsicmp(ext.c_str(), _T("anm")) == 0)
{
m_data.open(g_projectPath + MISC_PATH + file);
}
else if (_ftcsicmp(ext.c_str(), _T("gif")) == 0)
{
m_data.loadFromGif(resolve(g_projectPath + MISC_PATH + file));
renderFrame = &CAnimation::renderFileFrame;
m_data.filename = file;
}
}
freeCanvases();
m_canvases.resize(m_data.frameCount, NULL);
}
示例7: UnescapeOther
void UnescapeOther(const STRING& str, size_t& i, STRING& Ret)
{
STRING Num;
// check octal
if (L'0' <= str[i] && str[i] < L'8')
{
Num += str[i];
++i;
if (L'0' <= str[i] && str[i] < L'8')
{
Num += str[i];
++i;
if (L'0' <= str[i] && str[i] < L'8')
{
Num += str[i];
++i;
}
}
}
if (Num.empty())
{
Ret += str[i];
++i;
}
else
{
// octal
Ret += (WCHAR)wcstoul(&Num[0], NULL, 8);
}
}
示例8: DoAction
VOID CActionItem_ChatMood::DoAction()
{
STRING strKey = SCRIPT_SANDBOX::Talk::s_Talk.FindTalkActKey(GetPosIndex());
if(!strKey.empty())
{
CEventSystem::GetMe()->PushEvent(GE_CHAT_ACTSET, strKey.c_str());
}
}
示例9: FormatSubdir
///////////////////////////////////////////////////////////////////////////////
/// \brief
/// Appends a slash to non-empty string
///
STRING MgUnmanagedDataManager::FormatSubdir(CREFSTRING subdir)
{
STRING result = subdir;
if (!result.empty())
{
MgFileUtil::AppendSlashToEndOfPath(result);
}
return result;
}
示例10: Clear
// clears the tile cache for the given map
void MgdTileCache::Clear(MgMapBase* map)
{
if (map != NULL)
{
STRING basePath = GetBasePath(map);
// delete main map directory
if (!basePath.empty())
MgFileUtil::DeleteDirectory(basePath, true, false);
}
}
示例11: EnableObjectVerticesTrace
void PolyObjectBuffer::EnableObjectVerticesTrace(BOOL enableTrace,
STRING traceFile)
{
traceVertices = enableTrace;
if (traceVertices) {
assert(!traceFile.empty());
traceFileName = traceFile;
}
} // end: EnableBoundaryTraversalTrace()
示例12: EnableIntersectionTrace
void IntersectionList::EnableIntersectionTrace(BOOL enableTrace,
STRING traceFile)
{
traceIntersections = enableTrace;
if (traceIntersections) {
assert(!traceFile.empty());
intersectionTraceFileName = traceFile;
}
} // end: EnableIntersectionTrace()
示例13: InitializeCommonParameters
/// <summary>
/// Initializes the common parameters and parameters specific to this request.
/// </summary>
/// <param name="name">Input
/// MgHttpRequest
/// This contains all the parameters of the request.
/// </param>
/// <returns>
/// nothing
/// </returns>
MgHttpKmlGetLayer::MgHttpKmlGetLayer(MgHttpRequest *hRequest)
{
InitializeCommonParameters(hRequest);
Ptr<MgHttpRequestParam> params = hRequest->GetRequestParam();
// Get the layer definition
m_layerDefinition = params->GetParameterValue(MgHttpResourceStrings::reqKmlLayerDefinition);
// Get the map agent Uri
m_agentUri = hRequest->GetAgentUri();
// Get the bounding box
m_boundingBox = params->GetParameterValue(MgHttpResourceStrings::reqKmlBoundingBox);
// Get the requested format
m_format = params->GetParameterValue(MgHttpResourceStrings::reqKmlFormat);
// Get the map image width
STRING width = params->GetParameterValue(MgHttpResourceStrings::reqKmlWidth);
m_width = MgUtil::StringToInt32(width);
// Get the map image height
STRING height = params->GetParameterValue(MgHttpResourceStrings::reqKmlHeight);
m_height = MgUtil::StringToInt32(height);
// Get the map resolution
STRING dpi = params->GetParameterValue(MgHttpResourceStrings::reqKmlDpi);
if(!dpi.empty())
{
m_dpi = MgUtil::StringToDouble(dpi);
}
else
{
m_dpi = 96; // default
}
// Get the draw order
STRING drawOrder = params->GetParameterValue(MgHttpResourceStrings::reqKmlDrawOrder);
m_drawOrder = drawOrder.empty() ? 0 : MgUtil::StringToInt32(drawOrder);
}
示例14: PacketItem_UserItem
VOID CGameInterface::PacketItem_UserItem(tActionItem* pActionItem, int targetServerID, fVector2& fvPos)
{
//空物品
if(!pActionItem || pActionItem->GetType() != AOT_ITEM) return;
CObject_Item* pItem = (CObject_Item*)(((CActionItem_Item*)pActionItem)->GetItemImpl());
if(!pItem) return;
//必须是能够使用的物品
if(pItem->GetItemClass()!=ICLASS_COMITEM && pItem->GetItemClass()!=ICLASS_TASKITEM) return;
//特殊物品不能在背包中直接使用,例如,宠物技能书
STRING strTemp;
if(!CObject_Item::CheckUseInPackage(pItem, strTemp))
{
if(!strTemp.empty()) CGameProcedure::s_pEventSystem->PushEvent(GE_NEW_DEBUGMESSAGE, strTemp.c_str());
return;
}
//组队跟随中...
if(CObjectManager::GetMe()->GetMySelf()->GetCharacterData()->Get_TeamFollowFlag()) return;
//检查目前选中的目标
CObject* pObj = (CObject*)CObjectManager::GetMe()->FindServerObject(targetServerID);
//检查物品是否能够直接使用
int objID;
PET_GUID_t petID;
bool bCanuseDir = ((CObject_Item_Medicine*)pItem)->IsValidTarget(pObj, fvPos, objID, petID);
if(bCanuseDir)
{
WORLD_POS posTarget(fvPos.x, fvPos.y);
//能够直接使用
CGUseItem msg;
msg.SetBagIndex( pItem->GetPosIndex() );
msg.SetTargetObjID(objID);
msg.SetTargetPetGUID(petID);
msg.SetTargetPos(&posTarget);
CNetManager::GetMe()->SendPacket( &msg );
return;
}
//如果已经选中目标,说明目标不合适,如果是用在自己宠物上的物品,说明宠物没有释放
if(pObj || ((CObject_Item_Medicine*)pItem)->IsTargetOne())
{
CGameProcedure::s_pEventSystem->PushEvent(GE_NEW_DEBUGMESSAGE, "无效目标");
return;
}
//需要选中目标,在鼠标上挂上物品
CActionSystem::GetMe()->SetDefaultAction(pActionItem);
}
示例15: GetLongTransactionName
///////////////////////////////////////////////////////////////////////////////
/// \brief
/// Provides the long transaction name associated with the specified
/// resource. Returns false if no session was active for the current
/// request, or if no long transaction name was found.
///
bool MgLongTransactionManager::GetLongTransactionName(MgResourceIdentifier* featureSourceId, REFSTRING longTransactionName)
{
ACE_MT(ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex, ace_mon, sm_mutex, false));
STRING sessionId;
Ptr<MgUserInformation> userInfo = MgUserInformation::GetCurrentUserInfo();
if (userInfo != NULL)
sessionId = userInfo->GetMgSessionId();
if (sessionId.empty())
return false;
return MgLongTransactionManager::GetLongTransactionName(sessionId, featureSourceId, longTransactionName);
}