本文整理汇总了C++中CUtlString类的典型用法代码示例。如果您正苦于以下问题:C++ CUtlString类的具体用法?C++ CUtlString怎么用?C++ CUtlString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CUtlString类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Length
CUtlString CUtlString::Slice( int32 nStart, int32 nEnd ) const
{
int length = Length();
if ( length == 0 )
{
return CUtlString();
}
if ( nStart < 0 )
nStart = length - (-nStart % length);
else if ( nStart >= length )
nStart = length;
if ( nEnd == INT32_MAX )
nEnd = length;
else if ( nEnd < 0 )
nEnd = length - (-nEnd % length);
else if ( nEnd >= length )
nEnd = length;
if ( nStart >= nEnd )
return CUtlString();
const char *pIn = String();
CUtlString ret;
ret.SetDirect( pIn + nStart, nEnd - nStart );
return ret;
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:29,代码来源:utlstring.cpp
示例2: Unserialize
bool Unserialize( CUtlBuffer &buf, CUtlString &dest )
{
int nLen = buf.PeekDelimitedStringLength( s_pConv );
dest.SetLength( nLen - 1 ); // -1 because the length returned includes space for \0
buf.GetDelimitedString( s_pConv, dest.Get(), nLen );
return buf.IsValid();
}
开发者ID:Cre3per,项目名称:hl2sdk-csgo,代码行数:7,代码来源:utlbufferutil.cpp
示例3: OnCommand
//=============================================================================
void DownloadCampaign::OnCommand(const char *command)
{
if ( Q_stricmp( command, "Continue" ) == 0 )
{
CUtlString dest;
if ( V_strnicmp( "http:", m_webSite.Get(), 4 ) != 0 || V_strnicmp( "https:", m_webSite.Get(), 4 ) != 0 )
{
dest = "http://";
dest += m_webSite;
}
else
{
dest = m_webSite;
}
system()->ShellExecute("open", dest.Get() );
NavigateBack();
}
else if ( Q_stricmp( command, "Back" ) == 0 )
{
CBaseModPanel::GetSingleton().PlayUISound( UISOUND_BACK );
NavigateBack();
}
else
{
BaseClass::OnCommand( command );
}
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:30,代码来源:vdownloadcampaign.cpp
示例4: MEM_ALLOC_CREDIT
void CBaseGameStats_Driver::PossibleMapChange( void )
{
#ifdef GAME_DLL
//detect and copy map changes
if ( Q_stricmp( m_PrevMapName.String(), STRING( gpGlobals->mapname ) ) )
{
MEM_ALLOC_CREDIT();
CUtlString PrevMapBackup = m_PrevMapName;
m_PrevMapName = STRING( gpGlobals->mapname );
gamestats->Event_MapChange( PrevMapBackup.String(), STRING( gpGlobals->mapname ) );
if ( gamestats->UseOldFormat() )
{
if( gamestats->AutoSave_OnMapChange() )
gamestats->SaveToFileNOW();
if( gamestats->AutoUpload_OnMapChange() )
gamestats->UploadStatsFileNOW();
}
}
#endif
}
开发者ID:AluminumKen,项目名称:hl2sb-src,代码行数:25,代码来源:gamestats.cpp
示例5: mapInfo
void C_HudMapInfo::LevelInitPostEntity()
{
KeyValuesAD mapInfo("MapInfo");
MapData *pData = g_pMapCache->GetCurrentMapData();
if (pData)
{
mapInfo->SetString("mapName", pData->m_szMapName);
CUtlString authors;
if (pData->GetCreditString(&authors, CREDIT_AUTHOR))
{
mapInfo->SetString("authors", authors.Get());
m_pMapAuthorLabel->SetText(CConstructLocalizedString(m_wMapAuthors, (KeyValues*)mapInfo));
}
mapInfo->SetInt("difficulty", pData->m_MainTrack.m_iDifficulty);
m_pMapDifficultyLabel->SetText(CConstructLocalizedString(m_wMapDifficulty, (KeyValues*)mapInfo));
}
else
{
mapInfo->SetString("mapName", g_pGameRules->MapName());
m_pMapAuthorLabel->SetText("");
m_pMapDifficultyLabel->SetText("");
}
m_pMapNameLabel->SetText(CConstructLocalizedString(m_wMapName, (KeyValues*)mapInfo));
}
开发者ID:bonjorno7,项目名称:GAME,代码行数:26,代码来源:hud_mapinfo.cpp
示例6: Assert
CUtlString CUtlString::Replace( const char *pszFrom, const char *pszTo ) const
{
Assert( pszTo ); // Can be 0 length, but not null
Assert( pszFrom && *pszFrom ); // Must be valid and have one character.
const char *pos = V_strstr( String(), pszFrom );
if ( !pos )
{
return *this;
}
const char *pFirstFound = pos;
// count number of search string
int nSearchCount = 0;
int nSearchLength = V_strlen( pszFrom );
while ( pos )
{
nSearchCount++;
int nSrcOffset = ( pos - String() ) + nSearchLength;
pos = V_strstr( String() + nSrcOffset, pszFrom );
}
// allocate the new string
int nReplaceLength = V_strlen( pszTo );
int nAllocOffset = nSearchCount * ( nReplaceLength - nSearchLength );
size_t srcLength = Length();
CUtlString strDest;
size_t destLength = srcLength + nAllocOffset;
strDest.SetLength( destLength );
// find and replace the search string
pos = pFirstFound;
int nDestOffset = 0;
int nSrcOffset = 0;
while ( pos )
{
// Found an instance
int nCurrentSearchOffset = pos - String();
int nCopyLength = nCurrentSearchOffset - nSrcOffset;
V_strncpy( strDest.GetForModify() + nDestOffset, String() + nSrcOffset, nCopyLength + 1 );
nDestOffset += nCopyLength;
V_strncpy( strDest.GetForModify() + nDestOffset, pszTo, nReplaceLength + 1 );
nDestOffset += nReplaceLength;
nSrcOffset = nCurrentSearchOffset + nSearchLength;
pos = V_strstr( String() + nSrcOffset, pszFrom );
}
// making sure that the left over string from the source is the same size as the left over dest buffer
Assert( destLength - nDestOffset == srcLength - nSrcOffset );
if ( destLength - nDestOffset > 0 )
{
V_strncpy( strDest.GetForModify() + nDestOffset, String() + nSrcOffset, destLength - nDestOffset + 1 );
}
return strDest;
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:59,代码来源:utlstring.cpp
示例7: V_UnqualifiedFileName
CUtlString CUtlString::StripFilename() const
{
const char *pFilename = V_UnqualifiedFileName( Get() ); // NOTE: returns 'Get()' on failure, never NULL
int nCharsToCopy = pFilename - Get();
CUtlString result;
result.SetDirect( Get(), nCharsToCopy );
result.StripTrailingSlash();
return result;
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:9,代码来源:utlstring.cpp
示例8: Replace
CUtlString CUtlString::Replace( char cFrom, char cTo )
{
CUtlString ret = *this;
int len = ret.Length();
for ( int i=0; i < len; i++ )
{
if ( ret.m_Storage[i] == cFrom )
ret.m_Storage[i] = cTo;
}
return ret;
}
开发者ID:Baer42,项目名称:source-sdk-2013,代码行数:12,代码来源:utlstring.cpp
示例9: GetBaseConditions
pfnConditionsMet CInstructor::GetBaseConditions(const CUtlString& sConditions)
{
if (sConditions == "WhoCares")
return WhoCaresConditions;
else if (sConditions == "ValidPlayer")
return ValidPlayerConditions;
else if (sConditions == "PlayerAlive")
return PlayerAliveConditions;
else if (sConditions == "PlayerDead")
return PlayerDeadConditions;
else if (sConditions == "PlayerCanReload")
return PlayerCanReloadConditions;
else if (sConditions == "PlayerOutOfAmmoAndMultipleWeapons")
return PlayerOutOfAmmoAndMultipleWeaponsConditions;
else if (sConditions == "PlayerHasMultipleWeapons")
return PlayerHasMultipleWeaponsConditions;
else if (sConditions == "PlayerActiveWeaponHasAimIn")
return PlayerActiveWeaponHasAimInConditions;
else if (sConditions == "PlayerHasGrenades")
return PlayerHasGrenadesConditions;
else if (sConditions == "PlayerHasSlowMo")
return PlayerHasSlowMoConditions;
else if (sConditions == "PlayerInThirdPerson")
return PlayerInThirdPersonConditions;
Assert(false);
Error(std::string("Couldn't find lesson condition '").append(sConditions.Get()).append("'\n").c_str());
return NULL;
}
开发者ID:jlwitthuhn,项目名称:DoubleAction,代码行数:30,代码来源:da_instructor.cpp
示例10: CUtlString
CUtlString CUtlString::Replace( char cFrom, char cTo ) const
{
if (!m_pString)
{
return CUtlString();
}
CUtlString ret = *this;
int len = ret.Length();
for ( int i=0; i < len; i++ )
{
if ( ret.m_pString[i] == cFrom )
ret.m_pString[i] = cTo;
}
return ret;
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:17,代码来源:utlstring.cpp
示例11: Q_strcmp
bool CUtlString::operator==( const CUtlString &src ) const
{
if ( IsEmpty() )
{
if ( src.IsEmpty() )
{
return true;
}
return false;
}
else
{
if ( src.IsEmpty() )
{
return false;
}
return Q_strcmp( m_pString, src.m_pString ) == 0;
}
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:21,代码来源:utlstring.cpp
示例12: CreateTempFile
static HANDLE CreateTempFile( CUtlString &WritePath, CUtlString &FileName )
{
char tempFileName[MAX_PATH];
if ( WritePath.IsEmpty() )
{
// use a safe name in the cwd
char *pBuffer = tmpnam( NULL );
if ( !pBuffer )
{
return INVALID_HANDLE_VALUE;
}
if ( pBuffer[0] == '\\' )
{
pBuffer++;
}
if ( pBuffer[strlen( pBuffer )-1] == '.' )
{
pBuffer[strlen( pBuffer )-1] = '\0';
}
V_snprintf( tempFileName, sizeof( tempFileName ), "_%s.tmp", pBuffer );
}
else
{
// generate safe name at the desired prefix
char uniqueFilename[MAX_PATH];
SYSTEMTIME sysTime; \
GetLocalTime( &sysTime );
sprintf( uniqueFilename, "%d_%d_%d_%d_%d.tmp", sysTime.wDay, sysTime.wHour, sysTime.wMinute, sysTime.wSecond, sysTime.wMilliseconds ); \
V_ComposeFileName( WritePath.String(), uniqueFilename, tempFileName, sizeof( tempFileName ) );
}
FileName = tempFileName;
HANDLE hFile = CreateFile( tempFileName, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );
return hFile;
}
开发者ID:AeroHand,项目名称:dota2-lua-engine,代码行数:36,代码来源:zip_utils.cpp
示例13: DisplayLesson
void CInstructor::DisplayLesson(const CUtlString& sLesson)
{
if (!lesson_enable.GetBool())
return;
if (!m_bActive)
return;
if (sLesson.Length() == 0 || m_apLessons.Find(sLesson) == -1)
{
int iLesson = m_apLessons.Find(m_sCurrentLesson);
if (m_apLessons[iLesson] && m_apLessons[iLesson]->m_bKillOnFinish)
SetActive(false);
HideLesson();
return;
}
HideLesson();
m_sCurrentLesson = sLesson;
m_sLastLesson = m_sCurrentLesson;
CLesson* pLesson = m_apLessons[m_apLessons.Find(sLesson)];
C_SDKPlayer *pLocalPlayer = C_SDKPlayer::GetLocalSDKPlayer();
if (pLesson->m_iLearningMethod == CLesson::LEARN_DISPLAYING)
pLocalPlayer->Instructor_LessonLearned(sLesson);
pLocalPlayer->Instructor_LessonShowed(sLesson);
int iLessonTrainings = pLocalPlayer->Instructor_GetLessonTrainings(sLesson);
if (pLesson->m_sSideHintText.Length() && iLessonTrainings == 0)
{
CHudElement* pLessonPanel = gHUD.FindElement("CHudSideHintPanel");
static_cast<CHudSideHintPanel*>(pLessonPanel)->SetLesson(pLesson);
m_bSideHintShowing = true;
}
else
{
CHudElement* pLessonPanel = gHUD.FindElement("CHudLessonPanel");
static_cast<CHudLessonPanel*>(pLessonPanel)->SetLesson(pLesson);
}
}
开发者ID:jlwitthuhn,项目名称:DoubleAction,代码行数:47,代码来源:da_instructor.cpp
示例14: OnTick
virtual void OnTick()
{
BaseClass::OnTick();
double ultotal = 0.0;
double ulnow = 0.0;
if ( YouTube_GetUploadProgress( m_uploadHandle, ultotal, ulnow ) == false )
{
Close();
ShowMessageBox( "#YouTube_Upload_Title", "#YouTube_Upload_Failure", "#GameUI_OK" );
}
else if ( YouTube_IsUploadFinished( m_uploadHandle ) )
{
bool bSuccess = true;
CUtlString strURLToVideo;
CUtlString strURLToVideoStats;
if ( YouTube_GetUploadResults( m_uploadHandle, bSuccess, strURLToVideo, strURLToVideoStats ) && bSuccess )
{
// mark movie uploaded
m_pMovie->SetUploaded( true );
m_pMovie->SetUploadURL( strURLToVideoStats.Get() );
g_pReplayMovieManager->FlagMovieForFlush( m_pMovie, true );
// update the UI
CReplayDetailsPanel *pDetailsPanel = dynamic_cast< CReplayDetailsPanel *>( GetParent() );
if ( pDetailsPanel )
{
pDetailsPanel->InvalidateLayout( true, false );
}
ShowMessageBox( "#YouTube_Upload_Title", "#YouTube_Upload_Success", "#GameUI_OK", NULL, GetParent() );
// notify the GC
uint64 uSessionId = g_pClientReplayContext->GetServerSessionId( m_pMovie->GetReplayHandle() );
if ( uSessionId != 0 )
{
GCSDK::CProtoBufMsg< CMsgReplayUploadedToYouTube > msg( k_EMsgGCReplay_UploadedToYouTube );
msg.Body().set_youtube_url( strURLToVideoStats.Get() );
msg.Body().set_youtube_account_name( YouTube_GetLoginName() );
msg.Body().set_session_id( uSessionId );
GCClientSystem()->BSendMessage( msg );
}
surface()->PlaySound( "replay\\youtube_uploadfinished.wav" );
UploadOgsData( m_pMovie, true, "completed" );
// share on Steam Community
if ( steamapicontext && steamapicontext->SteamRemoteStorage() )
{
CUtlString strPreviewFileName;
AppId_t nConsumerAppId = steamapicontext->SteamUtils()->GetAppID();
ERemoteStoragePublishedFileVisibility eVisibility = k_ERemoteStoragePublishedFileVisibilityPublic;
SteamParamStringArray_t tags;
tags.m_ppStrings = NULL;
tags.m_nNumStrings = 0;
// don't bother waiting for result
SteamAPICall_t hSteamAPICall = steamapicontext->SteamRemoteStorage()->PublishVideo(
k_EWorkshopVideoProviderNone, "",
strURLToVideo.Get(),
strPreviewFileName.Get(),
nConsumerAppId,
m_strTitle.Get(),
m_strDescription.Get(),
eVisibility,
&tags
);
hSteamAPICall;
}
}
else
{
ShowMessageBox( "#YouTube_Upload_Title", "#YouTube_Upload_Failure", "#GameUI_OK" );
surface()->PlaySound( "replay\\youtube_uploadfailed.wav" );
UploadOgsData( m_pMovie, true, "failed" );
}
// close wait dialog
YouTube_ClearUploadResults( m_uploadHandle );
Close();
}
else
{
float flProgress = MIN( ulnow / MAX( ultotal, 1.0 ), 1.0f );
int iProgress = int( 100.0 * flProgress );
int ulnow_kb = uint32( ulnow / 1024 );
int ultotal_kb = uint32( ultotal / 1024 );
if ( ulnow_kb == ultotal_kb )
{
// we tick at 500 ms, so this should be ok
m_iTick = ( m_iTick + 1 ) % 4;
switch ( m_iTick )
{
case 0: SetDialogVariable( "duration", g_pVGuiLocalize->Find( "YouTube_UploadFinishing1" ) ); break;
case 1: SetDialogVariable( "duration", g_pVGuiLocalize->Find( "YouTube_UploadFinishing2" ) ); break;
case 2: SetDialogVariable( "duration", g_pVGuiLocalize->Find( "YouTube_UploadFinishing3" ) ); break;
case 3: SetDialogVariable( "duration", g_pVGuiLocalize->Find( "YouTube_UploadFinishing4" ) ); break;
}
}
//.........这里部分代码省略.........
开发者ID:hekar,项目名称:luminousforts-2013,代码行数:101,代码来源:replayyoutubeapi.cpp
示例15: GetToken
//.........这里部分代码省略.........
}
// copy token to buffer
token_p = token;
if (*script->script_p == '"')
{
// quoted token
script->script_p++;
while (*script->script_p != '"')
{
*token_p++ = *script->script_p++;
if (script->script_p == script->end_p)
break;
if (token_p == &token[MAXTOKEN])
Error ("Token too large on line %i\n",scriptline);
}
script->script_p++;
}
else if ( g_bCheckSingleCharTokens && !g_sSingleCharTokens.IsEmpty() && strchr( g_sSingleCharTokens.String(), *script->script_p ) != NULL )
{
*token_p++ = *script->script_p++;
}
else // regular token
while ( *script->script_p > 32 && *script->script_p != ';')
{
if ( !ExpandMacroToken( token_p ) )
{
if ( !ExpandVariableToken( token_p ) )
{
*token_p++ = *script->script_p++;
if (script->script_p == script->end_p)
break;
if (token_p == &token[MAXTOKEN])
Error ("Token too large on line %i\n",scriptline);
}
}
}
// add null to end of token
*token_p = 0;
// check for other commands
if ( !stricmp( token, "$include" ) )
{
GetToken( false );
bool bFallbackToToken = true;
CUtlVector< CUtlString > expandedPathList;
if ( CmdLib_ExpandWithBasePaths( expandedPathList, token ) > 0 )
{
for ( int i = 0; i < expandedPathList.Count(); ++i )
{
CUtlVector< CUtlString > findFileList;
FindFileAbsoluteList( findFileList, expandedPathList[i].String() );
if ( findFileList.Count() > 0 )
{
bFallbackToToken = false;
// Only add the first set of glob matches from the first base path
for ( int j = 0; j < findFileList.Count(); ++j )
{
AddScriptToStack( const_cast< char * >( findFileList[j].String() ) );
}
break;
}
}
}
if ( bFallbackToToken )
{
AddScriptToStack( token );
}
return GetToken( crossline );
}
else if (!stricmp (token, "$definemacro"))
{
GetToken (false);
DefineMacro(token);
return GetToken (crossline);
}
else if (!stricmp (token, "$definevariable"))
{
GetToken (false);
DefineVariable(token);
return GetToken (crossline);
}
else if (AddMacroToStack( token ))
{
return GetToken (crossline);
}
return true;
}
开发者ID:Baer42,项目名称:source-sdk-2013,代码行数:101,代码来源:scriplib.cpp
示例16: ModelNamesLessFunc
static bool ModelNamesLessFunc( CUtlString const &pLHS, CUtlString const &pRHS )
{
return CaselessStringLessThan( pLHS.Get(), pRHS.Get() );
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:4,代码来源:MakeModels.cpp
示例17: MatchesPattern
bool CUtlString::MatchesPattern( const CUtlString &Pattern, int nFlags )
{
const char *pszSource = String();
const char *pszPattern = Pattern.String();
bool bExact = true;
while( 1 )
{
if ( ( *pszPattern ) == 0 )
{
return ( (*pszSource ) == 0 );
}
if ( ( *pszPattern ) == '*' )
{
pszPattern++;
if ( ( *pszPattern ) == 0 )
{
return true;
}
bExact = false;
continue;
}
int nLength = 0;
while( ( *pszPattern ) != '*' && ( *pszPattern ) != 0 )
{
nLength++;
pszPattern++;
}
while( 1 )
{
const char *pszStartPattern = pszPattern - nLength;
const char *pszSearch = pszSource;
for( int i = 0; i < nLength; i++, pszSearch++, pszStartPattern++ )
{
if ( ( *pszSearch ) == 0 )
{
return false;
}
if ( ( *pszSearch ) != ( *pszStartPattern ) )
{
break;
}
}
if ( pszSearch - pszSource == nLength )
{
break;
}
if ( bExact == true )
{
return false;
}
if ( ( nFlags & PATTERN_DIRECTORY ) != 0 )
{
if ( ( *pszPattern ) != '/' && ( *pszSource ) == '/' )
{
return false;
}
}
pszSource++;
}
pszSource += nLength;
}
}
开发者ID:Baer42,项目名称:source-sdk-2013,代码行数:76,代码来源:utlstring.cpp
示例18:
CUtlString::CUtlString( const CUtlString& string )
{
Set( string.Get() );
}
开发者ID:Baer42,项目名称:source-sdk-2013,代码行数:4,代码来源:utlstring.cpp
示例19: Serialize
//-----------------------------------------------------------------------------
// String attribute
//-----------------------------------------------------------------------------
bool Serialize( CUtlBuffer &buf, const CUtlString &src )
{
buf.PutDelimitedString( s_pConv, src.Get() );
return buf.IsValid();
}
开发者ID:Cre3per,项目名称:hl2sdk-csgo,代码行数:8,代码来源:utlbufferutil.cpp
示例20: lua_open
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
void CDmxEditApp::PrintHelp( bool bWiki /* = false */ )
{
const CDmxEditLua::LuaFunc_s *pLuaFuncs = CDmxEditLua::GetFunctionList();
if ( bWiki && pLuaFuncs )
{
lua_State *pLuaState = lua_open();
if ( pLuaState )
{
luaL_openlibs( pLuaState );
CUtlString wikiString;
for ( int i = 0; i < CDmxEditLua::FunctionCount(); ++i )
{
if ( i != 0 )
{
Msg( "\n" );
}
Msg( ";%s( %s );\n", pLuaFuncs[ i ].m_pFuncName, pLuaFuncs[ i ].m_pFuncPrototype );
Msg( ":%s\n", Wikize( pLuaState, pLuaFuncs[ i ].m_pFuncDesc ) );
}
return;
}
}
Msg( "\n" );
Msg( "NAME\n" );
Msg( " dmxedit - Edit dmx files\n" );
Msg( "\n" );
Msg( "SYNOPSIS\n" );
Msg( " dmxedit [ -h | -help ] [ -game <$game> ] [ -set $var=val ] [ script.lua ]\n" );
Msg( "\n" );
Msg( " -h | -help : Prints this information\n" );
Msg( " -g | -game <$game> : Sets the VPROJECT environment variable to the specified game.\n" );
Msg( " -s | -set <$var=val> : Sets the lua variable var to the specified val before the script is run.\n" );
Msg( "\n" );
Msg( "DESCRIPTION\n" );
Msg( " Edits dmx files by executing a lua script of dmx editing functions\n" );
Msg( "\n" );
if ( !pLuaFuncs )
return;
Msg( "FUNCTIONS\n" );
const char *pWhitespace = " \t";
for ( int i = 0; i < CDmxEditLua::FunctionCount(); ++i )
{
Msg( " %s( %s );\n", pLuaFuncs[ i ].m_pFuncName, pLuaFuncs[ i ].m_pFuncPrototype );
Msg( " * " );
CUtlString tmpStr;
const char *pWordBegin = pLuaFuncs[ i ].m_pFuncDesc + strspn( pLuaFuncs[ i ].m_pFuncDesc, pWhitespace );
const char *pWhiteSpaceBegin = pWordBegin;
const char *pWordEnd = pWordBegin + strcspn( pWordBegin, pWhitespace );
bool bNewline = false;
while ( *pWordBegin )
{
if ( pWordEnd - pWhiteSpaceBegin + tmpStr.Length() > 70 )
{
if ( bNewline )
{
Msg( " " );
}
else
{
bNewline = true;
}
Msg( "%s\n", tmpStr );
tmpStr.Set( "" );
}
if ( tmpStr.Length() )
{
tmpStr += CUtlString( pWhiteSpaceBegin, pWordEnd - pWhiteSpaceBegin + 1);
}
else
{
tmpStr += CUtlString( pWordBegin, pWordEnd - pWordBegin + 1 );
}
pWhiteSpaceBegin = pWordEnd;
pWordBegin = pWhiteSpaceBegin + strspn( pWhiteSpaceBegin, pWhitespace );
pWordEnd = pWordBegin + strcspn( pWordBegin, pWhitespace );
}
if ( tmpStr.Length() )
{
if ( bNewline )
{
Msg( " " );
}
//.........这里部分代码省略.........
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:101,代码来源:luamain.cpp
注:本文中的CUtlString类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论