本文整理汇总了C++中idStr::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ idStr::Clear方法的具体用法?C++ idStr::Clear怎么用?C++ idStr::Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idStr
的用法示例。
在下文中一共展示了idStr::Clear方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetLastWhiteSpace
/*
================
idLexer::GetLastWhiteSpace
================
*/
int idLexer::GetLastWhiteSpace( idStr &whiteSpace ) const {
whiteSpace.Clear();
for ( const char *p = whiteSpaceStart_p; p < whiteSpaceEnd_p; p++ ) {
whiteSpace.Append( *p );
}
return whiteSpace.Length();
}
示例2: ScrubSaveGameFileName
/*
===============
idCommonLocal::ScrubSaveGameFileName
Turns a bad file name into a good one or your money back
===============
*/
void idCommonLocal::ScrubSaveGameFileName( idStr &saveFileName ) const {
int i;
idStr inFileName;
inFileName = saveFileName;
inFileName.RemoveColors();
inFileName.StripFileExtension();
saveFileName.Clear();
int len = inFileName.Length();
for ( i = 0; i < len; i++ ) {
if ( strchr( "',[email protected]#$%^&*()[]{}<>\\|/=?+;:-\'\"", inFileName[i] ) ) {
// random junk
saveFileName += '_';
} else if ( (const unsigned char)inFileName[i] >= 128 ) {
// high ascii chars
saveFileName += '_';
} else if ( inFileName[i] == ' ' ) {
saveFileName += '_';
} else {
saveFileName += inFileName[i];
}
}
}
示例3: GetDeclName
/*
================
DialogDeclBrowser::GetDeclName
================
*/
void DialogDeclBrowser::GetDeclName( HTREEITEM item, idStr &typeName, idStr &declName ) const {
HTREEITEM parent;
idStr itemName;
declName.Clear();
for( parent = declTree.GetParentItem( item ); parent; parent = declTree.GetParentItem( parent ) ) {
itemName = declTree.GetItemText( item );
declName = itemName + "/" + declName;
item = parent;
}
declName.Strip( '/' );
typeName = declTree.GetItemText( item );
}
示例4: Shutdown
/*
====================
idModelExport::Shutdown
====================
*/
void idModelExport::Shutdown( void ) {
if( Maya_Shutdown ) {
Maya_Shutdown();
}
if( importDLL ) {
sys->DLL_Unload( importDLL );
}
importDLL = 0;
Maya_Shutdown = NULL;
Maya_ConvertModel = NULL;
Maya_Error.Clear();
initialized = false;
}
示例5: Shutdown
/*
============
idCmdSystemLocal::Shutdown
============
*/
void idCmdSystemLocal::Shutdown( void ) {
commandDef_t *cmd;
for ( cmd = commands; cmd; cmd = commands ) {
commands = commands->next;
Mem_Free( cmd->name );
Mem_Free( cmd->description );
delete cmd;
}
completionString.Clear();
completionParms.Clear();
tokenizedCmds.Clear();
postReload.Clear();
}
示例6: Sys_Shutdown
/*
===============
Sys_Shutdown
===============
*/
void Sys_Shutdown()
{
basepath.Clear();
savepath.Clear();
Posix_Shutdown();
}
示例7: Sys_GetPath
bool Sys_GetPath(sysPath_t type, idStr &path) {
const char *s;
char buf[MAX_OSPATH];
char buf2[MAX_OSPATH];
struct stat st;
size_t len;
path.Clear();
switch(type) {
case PATH_BASE:
if (stat(BUILD_DATADIR, &st) != -1 && S_ISDIR(st.st_mode)) {
path = BUILD_DATADIR;
return true;
}
common->Warning("base path '" BUILD_DATADIR "' does not exist");
// try next to the executable..
if (Sys_GetPath(PATH_EXE, path)) {
path = path.StripFilename();
// the path should have a base dir in it, otherwise it probably just contains the executable
idStr testPath = path + "/" BASE_GAMEDIR;
if (stat(testPath.c_str(), &st) != -1 && S_ISDIR(st.st_mode)) {
common->Warning("using path of executable: %s", path.c_str());
return true;
} else {
path.Clear();
}
}
// fallback to vanilla doom3 install
if (stat(LINUX_DEFAULT_PATH, &st) != -1 && S_ISDIR(st.st_mode)) {
common->Warning("using hardcoded default base path: " LINUX_DEFAULT_PATH);
path = LINUX_DEFAULT_PATH;
return true;
}
return false;
case PATH_CONFIG:
s = getenv("XDG_CONFIG_HOME");
if (s)
idStr::snPrintf(buf, sizeof(buf), "%s/dhewm3", s);
else
idStr::snPrintf(buf, sizeof(buf), "%s/.config/dhewm3", getenv("HOME"));
path = buf;
return true;
case PATH_SAVE:
s = getenv("XDG_DATA_HOME");
if (s)
idStr::snPrintf(buf, sizeof(buf), "%s/dhewm3", s);
else
idStr::snPrintf(buf, sizeof(buf), "%s/.local/share/dhewm3", getenv("HOME"));
path = buf;
return true;
case PATH_EXE:
idStr::snPrintf(buf, sizeof(buf), "/proc/%d/exe", getpid());
len = readlink(buf, buf2, sizeof(buf2));
if (len != -1) {
path = buf2;
return true;
}
if (path_argv[0] != 0) {
path = path_argv;
return true;
}
return false;
}
return false;
}