本文整理汇总了C++中plString::IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ plString::IsEmpty方法的具体用法?C++ plString::IsEmpty怎么用?C++ plString::IsEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plString
的用法示例。
在下文中一共展示了plString::IsEmpty方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetAgeSDLObjectUoid
plUoid plNetClientMgr::GetAgeSDLObjectUoid(const plString& ageName) const
{
hsAssert(!ageName.IsEmpty(), "nil ageName");
// if age sdl hook is loaded
if (fAgeSDLObjectKey)
return fAgeSDLObjectKey->GetUoid();
// if age is loaded
plLocation loc = plKeyFinder::Instance().FindLocation(ageName,plAgeDescription::GetCommonPage(plAgeDescription::kGlobal));
if (!loc.IsValid())
{
// check current age des
if (plAgeLoader::GetInstance()->GetCurrAgeDesc().GetAgeName() == ageName)
loc=plAgeLoader::GetInstance()->GetCurrAgeDesc().CalcPageLocation("BuiltIn");
if (!loc.IsValid())
{
// try to load age desc
hsStream* stream=plAgeLoader::GetAgeDescFileStream(ageName);
if (stream)
{
plAgeDescription ad;
ad.Read(stream);
loc=ad.CalcPageLocation("BuiltIn");
stream->Close();
}
delete stream;
}
}
return plUoid(loc, plSceneObject::Index(), plSDL::kAgeSDLObjectName);
}
示例2: SetClipboardText
void plClipboard::SetClipboardText(const plString& text)
{
if (text.IsEmpty())
return;
#ifdef HS_BUILD_FOR_WIN32
plStringBuffer<wchar_t> buf = text.ToWchar();
size_t len = buf.GetSize();
if (len == 0)
return;
std::unique_ptr<void, HGLOBAL(WINAPI*)(HGLOBAL)> copy(::GlobalAlloc(GMEM_MOVEABLE, (len + 1) * sizeof(wchar_t)), ::GlobalFree);
if (!copy)
return;
if (!::OpenClipboard(NULL))
return;
::EmptyClipboard();
wchar_t* target = (wchar_t*)::GlobalLock(copy.get());
memcpy(target, buf.GetData(), (len + 1) * sizeof(wchar_t));
target[len] = '\0';
::GlobalUnlock(copy.get());
::SetClipboardData(CF_UNICODETEXT, copy.get());
::CloseClipboard();
#endif
}
示例3: EatPage
virtual bool EatPage( plRegistryPageNode *page )
{
if ( !fAge.IsEmpty() && page->GetPageInfo().GetAge().CompareI(fAge) == 0 )
{
fPages.Append( page );
}
return true;
}
示例4: LoadAvatar
plKey plAvatarMgr::LoadAvatar(plString name, plString accountName, bool isPlayer, plKey spawnPoint, plAvTask *initialTask,
const plString &userStr, const plFileName &clothingFile)
{
// *** account is currently unused. the idea is that eventually an NPC will
// *** be able to use a customization account
plKey result = nullptr;
plKey requestor = GetKey(); // avatar manager is always the requestor for avatar loads
plNetClientMgr *netMgr = plNetClientMgr::GetInstance();
if(netMgr) // can't clone without the net manager
{
hsAssert(!name.IsEmpty(), "name required by LoadPlayer fxn");
netMgr->DebugMsg("Local: Loading player %s", name.c_str());
// look up player by key name provided by user.
// this string search should be replaced with some other method of
// avatar selection and key lookup.
// Get the location for the player first
plKey playerKey = nullptr;
const plLocation& globalLoc = plKeyFinder::Instance().FindLocation("GlobalAvatars", name);
const plLocation& maleLoc = plKeyFinder::Instance().FindLocation("GlobalAvatars", "Male");
const plLocation& custLoc = plKeyFinder::Instance().FindLocation("CustomAvatars", name);
#ifdef PLASMA_EXTERNAL_RELEASE
// Try global. If that doesn't work, players default to male.
// If not a player, try custLoc. If that doesn't work, fall back to male
const plLocation& loc = (globalLoc.IsValid() ? globalLoc : isPlayer ? maleLoc : custLoc.IsValid() ? custLoc : maleLoc);
#else
// Try global. If that doesn't work try custom. Otherwise fall back to male
const plLocation& loc = (globalLoc.IsValid() ? globalLoc : custLoc.IsValid() ? custLoc : maleLoc);
#endif
if (loc == maleLoc)
name = "Male";
if (loc.IsValid())
{
plUoid uID(loc, plSceneObject::Index(), name);
plLoadAvatarMsg *cloneMsg = new plLoadAvatarMsg(uID, requestor, 0, isPlayer, spawnPoint, initialTask, userStr);
if (clothingFile.IsValid())
{
plLoadClothingMsg *clothingMsg = new plLoadClothingMsg(clothingFile);
cloneMsg->SetTriggerMsg(clothingMsg);
}
result = cloneMsg->GetCloneKey();
// the clone message is automatically addressed to the net client manager
// we'll receive the message back (or a similar message) when the clone is loaded
cloneMsg->Send();
}
}
return result;
}
示例5: SaveLocalizationText
// saves the current localization text to the data manager
void SaveLocalizationText()
{
if (gCurrentPath.IsEmpty())
return; // no path to save
uint32_t textLen = (uint32_t)SendMessage(GetDlgItem(gEditDlg, IDC_LOCALIZATIONTEXT), WM_GETTEXTLENGTH, (WPARAM)0, (LPARAM)0);
wchar_t *buffer = new wchar_t[textLen + 2];
GetDlgItemTextW(gEditDlg, IDC_LOCALIZATIONTEXT, buffer, textLen + 1);
buffer[textLen + 1] = 0;
plString plainTextData = plString::FromWchar(buffer);
delete [] buffer;
plString ageName, setName, elementName, elementLanguage;
SplitLocalizationPath(gCurrentPath, ageName, setName, elementName, elementLanguage);
plString name = plString::Format("%s.%s.%s", ageName.c_str(), setName.c_str(), elementName.c_str());
pfLocalizationDataMgr::Instance().SetElementPlainTextData(name, elementLanguage, plainTextData);
}
示例6: Log
//
// override for plLoggable
//
bool plNetClientMgr::Log(const plString& str) const
{
if (str.IsNull() || str.IsEmpty()) {
return true;
}
// prepend raw time
plString buf2 = plFormat("{.2f} {}", hsTimer::GetSeconds(), ProcessTab(str.c_str()));
if ( GetConsoleOutput() )
hsStatusMessage(buf2.c_str());
GetLog();
plNetObjectDebugger::GetInstance()->LogMsgIfMatch(buf2.c_str());
if (fStatusLog) {
return fStatusLog->AddLine(buf2);
}
return true;
}
示例7: GetDeviceCaps
void plDynSurfaceWriter::plWinSurface::SetFont( const plString &face, uint16_t size, uint8_t flags, bool aaRGB )
{
fFontFace = face;
fFontSize = size;
fFontFlags = flags;
fFontAntiAliasRGB = aaRGB;
bool hadAFont = false;
if( fFont != nil )
{
hadAFont = true;
plWinFontCache::GetInstance().FreeFont( fFont );
fFont = nil;
}
if (face.IsEmpty())
return;
bool bold = ( fFontFlags & plDynSurfaceWriter::kFontBold ) ? true : false;
bool italic = ( fFontFlags & plDynSurfaceWriter::kFontItalic ) ? true : false;
int nHeight = -MulDiv( size, GetDeviceCaps( fDC, LOGPIXELSY ), 72 );
fFont = plWinFontCache::GetInstance().GetMeAFont( face, nHeight, bold ? FW_BOLD : FW_NORMAL, italic,
fFontAntiAliasRGB ? ANTIALIASED_QUALITY : DEFAULT_QUALITY );
if( fFont == nil && fFontAntiAliasRGB )
{
static bool warnedCantAntiAlias = false;
// Creation of font failed; could be that we can't do anti-aliasing? Try not doing it...
if( !warnedCantAntiAlias )
{
plStatusLog::AddLineS( "pipeline.log", "WARNING: Cannot allocate anti-aliased font. Falling back to non-anti-aliased. This will be the only warning" );
warnedCantAntiAlias = true;
}
fFont = plWinFontCache::GetInstance().GetMeAFont( face, nHeight, bold ? FW_BOLD : FW_NORMAL, italic,
fFontAntiAliasRGB ? ANTIALIASED_QUALITY : DEFAULT_QUALITY );
}
if( fFont == nil )
{
hsAssert( false, "Cannot create Windows font for plDynSurfaceWriter" );
plStatusLog::AddLineS( "pipeline.log", "ERROR: Cannot allocate font for RGB surface! (face: %s, size: %d %s %s)",
face.c_str(), nHeight, bold ? "bold" : "", italic ? "italic" : "" );
fFontFace = plString::Null;
fFontSize = 0;
return;
}
if( SelectObject( fDC, fFont ) == nil && hadAFont )
{
char msg[ 256 ];
FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nil, GetLastError(), MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), msg, sizeof( msg ), nil );
char *ret = strrchr( msg, '\n' );
if( ret != nil )
*ret = 0;
plStatusLog::AddLineS( "pipeline.log", 0xffff0000, "SelectObject() FAILED (%s)", msg );
}
}