本文整理汇总了C++中str_type::string::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ string::empty方法的具体用法?C++ string::empty怎么用?C++ string::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类str_type::string
的用法示例。
在下文中一共展示了string::empty方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: file
ETH_WINDOW_ENML_FILE::ETH_WINDOW_ENML_FILE(const str_type::string& fileName, const Platform::FileManagerPtr& fileManager)
{
width = 640;
height = 480;
windowed = true;
vsync = true;
title = GS_L("Ethanon Engine");
str_type::string out;
fileManager->GetAnsiFileString(fileName, out);
enml::File file(out);
if (file.getError() == enml::enmlevSUCCESS)
{
file.getUInt(GS_L("window"), GS_L("width"), &width);
file.getUInt(GS_L("window"), GS_L("height"), &height);
windowed = (file.get(GS_L("window"), GS_L("windowed")) == GS_L("false")) ? false : true;
vsync = (file.get(GS_L("window"), GS_L("vsync")) == GS_L("false")) ? false : true;
const str_type::string newTitle = file.get(GS_L("window"), GS_L("title"));
title = newTitle.empty() ? title : newTitle;
}
else
{
#ifdef GS2D_STR_TYPE_WCHAR
std::wcerr
#else
std::cerr
#endif
<< file.getErrorString() << std::endl;
}
}
示例2: AddEntity
int ETHScene::AddEntity(ETHRenderEntity* pEntity, const str_type::string& alternativeName)
{
// sets an alternative name if there is any
if (!alternativeName.empty())
{
pEntity->ChangeEntityName(alternativeName);
}
// generate an unique id
if (pEntity->GetID() < 0)
{
pEntity->SetID(++m_idCounter);
}
m_buckets.Add(pEntity, (pEntity->GetType() == ETH_HORIZONTAL) ? ETHBucketManager::FRONT : ETHBucketManager::BACK);
m_maxSceneHeight = Max(m_maxSceneHeight, pEntity->GetMaxHeight());
m_minSceneHeight = Min(m_minSceneHeight, pEntity->GetMinHeight());
// find a callback function for this one
if (m_pContext && m_pModule)
{
AssignCallbackScript(pEntity);
}
// if it has a callback and is dynamic, or if it's temporary, add it to the "callback constant run list"
m_tempEntities.AddEntityWhenEligible(pEntity);
// restart all sound effects for this one
// It's useful in case of explosion sfx's for example. It'll start all over again
pEntity->StartSFX();
return pEntity->GetID();
}
示例3: file
ETH_WINDOW_ENML_FILE::ETH_WINDOW_ENML_FILE(const str_type::string& fileName, const Platform::FileManagerPtr& fileManager) :
width(640),
height(480),
windowed(true),
vsync(true),
title(GS_L("Ethanon Engine")),
richLighting(true)
{
str_type::string out;
fileManager->GetAnsiFileString(fileName, out);
enml::File file(out);
if (file.getError() == enml::enmlevSUCCESS)
{
file.getUInt(GS_L("window"), GS_L("width"), &width);
file.getUInt(GS_L("window"), GS_L("height"), &height);
windowed = ETHGlobal::IsTrue(file.get(GS_L("window"), GS_L("windowed")));
vsync = ETHGlobal::IsTrue(file.get(GS_L("window"), GS_L("vsync")));
const str_type::string newTitle = file.get(GS_L("window"), GS_L("title"));
richLighting = ETHGlobal::IsTrue(file.get(GS_L("rendering"), GS_L("richLighting")));
title = newTitle.empty() ? title : newTitle;
densityManager.FillParametersFromFile(file);
}
else
{
#ifdef GS2D_STR_TYPE_WCHAR
std::wcerr
#else
std::cerr
#endif
<< file.getErrorString() << std::endl;
}
}
示例4: LoadProperties
void ETHAppEnmlFile::LoadProperties(const str_type::string& platformName, const gs2d::enml::File& file)
{
if (!file.Exists(platformName))
return;
file.GetUInt(platformName, GS_L("width"), &width);
file.GetUInt(platformName, GS_L("height"), &height);
GetBoolean(file, platformName, GS_L("windowed"), windowed);
GetBoolean(file, platformName, GS_L("vsync"), vsync);
GetBoolean(file, platformName, GS_L("richLighting"), richLighting);
GetString(file, platformName, GS_L("fixedWidth"), fixedWidth);
GetString(file, platformName, GS_L("fixedHeight"), fixedHeight);
file.GetFloat(platformName, GS_L("hdDensityValue"), &hdDensityValue);
file.GetFloat(platformName, GS_L("fullHdDensityValue"), &fullHdDensityValue);
file.GetUInt(platformName, GS_L("minScreenHeightForHdVersion"), &minScreenHeightForHdVersion);
file.GetUInt(platformName, GS_L("minScreenHeightForFullHdVersion"), &minScreenHeightForFullHdVersion);
const str_type::string newTitle = file.Get(platformName, GS_L("title"));
if (!newTitle.empty())
title = newTitle;
std::vector<gs2d::str_type::string> words = ETHGlobal::SplitString(file.Get(platformName, GS_L("definedWords")), GS_L(","));
definedWords.insert(definedWords.end(), words.begin(), words.end());
std::sort(definedWords.begin(), definedWords.end());
std::vector<gs2d::str_type::string>::iterator it = std::unique(definedWords.begin(), definedWords.end());
definedWords.resize(it - definedWords.begin());
}
示例5: main
int main(int argc, char** argv)
#endif
{
// convert args to multibyte char
#ifdef WIN32
GS2D_UNUSED_ARGUMENT(hInstance);
GS2D_UNUSED_ARGUMENT(nCmdShow);
int argc = 0;
LPWSTR* wargv = CommandLineToArgvW(lpCmdLine, &argc);
LPSTR* argv = new LPSTR [argc];
for (int t = 0; t < argc; t++)
{
std::size_t convertCount = 0;
const std::size_t bufferSize = 4096;
argv[t] = new CHAR [bufferSize];
wcstombs_s(&convertCount, argv[t], bufferSize, wargv[t], wcslen(wargv[t]) + 1);
}
#endif
// start engine runtime
bool compileAndRun, testing, wait;
ProcParams(argc, argv, compileAndRun, testing, wait);
ETHScriptWrapper::SetArgc(argc);
ETHScriptWrapper::SetArgv(argv);
Platform::FileManagerPtr fileManager(new Platform::StdFileManager());
Platform::FileIOHubPtr fileIOHub = Platform::CreateFileIOHub(fileManager, ETHDirectories::GetBitmapFontDirectory());
{
const str_type::string resourceDirectory = FindResourceDir(argc, argv);
if (!resourceDirectory.empty())
fileIOHub->SetResourceDirectory(resourceDirectory);
}
const str_type::string resourceDirectory = fileIOHub->GetResourceDirectory();
const ETHAppEnmlFile app(resourceDirectory + ETH_APP_PROPERTIES_FILE, Platform::FileManagerPtr(new Platform::StdFileManager), Application::GetPlatformName());
const str_type::string bitmapFontPath = resourceDirectory + ETHDirectories::GetBitmapFontDirectory();
bool aborted;
{
ETHEnginePtr application = ETHEnginePtr(new ETHEngine(testing, compileAndRun));
application->SetHighEndDevice(true);
VideoPtr video;
if ((video = CreateVideo(
app.GetWidth(),
app.GetHeight(),
app.GetTitle(),
app.IsWindowed(),
app.IsVsyncEnabled(),
fileIOHub,
Texture::PF_UNKNOWN,
false)))
{
InputPtr input = CreateInput(0, false);
AudioPtr audio = CreateAudio(0);
application->Start(video, input, audio);
if (compileAndRun)
{
Video::APP_STATUS status;
while ((status = video->HandleEvents()) != Video::APP_QUIT)
{
if (status == Video::APP_SKIP)
continue;
input->Update();
if (application->Update(Min(1000.0f, ComputeElapsedTimeF(video))) == Application::APP_QUIT)
{
break;
}
application->RenderFrame();
}
}
}
application->Destroy();
aborted = application->Aborted();
}
if (aborted)
{
ETH_STREAM_DECL(ss) << std::endl << GS_L("The program executed an ilegal operation and was aborted");
GS2D_CERR << ss.str() << std::endl;
}
if (!compileAndRun && !aborted)
{
ETH_STREAM_DECL(ss) << std::endl << GS_L("Compilation successful: 0 errors");
GS2D_CERR << ss.str() << std::endl;
}
if (aborted && wait)
{
GS2D_COUT << GS_L("Press any key to continue...") << GS_L("\n");
std::cin.get();
}
//.........这里部分代码省略.........
示例6: ETH_MACHINE_MAIN_FUNC
int ETH_MACHINE_MAIN_FUNC(int argc, gs2d::str_type::char_t** argv)
#endif
{
bool compileAndRun, testing, wait;
ProcParams(argc, argv, compileAndRun, testing, wait);
ETHScriptWrapper::SetArgc(argc);
ETHScriptWrapper::SetArgv(argv);
Platform::FileManagerPtr fileManager(new Platform::StdFileManager());
Platform::FileIOHubPtr fileIOHub = Platform::CreateFileIOHub(fileManager, ETHDirectories::GetBitmapFontDirectory());
{
const str_type::string resourceDirectory = FindResourceDir(argc, argv);
if (!resourceDirectory.empty())
fileIOHub->SetResourceDirectory(resourceDirectory);
}
const str_type::string resourceDirectory = fileIOHub->GetResourceDirectory();
const ETHAppEnmlFile app(resourceDirectory + ETH_APP_PROPERTIES_FILE, Platform::FileManagerPtr(new Platform::StdFileManager), Application::GetPlatformName());
const str_type::string bitmapFontPath = resourceDirectory + ETHDirectories::GetBitmapFontDirectory();
bool aborted;
{
ETHEnginePtr application = ETHEnginePtr(new ETHEngine(testing, compileAndRun));
application->SetHighEndDevice(true);
VideoPtr video;
if ((video = CreateVideo(
app.GetWidth(),
app.GetHeight(),
app.GetTitle(),
app.IsWindowed(),
app.IsVsyncEnabled(),
fileIOHub,
Texture::PF_UNKNOWN,
false)))
{
InputPtr input = CreateInput(0, false);
AudioPtr audio = CreateAudio(0);
application->Start(video, input, audio);
if (compileAndRun)
{
Video::APP_STATUS status;
while ((status = video->HandleEvents()) != Video::APP_QUIT)
{
if (status == Video::APP_SKIP)
continue;
input->Update();
if (application->Update(Min(static_cast<unsigned long>(1000), ComputeElapsedTime(video))) == Application::APP_QUIT)
{
break;
}
application->RenderFrame();
}
}
}
application->Destroy();
aborted = application->Aborted();
}
if (aborted)
{
ETH_STREAM_DECL(ss) << std::endl << GS_L("The program executed an ilegal operation and was aborted");
GS2D_CERR << ss.str() << std::endl;
}
if (!compileAndRun && !aborted)
{
ETH_STREAM_DECL(ss) << std::endl << GS_L("Compilation successful: 0 errors");
GS2D_CERR << ss.str() << std::endl;
}
if (aborted && wait)
{
GS2D_COUT << GS_L("Press any key to continue...") << GS_L("\n");
std::cin.get();
}
#if defined(_DEBUG) || defined(DEBUG)
#ifdef WIN32
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
#endif
#endif
return 0;
}