OpenClonk
StdStrBuf Class Reference

#include <StdBuf.h>

Inheritance diagram for StdStrBuf:
[legend]
Collaboration diagram for StdStrBuf:
[legend]

Public Member Functions

 StdStrBuf ()=default
 
 StdStrBuf (StdStrBuf &Buf2, bool fCopy=false)
 
 StdStrBuf (const StdStrBuf &Buf2, bool fCopy=true)
 
 StdStrBuf (StdStrBuf &&Buf2) noexcept
 
 StdStrBuf (const char *pData, bool fCopy=false)
 
 StdStrBuf (const char *pData, long int iLength)
 
 StdStrBuf (const char *pData, size_t iLength, bool fCopy=false)
 
bool isNull () const
 
const char * getData () const
 
char * getMData ()
 
size_t getSize () const
 
size_t getLength () const
 
bool isRef () const
 
const char * getPtr (size_t i) const
 
char * getMPtr (size_t i)
 
char operator[] (size_t i) const
 
void Ref (const char *pnData)
 
void Ref (const char *pnData, size_t iLength)
 
void Take (char *pnData)
 
void Take (char *pnData, size_t iLength)
 
char * GrabPointer ()
 
void Ref (const StdStrBuf &Buf2)
 
StdStrBuf getRef () const
 
void Take (StdStrBuf &Buf2)
 
void Take (StdStrBuf &&Buf2)
 
void Clear ()
 
void Copy ()
 
void Copy (const char *pnData)
 
void Copy (const StdStrBuf &Buf2)
 
StdStrBuf Duplicate () const
 
void Move (size_t iFrom, size_t inSize, size_t iTo=0)
 
int Compare (const StdStrBuf &Buf2, size_t iAt=0) const
 
int Compare_ (const char *pCData, size_t iAt=0) const
 
bool BeginsWith (const char *beginning) const
 
void Grow (size_t iGrow)
 
void Shrink (size_t iShrink)
 
void SetLength (size_t iLength)
 
void Append (const char *pnData, size_t iChars)
 
void Append (const char *pnData)
 
void Append (const StdStrBuf &Buf2)
 
void Copy (const char *pnData, size_t iChars)
 
bool LoadFromFile (const char *szFile)
 
bool SaveToFile (const char *szFile) const
 
bool operator! () const
 
StdStrBufoperator+= (const StdStrBuf &Buf2)
 
StdStrBufoperator+= (const char *szString)
 
StdStrBuf operator+ (const StdStrBuf &Buf2) const
 
StdStrBuf operator+ (const char *szString) const
 
StdStrBuf operator+ (char c) const
 
bool operator== (const StdStrBuf &Buf2) const
 
bool operator!= (const StdStrBuf &Buf2) const
 
bool operator== (const char *szString) const
 
bool operator!= (const char *szString) const
 
StdStrBufoperator= (const StdStrBuf &Buf2)
 
StdStrBufoperator= (const char *szString)
 
 operator const void * () const
 
bool operator< (const StdStrBuf &v2) const
 
void AppendChars (char cChar, size_t iCnt)
 
void AppendChar (char cChar)
 
void AppendCharacter (uint32_t unicodechar)
 
void AppendBackslash ()
 
void InsertChar (char cChar, size_t insert_before)
 
void AppendUntil (const char *szString, char cUntil)
 
void CopyUntil (const char *szString, char cUntil)
 
bool SplitAtChar (char cSplit, StdStrBuf *psSplit)
 
void Format (const char *szFmt,...) GNUC_FORMAT_ATTRIBUTE_O
 
void FormatV (const char *szFmt, va_list args)
 
void AppendFormat (const char *szFmt,...) GNUC_FORMAT_ATTRIBUTE_O
 
void AppendFormatV (const char *szFmt, va_list args)
 
StdStrBuf copyPart (size_t iStart, size_t inSize) const
 
int Replace (const char *szOld, const char *szNew, size_t iStartSearch=0)
 
int ReplaceChar (char cOld, char cNew)
 
void ReplaceEnd (size_t iPos, const char *szNewEnd)
 
bool GetSection (size_t idx, StdStrBuf *psOutSection, char cSeparator=';') const
 
bool EnsureUnicode ()
 
void ToLowerCase ()
 
bool ValidateChars (const char *szInitialChars, const char *szMidChars)
 
int GetHash () const
 
void EscapeString ()
 
bool TrimSpaces ()
 
void CompileFunc (class StdCompiler *pComp, int iRawType=0)
 

Protected Member Functions

StdBuf getPart (size_t iStart, size_t inSize) const
 
void Ref (const void *pnData, size_t inSize)
 
void Ref (const StdBuf &Buf2)
 
void Take (void *pnData, size_t inSize)
 
void Take (StdBuf &Buf2)
 
void Take (StdBuf &&Buf2)
 
void New (size_t inSize)
 
void Write (const void *pnData, size_t inSize, size_t iAt=0)
 
void Write (const StdBuf &Buf2, size_t iAt=0)
 
int Compare (const void *pCData, size_t iCSize, size_t iAt=0) const
 
int Compare (const StdBuf &Buf2, size_t iAt=0) const
 
void SetSize (size_t inSize)
 
void Copy (size_t inSize)
 
void Copy (const void *pnData, size_t inSize)
 
void Copy (const StdBuf &Buf2)
 
void Append (const void *pnData, size_t inSize)
 
void Append (const StdBuf &Buf2)
 
StdBuf operator+= (const StdBuf &Buf2)
 
StdBuf operator+ (const StdBuf &Buf2) const
 
bool operator== (const StdBuf &Buf2) const
 
bool operator!= (const StdBuf &Buf2) const
 

Static Protected Member Functions

static void DeletePointer (void *data)
 

Protected Attributes

bool fRef = true
 
union {
const void * pData = nullptr
 
void * pMData
 
}; 
 
unsigned int iSize = 0
 

Detailed Description

Definition at line 384 of file StdBuf.h.

Constructor & Destructor Documentation

◆ StdStrBuf() [1/7]

StdStrBuf::StdStrBuf ( )
default

Referenced by copyPart(), getRef(), and operator==().

Here is the caller graph for this function:

◆ StdStrBuf() [2/7]

StdStrBuf::StdStrBuf ( StdStrBuf Buf2,
bool  fCopy = false 
)
inline

Definition at line 397 of file StdBuf.h.

399  : StdBuf(Buf2, fCopy)
400  { }
StdBuf()=default

◆ StdStrBuf() [3/7]

StdStrBuf::StdStrBuf ( const StdStrBuf Buf2,
bool  fCopy = true 
)
inline

Definition at line 404 of file StdBuf.h.

405  : StdBuf(Buf2, fCopy)
406  { }

◆ StdStrBuf() [4/7]

StdStrBuf::StdStrBuf ( StdStrBuf &&  Buf2)
inlinenoexcept

Definition at line 407 of file StdBuf.h.

408  : StdBuf(std::move(Buf2))
409  { }

◆ StdStrBuf() [5/7]

StdStrBuf::StdStrBuf ( const char *  pData,
bool  fCopy = false 
)
inlineexplicit

Definition at line 412 of file StdBuf.h.

413  : StdBuf(pData, pData ? strlen(pData) + 1 : 0, fCopy)
414  { }

◆ StdStrBuf() [6/7]

StdStrBuf::StdStrBuf ( const char *  pData,
long int  iLength 
)
inline

Definition at line 430 of file StdBuf.h.

431  : StdBuf(pData, pData ? iLength + 1 : 0, false)
432  { }

◆ StdStrBuf() [7/7]

StdStrBuf::StdStrBuf ( const char *  pData,
size_t  iLength,
bool  fCopy = false 
)
inline

Definition at line 433 of file StdBuf.h.

434  : StdBuf(pData, pData ? iLength + 1 : 0, fCopy)
435  { }

Member Function Documentation

◆ Append() [1/5]

void StdStrBuf::Append ( const char *  pnData)
inline

Definition at line 524 of file StdBuf.h.

525  {
526  Append(pnData, std::strlen(pnData));
527  }
void Append(const char *pnData, size_t iChars)
Definition: StdBuf.h:519

References Append().

Here is the call graph for this function:

◆ Append() [2/5]

void StdStrBuf::Append ( const char *  pnData,
size_t  iChars 
)
inline

Definition at line 519 of file StdBuf.h.

520  {
521  Grow(iChars);
522  Write(pnData, iChars, iSize - iChars - 1);
523  }
void Write(const void *pnData, size_t inSize, size_t iAt=0)
Definition: StdBuf.h:153
unsigned int iSize
Definition: StdBuf.h:92
void Grow(size_t iGrow)
Definition: StdBuf.h:498

References Grow(), StdBuf::iSize, and StdBuf::Write().

Referenced by C4DefGraphicsPtrBackup::Add(), C4RoundResultsPlayer::AddCustomEvaluationString(), C4RoundResults::AddCustomEvaluationString(), C4ScenarioParameters::AddFilename2ID(), Append(), C4PropList::AppendDataString(), AppendFormatV(), AppendUntil(), StdCompilerINIWrite::Boolean(), CStdFont::BreakMessage(), C4AulParseError::C4AulParseError(), C4Playback::Check(), C4StartupPlrSelDlg::CheckPlayerName(), C4Network2IRCClient::Close(), C4DrawTransform::CompileFunc(), Copy(), C4ComponentHost::CopyFilePathFromGroup(), DefaultExtension(), C4DownloadDlg::DownloadFile(), C4Object::Draw(), C4Network2::DrawStatus(), EnforceExtension(), EnsureUnicode(), C4Console::FileSaveAs(), C4PlayerInfoList::GetActivePlayerNames(), C4ClientList::GetAllClientNames(), C4Object::GetDataString(), C4PropListStatic::GetDataString(), C4StartupPlrSelDlg::PlayerListItem::GetDelWarning(), C4AulFunc::GetFullName(), C4GameParameters::GetGameGoalString(), C4Object::GetInfoString(), C4PlayerControlAssignment::GetKeysAsString(), C4SDefinitions::GetModules(), C4ObjectList::GetNameList(), C4Team::GetNameWithParticipants(), C4FileSelDlg::GetSelection(), C4Reloc::Init(), C4SoundModifierList::Init(), C4MusicSystem::InitForScenario(), C4PlayerInfoCore::Load(), C4SoundSystem::LoadEffects(), StdMeshLoader::LoadMeshBinary(), StdMeshLoader::LoadMeshXml(), LogFatal(), StdMeshSkeletonLoader::MakeFullSkeletonPath(), C4StartupPlrSelDlg::PlayerListItem::MoveFilename(), StdCompilerINIWrite::NameEnd(), C4StartupPlrSelDlg::OnDelBtnConfirm(), C4Network2::OpenVoteDialog(), operator+(), operator+=(), C4Application::ParseCommandLine(), C4Console::PlayerJoin(), StdCompilerINIWrite::PutName(), StdCompilerINIWrite::Raw(), C4AulScriptContext::ReturnDump(), C4Playback::ReWriteText(), C4PlayerInfoCore::Save(), C4GameSave::SaveDesc(), C4TextureMap::SaveMap(), C4Network2Res::SetByCore(), C4StartupNetListEntry::SetReference(), StdCompilerINIWrite::StringN(), C4PropList::ToJSON(), C4Value::ToJSON(), C4KeyCodeEx::ToString(), C4Network2ClientDlg::UpdateText(), C4InVal::ValidateString(), C4AulUserFile::Write(), C4GameSave::WriteDescDefinitions(), C4GameSave::WriteDescLineFeed(), C4GameSave::WriteDescNetworkClients(), C4GameSave::WriteDescPlayers(), and StdCompilerINIWrite::WriteEscaped().

Here is the call graph for this function:

◆ Append() [3/5]

void StdBuf::Append ( const StdBuf Buf2)
inlineinherited

Definition at line 260 of file StdBuf.h.

261  {
262  Append(Buf2.getData(), Buf2.getSize());
263  }
size_t getSize() const
Definition: StdBuf.h:101
const void * getData() const
Definition: StdBuf.h:99
void Append(const void *pnData, size_t inSize)
Definition: StdBuf.h:254

References StdBuf::Append(), StdBuf::getData(), and StdBuf::getSize().

Here is the call graph for this function:

◆ Append() [4/5]

void StdStrBuf::Append ( const StdStrBuf Buf2)
inline

Definition at line 528 of file StdBuf.h.

529  {
530  Append(Buf2.getData(), Buf2.getLength());
531  }
const char * getData() const
Definition: StdBuf.h:442
size_t getLength() const
Definition: StdBuf.h:445

References Append(), getData(), and getLength().

Here is the call graph for this function:

◆ Append() [5/5]

void StdBuf::Append ( const void *  pnData,
size_t  inSize 
)
inlineinherited

Definition at line 254 of file StdBuf.h.

255  {
256  Grow(inSize);
257  Write(pnData, inSize, iSize - inSize);
258  }
void Grow(size_t iGrow)
Definition: StdBuf.h:171

References StdBuf::Grow(), StdBuf::iSize, and StdBuf::Write().

Referenced by StdBuf::Append(), StdBuf::operator+(), StdBuf::operator+=(), C4Network2RefServer::PackPacket(), C4Playback::ReadBinary(), and CStdFile::SaveBuffer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AppendBackslash()

void StdStrBuf::AppendBackslash ( )

Definition at line 248 of file StdBuf.cpp.

249 {
250  if(getLength() && *getPtr(getLength() - 1) == DirectorySeparator) return;
252 }
#define DirectorySeparator
void AppendChar(char cChar)
Definition: StdBuf.h:588
const char * getPtr(size_t i) const
Definition: StdBuf.h:448

References AppendChar(), DirectorySeparator, getLength(), and getPtr().

Referenced by C4ComponentHost::CopyFilePathFromGroup(), C4ConfigGeneral::DeterminePaths(), C4Reloc::Init(), StdMeshSkeletonLoader::MakeFullSkeletonPath(), and C4Console::PlayerJoin().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AppendChar()

◆ AppendCharacter()

void StdStrBuf::AppendCharacter ( uint32_t  unicodechar)

Definition at line 392 of file StdBuf.cpp.

393 {
394  if (unicodechar < 0x80)
395  AppendChar(unicodechar);
396  else if (unicodechar < 0x800)
397  {
398  Grow(2);
399  *getMPtr(getLength() - 2) = (0xC0 | (unicodechar >> 6));
400  *getMPtr(getLength() - 1) = (0x80 | (unicodechar & 0x3F));
401  }
402  else if (unicodechar < 0x10000)
403  {
404  Grow(3);
405  *getMPtr(getLength() - 3) = (0xE0 | (unicodechar >> 12));
406  *getMPtr(getLength() - 2) = (0x80 | ((unicodechar >> 6) & 0x3F));
407  *getMPtr(getLength() - 1) = (0x80 | (unicodechar & 0x3F));
408  }
409  else if (unicodechar < 0x110000)
410  {
411  Grow(4);
412  *getMPtr(getLength() - 4) = (0xF0 | (unicodechar >> 18));
413  *getMPtr(getLength() - 3) = (0x80 | ((unicodechar >> 12) & 0x3F));
414  *getMPtr(getLength() - 2) = (0x80 | ((unicodechar >> 6) & 0x3F));
415  *getMPtr(getLength() - 1) = (0x80 | (unicodechar & 0x3F));
416  }
417  else /* not an unicode code point, ignore */ {}
418 }
char * getMPtr(size_t i)
Definition: StdBuf.h:449

References AppendChar(), getLength(), getMPtr(), and Grow().

Here is the call graph for this function:

◆ AppendChars()

void StdStrBuf::AppendChars ( char  cChar,
size_t  iCnt 
)
inline

Definition at line 582 of file StdBuf.h.

583  {
584  Grow(iCnt);
585  for (size_t i = getLength() - iCnt; i < getLength(); i++)
586  *getMPtr(i) = cChar;
587  }
int iCnt
Definition: TstC4NetIO.cpp:32

References getLength(), getMPtr(), Grow(), and iCnt.

Referenced by AppendChar(), C4GUI::Edit::DrawElement(), C4RankSystem::Init(), and StdCompilerINIWrite::WriteIndent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AppendFormat()

void StdStrBuf::AppendFormat ( const char *  szFmt,
  ... 
)

Definition at line 190 of file StdBuf.cpp.

191 {
192  // Create argument list
193  va_list args; va_start(args, szFmt);
194  // Format
195  AppendFormatV(szFmt, args);
196 }
void AppendFormatV(const char *szFmt, va_list args)
Definition: StdBuf.cpp:198

References AppendFormatV().

Referenced by C4GameMessage::Append(), StdCompilerINIWrite::Byte(), C4AulParseError::C4AulParseError(), StdCompilerINIWrite::Character(), C4Object::Draw(), C4Network2::DrawStatus(), StdCompilerINIWrite::DWord(), C4GUI::ExpandHotkeyMarkup(), C4Object::GetDataString(), GetDbgRecPktData(), C4ObjectList::GetNameList(), C4SoundModifierList::Init(), C4UpdatePackage::MkUp(), StdCompilerINIWrite::PutName(), C4AulScriptContext::ReturnDump(), C4TextureMap::SaveMap(), C4Record::Start(), C4Network2::StreamOut(), C4Network2ClientDlg::UpdateText(), C4ScriptHost::Warn(), StdCompilerINIWrite::Word(), C4GameSave::WriteDescDate(), C4GameSave::WriteDescEngine(), C4GameSave::WriteDescGameTime(), C4GameSave::WriteDescLeague(), C4GameSave::WriteDescPlayers(), and StdCompilerINIWrite::WriteEscaped().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AppendFormatV()

void StdStrBuf::AppendFormatV ( const char *  szFmt,
va_list  args 
)

Definition at line 198 of file StdBuf.cpp.

199 {
200 #ifdef HAVE_VASPRINTF
201  // Format
202  char *pStr; int iBytes = vasprintf(&pStr, szFmt, args);
203  if (iBytes < 0 || !pStr) return;
204  // Append
205  if (isNull())
206  Take(pStr, iBytes);
207  else
208  {
209  Append(pStr, iBytes);
210  free(pStr);
211  }
212 #elif defined(HAVE_VSCPRINTF)
213  // Save append start
214  int iStart = getLength();
215  // Calculate size, allocate
216  int iLength = vscprintf(szFmt, args);
217  Grow(iLength);
218  // Format
219  char *pPos = getMElem<char>(*this, iSize - iLength - 1);
220  vsprintf(getMPtr(iStart), szFmt, args);
221 #else
222  // Save append start
223  int iStart = getLength(), iBytes;
224  do
225  {
226  // Grow
227  Grow(512);
228  // Try output
229  va_list args_copy;
230  #ifdef va_copy
231  va_copy(args_copy, args);
232  #else
233  args_copy = args;
234  #endif
235  iBytes = vsnprintf(getMPtr(iStart), getLength() - iStart, szFmt, args_copy);
236  #ifdef va_copy
237  va_end(args_copy);
238  #endif
239  }
240  while (iBytes < 0 || (unsigned int)(iBytes) >= getLength() - iStart);
241  // Calculate real length, if vsnprintf didn't return anything of value
242  iBytes = strlen(getMPtr(iStart));
243  // Shrink to fit
244  SetSize(iStart + iBytes + 1);
245 #endif
246 }
void SetSize(size_t inSize)
Definition: StdBuf.h:204
bool isNull() const
Definition: StdBuf.h:441
void Take(char *pnData)
Definition: StdBuf.h:457

References Append(), getLength(), getMPtr(), Grow(), StdBuf::iSize, isNull(), StdBuf::SetSize(), and Take().

Referenced by AppendFormat(), and FormatV().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AppendUntil()

void StdStrBuf::AppendUntil ( const char *  szString,
char  cUntil 
)
inline

Definition at line 604 of file StdBuf.h.

605  {
606  const char *pPos = std::strchr(szString, cUntil);
607  if (pPos)
608  Append(szString, pPos - szString);
609  else
610  Append(szString);
611  }

References Append().

Referenced by CopyUntil().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ BeginsWith()

bool StdStrBuf::BeginsWith ( const char *  beginning) const
inline

Definition at line 489 of file StdBuf.h.

490  {
491  // Return whether string starts with beginning
492  return strncmp((const char
493  *)pData, beginning, strlen(beginning)) == 0;
494  }

◆ Clear()

void StdStrBuf::Clear ( )
inline

Definition at line 466 of file StdBuf.h.

466 { StdBuf::Clear(); }
void Clear()
Definition: StdBuf.h:190

References StdBuf::Clear().

Referenced by StdMeshMaterialParserCtx::Advance(), StdCompilerINIWrite::Begin(), CStdFont::BreakMessage(), C4ComponentHost::Clear(), C4GameRes::Clear(), C4GameParameters::Clear(), C4PlayerInfo::Clear(), C4RoundResults::Clear(), C4Team::Clear(), C4TeamList::Clear(), C4PropertyPath::Clear(), C4Game::Clear(), C4StartupModsListEntry::Clear(), C4MaterialCore::Clear(), C4ParticleDef::Clear(), C4TexMapEntry::Clear(), C4HTTPClient::Clear(), C4Network2::Clear(), C4Network2ResCore::Clear(), C4ScriptHost::Clear(), C4Player::ClearControl(), C4StartupNetListEntry::ClearRef(), C4Game::CloseScenario(), C4Object::CompileFunc(), Copy(), CopyUntil(), C4Game::Default(), C4Menu::Default(), C4MouseControl::Default(), C4SHead::Default(), C4Object::Default(), C4ObjectInfoCore::Default(), C4PlayerInfoCore::Default(), C4Player::DefaultRuntimeData(), C4Network2::DeinitLeague(), C4PlayerInfo::DeleteTempFile(), C4RoundResults::EvaluateNetwork(), C4StartupNetListEntry::Execute(), C4StdInProc::Execute(), FormatV(), GetLogSection(), GetSection(), C4Network2::InitLeague(), C4Network2::LeagueStart(), C4FileSelDlg::ListItem::ListItem(), C4Config::Load(), C4ScriptHost::LoadData(), C4Def::LoadDefCore(), C4Group::LoadEntryString(), C4ScriptHost::MakeScript(), C4MouseControl::Move(), C4ChatControl::OnConnectBtn(), C4HTTPClient::Query(), C4LangStringTable::ReplaceStrings(), C4HTTPClient::ResetError(), C4NetIO::ResetError(), ResetFatalError(), C4StartupOptionsDlg::SaveConfig(), C4PlayerInfo::SetForcedName(), C4PlayerInfo::SetLeagueProgressData(), C4Network2::SetPassword(), C4StartupNetListEntry::SetRefQuery(), C4Startup::SetStartScreen(), C4GUI::GroupBox::SetTitle(), C4GUI::Element::SetToolTip(), C4LeagueSignupDialog::ShowModal(), C4KeyCodeEx::ToString(), TrimSpaces(), C4ObjectInfoCore::UpdateCustomRanks(), and C4InVal::ValidateString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Compare() [1/3]

int StdBuf::Compare ( const StdBuf Buf2,
size_t  iAt = 0 
) const
inlineinherited

Definition at line 219 of file StdBuf.h.

220  {
221  return Compare(Buf2.getData(), Buf2.getSize(), iAt);
222  }
int Compare(const void *pCData, size_t iCSize, size_t iAt=0) const
Definition: StdBuf.h:165

References StdBuf::Compare(), StdBuf::getData(), and StdBuf::getSize().

Here is the call graph for this function:

◆ Compare() [2/3]

int StdStrBuf::Compare ( const StdStrBuf Buf2,
size_t  iAt = 0 
) const
inline

Definition at line 474 of file StdBuf.h.

475  {
476  assert(iAt <= getLength());
477  const int result = StdBuf::Compare(Buf2.getData(), std::min(getLength() - iAt, Buf2.getLength()), iAt);
478  if (result) return result;
479 
480  if (getLength() < Buf2.getLength() + iAt) return -1;
481  else if (getLength() > Buf2.getLength() + iAt) return 1;
482  return 0;
483  }

References StdBuf::Compare(), getData(), and getLength().

Referenced by Compare_(), and operator==().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Compare() [3/3]

int StdBuf::Compare ( const void *  pCData,
size_t  iCSize,
size_t  iAt = 0 
) const
inlineinherited

Definition at line 165 of file StdBuf.h.

166  {
167  assert(iAt + iCSize <= getSize());
168  return std::memcmp(getPtr(iAt), pCData, iCSize);
169  }
const void * getPtr(size_t i) const
Definition: StdBuf.h:104

References StdBuf::getPtr(), and StdBuf::getSize().

Referenced by StdBuf::Compare(), Compare(), C4NetIOUDP::DoLoopbackTest(), and StdBuf::operator==().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Compare_()

int StdStrBuf::Compare_ ( const char *  pCData,
size_t  iAt = 0 
) const
inline

Definition at line 484 of file StdBuf.h.

485  {
486  StdStrBuf str(pCData); // GCC needs this, for some obscure reason
487  return Compare(str, iAt);
488  }
int Compare(const StdStrBuf &Buf2, size_t iAt=0) const
Definition: StdBuf.h:474

References Compare().

Referenced by StdMeshSkeleton::MirrorAnimation().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CompileFunc()

void StdStrBuf::CompileFunc ( class StdCompiler pComp,
int  iRawType = 0 
)

Definition at line 254 of file StdBuf.cpp.

255 {
256  if (pComp->isDeserializer())
257  {
258  char *pnData;
259  pComp->String(&pnData, StdCompiler::RawCompileType(iRawType));
260  Take(pnData);
261  }
262  else
263  {
264  char *pData = const_cast<char *>(getData());
265  if (!pData) pData = const_cast<char *>("");
266  pComp->String(&pData, StdCompiler::RawCompileType(iRawType));
267  }
268 }

References getData(), StdCompiler::isDeserializer(), StdCompiler::String(), and Take().

Here is the call graph for this function:

◆ Copy() [1/7]

void StdStrBuf::Copy ( )
inline

Definition at line 467 of file StdBuf.h.

467 { StdBuf::Copy(); }
void Copy()
Definition: StdBuf.h:233

References StdBuf::Copy().

Referenced by C4DefGraphicsPtrBackup::Add(), C4TextureMap::AddTexture(), StdMeshMaterialParserCtx::Advance(), C4AulExecError::C4AulExecError(), C4AulParseError::C4AulParseError(), C4ControlJoinPlayer::C4ControlJoinPlayer(), C4CustomKey::C4CustomKey(), C4DefinitionSelDlg::C4DefinitionSelDlg(), C4FileSelDlg::C4FileSelDlg(), C4LeagueSignupDialog::C4LeagueSignupDialog(), C4MessageBoardQuery::C4MessageBoardQuery(), C4ScenarioSection::C4ScenarioSection(), C4StartupOptionsDlg::C4StartupOptionsDlg(), C4ScenarioListLoader::Scenario::CanOpen(), C4GUI::CheckBox::CheckBox(), C4StartupPlrSelDlg::CheckPlayerName(), C4NetFilenameAdapt::CompileFunc(), C4KeyCodeEx::CompileFunc(), C4ComponentHost::CopyFilePathFromGroup(), copyPart(), ValidatedStdCopyStrBufBase::CopyValidated(), C4ObjectInfoCore::Default(), C4FileSelDlg::DefaultListItem::DefaultListItem(), C4EditCursor::DoContextMenu(), C4Application::DoInit(), Duplicate(), C4ScenarioSection::EnsureTempStore(), C4GUI::ContextMenu::Entry::Entry(), C4RoundResults::EvaluateNetwork(), C4RoundResultsPlayer::EvaluatePlayer(), C4StartupNetListEntry::Execute(), C4HTTPClient::Execute(), C4Console::FileSaveAs(), C4LeagueFBIDList::FindFBIDByAccount(), C4Group::FindNextEntry(), C4Config::ForceRelativePath(), C4LeagueClient::GetAuthCheckReply(), C4LeagueClient::GetAuthReply(), C4Config::GetConfigFileName(), C4LeagueClient::GetEndReply(), C4Group::GetFullName(), C4TextureMap::GetIndexMatTex(), C4ComponentHost::GetLanguageString(), C4ConfigNetwork::GetLeagueLoginData(), GetLogSection(), C4SDefinitions::GetModules(), C4Team::GetNameWithParticipants(), C4ObjectInfoCore::GetNextRankInfo(), GetParentPath(), C4LeagueClient::GetReportDisconnectReply(), GetSection(), C4FileSelDlg::GetSelection(), C4LeagueClient::GetStartReply(), C4LeagueClient::GetUpdateReply(), C4Language::Init(), C4Game::Init(), C4Shader::Init(), C4Player::Init(), C4GameMessage::Init(), C4PlayerControlAssignmentSet::InitEmptyFromTemplate(), C4Network2::LeagueEnd(), C4Network2::LeaguePlrAuth(), C4FileSelDlg::ListItem::ListItem(), C4ParticleDef::Load(), C4Surface::Load(), C4ComponentHost::Load(), C4Config::Load(), C4ScriptHost::LoadData(), C4SoundSystem::LoadEffects(), C4Reloc::LocateItem(), C4StartupModsListEntry::MakeInfoEntry(), MakeTempFilename(), C4Config::MakeTempUpdateFolder(), StdCompilerINIWrite::Name(), C4StartupPlrSelDlg::OnDelBtnConfirm(), C4StartupModsListEntry::OnError(), C4StartupModsListEntry::OnNoResultsFound(), C4StartupNetListEntry::OnReference(), StdCopyStrBuf::operator=(), C4Application::ParseCommandLine(), C4Console::PlayerJoin(), C4ControlJoinPlayer::PreRec(), C4MessageInput::ProcessCommand(), C4ChatControl::ProcessInput(), C4ObjectInfoCore::Promote(), C4Network2::QueryClientPassword(), C4ObjectInfo::Recruit(), C4PlayerList::Save(), C4Game::SaveData(), C4ScenarioSection::ScenarioLoad(), C4DefinitionSelDlg::SelectDefinitions(), C4Network2ResCore::Set(), C4ScriptGuiWindowProperty::Set(), C4PlayerInfoList::SetAsRestoreInfos(), C4Network2Res::SetByCore(), C4Network2Res::SetByGroup(), C4Menu::SetCloseCommand(), C4PlayerControlAssignment::SetControlName(), C4NetIO::SetError(), C4Application::SetGameFont(), C4PlayerInfo::SetLeagueData(), C4ConfigNetwork::SetLeagueLoginData(), C4PlayerInfo::SetLeagueProgressData(), C4ClientCore::SetLocal(), C4Network2::SetPassword(), C4FileSelDlg::SetPath(), C4MusicSystem::SetPlayList(), C4StartupNetListEntry::SetRefQuery(), C4HTTPClient::SetServer(), C4PropertyPath::SetSetPath(), C4Startup::SetStartScreen(), C4GUI::Button::SetText(), C4GUI::Label::SetText(), C4Landscape::SetTextureIndex(), C4Graph::SetTitle(), C4GUI::GroupBox::SetTitle(), C4GUI::Dialog::SetTitle(), C4ScenarioListLoader::Entry::SetTitleInGroup(), C4GUI::Element::SetToolTip(), C4GUI::Tabular::Sheet::Sheet(), C4LeagueSignupDialog::ShowModal(), C4StartupModsListEntry::ShowPageInfo(), C4StartupScenSelDlg::StartScenario(), C4Record::Stop(), C4Network2::StreamOut(), C4Playback::StreamToRecord(), C4ChatControl::Update(), C4ObjectInfoCore::UpdateCustomRanks(), C4InVal::ValidateString(), and C4GameSave::WriteDescDefinitions().

Here is the call graph for this function:

◆ Copy() [2/7]

void StdStrBuf::Copy ( const char *  pnData)
inline

Definition at line 468 of file StdBuf.h.

468 { StdBuf::Copy(pnData, pnData ? std::strlen(pnData) + 1 : 0); }

References StdBuf::Copy().

Here is the call graph for this function:

◆ Copy() [3/7]

void StdStrBuf::Copy ( const char *  pnData,
size_t  iChars 
)
inline

Definition at line 534 of file StdBuf.h.

535  {
536  Clear();
537  Append(pnData, iChars);
538  }
void Clear()
Definition: StdBuf.h:466

References Append(), and Clear().

Here is the call graph for this function:

◆ Copy() [4/7]

void StdBuf::Copy ( const StdBuf Buf2)
inlineinherited

Definition at line 243 of file StdBuf.h.

244  {
245  Copy(Buf2.getData(), Buf2.getSize());
246  }

References StdBuf::Copy(), StdBuf::getData(), and StdBuf::getSize().

Here is the call graph for this function:

◆ Copy() [5/7]

void StdStrBuf::Copy ( const StdStrBuf Buf2)
inline

Definition at line 469 of file StdBuf.h.

469 { StdBuf::Copy(Buf2); }

References StdBuf::Copy().

Here is the call graph for this function:

◆ Copy() [6/7]

void StdBuf::Copy ( const void *  pnData,
size_t  inSize 
)
inlineinherited

Definition at line 238 of file StdBuf.h.

239  {
240  Ref(pnData, inSize); Copy();
241  }
void Ref(const void *pnData, size_t inSize)
Definition: StdBuf.h:118

References StdBuf::Copy(), and StdBuf::Ref().

Here is the call graph for this function:

◆ Copy() [7/7]

void StdBuf::Copy ( size_t  inSize)
inlineinherited

Definition at line 225 of file StdBuf.h.

226  {
227  if (isNull() && !inSize) return;
228  const void *pOldData = getData();
229  size_t iOldSize = iSize;
230  New(inSize);
231  Write(pOldData, std::min(iOldSize, inSize));
232  }
void New(size_t inSize)
Definition: StdBuf.h:146
bool isNull() const
Definition: StdBuf.h:98

References StdBuf::getData(), StdBuf::iSize, StdBuf::isNull(), StdBuf::New(), and StdBuf::Write().

Referenced by StdBuf::Duplicate(), and C4PktBuf::operator=().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ copyPart()

StdStrBuf StdStrBuf::copyPart ( size_t  iStart,
size_t  inSize 
) const
inline

Definition at line 635 of file StdBuf.h.

636  {
637  assert(iStart + inSize <= iSize);
638  if (!inSize) return StdStrBuf();
639  StdStrBuf sResult;
640  sResult.Copy(getPtr(iStart), inSize);
641  return sResult;
642  }
StdStrBuf()=default
void Copy()
Definition: StdBuf.h:467

References Copy(), getPtr(), StdBuf::iSize, and StdStrBuf().

Referenced by C4GUI::InfoDialog::InfoDialog(), and SplitAtChar().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CopyUntil()

void StdStrBuf::CopyUntil ( const char *  szString,
char  cUntil 
)
inline

Definition at line 613 of file StdBuf.h.

614  {
615  Clear();
616  AppendUntil(szString, cUntil);
617  }
void AppendUntil(const char *szString, char cUntil)
Definition: StdBuf.h:604

References AppendUntil(), and Clear().

Referenced by C4TextureMap::GetIndexMatTex(), C4MessageBoard::GetMessagePlayer(), C4TexMapEntry::Init(), ircExtractPar(), C4Landscape::SetTextureIndex(), and C4EditCursor::UpdateStatusBar().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DeletePointer()

static void StdBuf::DeletePointer ( void *  data)
inlinestaticinherited

Definition at line 196 of file StdBuf.h.

197  {
198  free(data);
199  }

Referenced by C4ID::CompileFunc(), and C4GroupEntry::~C4GroupEntry().

Here is the caller graph for this function:

◆ Duplicate()

StdStrBuf StdStrBuf::Duplicate ( ) const
inline

Definition at line 470 of file StdBuf.h.

470 { StdStrBuf Buf; Buf.Copy(*this); return Buf; }

References Copy().

Here is the call graph for this function:

◆ EnsureUnicode()

bool StdStrBuf::EnsureUnicode ( )

Definition at line 421 of file StdBuf.cpp.

422 {
423  // assume that it's windows-1252 and convert to utf-8
424  if (!IsValidUtf8(getData(), getLength()))
425  {
426  size_t j = 0;
427  StdStrBuf buf;
428  buf.Grow(getLength());
429  // totally unfounded statistic: most texts have less than 20 umlauts.
430  enum { GROWSIZE = 20 };
431  for (size_t i = 0; i < getSize(); ++i)
432  {
433  unsigned char c = *getPtr(i);
434  // ASCII
435  if (c < 0x80)
436  {
437  if (j >= buf.getLength())
438  buf.Grow(GROWSIZE);
439  *buf.getMPtr(j++) = c;
440  continue;
441  }
442  // Is c one of the control characters only in ISO/IEC_8859-1 or part of the common subset with windows-1252?
443  if (c == 0x81 || c == 0x8D || c == 0x8F || c == 0x90 || c == 0x9D || c >= 0xA0)
444  {
445  if (j + 1 >= buf.getLength())
446  buf.Grow(GROWSIZE);
447  *buf.getMPtr(j++) = (0xC0 | (c >> 6));
448  *buf.getMPtr(j++) = (0x80 | (c & 0x3F));
449  continue;
450  }
451  // Extra windows-1252-characters
452  buf.SetLength(j);
453  static const char * extra_chars [] =
454  {
455  //"€", 0, "‚", "ƒ", "„", "…", "†", "‡", "ˆ", "‰", "Š", "‹", "Œ", 0, "Ž", 0,
456  // 0, "‘", "’", "“", "”", "•", "–", "—", "˜", "™", "š", "›", "œ", 0, "ž", "Ÿ" };
457  "\xe2\x82\xac", nullptr, "\xe2\x80\x9a", "\xc6\x92", "\xe2\x80\x9e", "\xe2\x80\xa6", "\xe2\x80\xa0", "\xe2\x80\xa1", "\xcb\x86", "\xe2\x80\xb0", "\xc5\xa0", "\xe2\x80\xb9", "\xc5\x92", nullptr, "\xc5\xbd", nullptr,
458  nullptr, "\xe2\x80\x98", "\xe2\x80\x99", "\xe2\x80\x9c", "\xe2\x80\x9d", "\xe2\x80\xa2", "\xe2\x80\x93", "\xe2\x80\x94", "\xcb\x9c", "\xe2\x84\xa2", "\xc5\xa1", "\xe2\x80\xba", "\xc5\x93", nullptr, "\xc5\xbe", "\xc5\xb8"
459  };
460  buf.Append(extra_chars[c - 0x80]);
461  j += strlen(extra_chars[c - 0x80]);
462  }
463  buf.SetLength(j);
464  Take(std::move(buf));
465  return true;
466  }
467  return false;
468 }
bool IsValidUtf8(const char *text, int length)
Definition: Standard.cpp:702
size_t getSize() const
Definition: StdBuf.h:444
void SetLength(size_t iLength)
Definition: StdBuf.h:509

References Append(), getData(), getLength(), getMPtr(), getPtr(), getSize(), Grow(), IsValidUtf8(), SetLength(), and Take().

Referenced by C4ComponentHost::FinishLoad().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EscapeString()

void StdStrBuf::EscapeString ( )
inline

Definition at line 669 of file StdBuf.h.

670  {
671  Replace(R"(\)", R"(\\)");
672  Replace(R"(")", R"(\")");
673  }
int Replace(const char *szOld, const char *szNew, size_t iStartSearch=0)
Definition: StdBuf.cpp:284

References Replace().

Referenced by C4Value::ToJSON().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Format()

void StdStrBuf::Format ( const char *  szFmt,
  ... 
)

Definition at line 174 of file StdBuf.cpp.

175 {
176  // Create argument list
177  va_list args; va_start(args, szFmt);
178  // Format
179  FormatV(szFmt, args);
180 }
void FormatV(const char *szFmt, va_list args)
Definition: StdBuf.cpp:182

References FormatV().

Referenced by C4MainMenu::ActivateGoals(), C4MainMenu::ActivateHost(), C4MainMenu::ActivateNewPlayer(), C4MainMenu::ActivateSavegame(), C4TimeMilliseconds::AsString(), C4LeagueSignupDialog::C4LeagueSignupDialog(), C4PortraitSelDlg::C4PortraitSelDlg(), C4PropertyPath::C4PropertyPath(), C4StartupOptionsDlg::C4StartupOptionsDlg(), C4ScenarioListLoader::Scenario::CanOpen(), C4Playback::Check(), C4StartupNetDlg::CheckVersionUpdate(), C4DrawTransform::CompileFunc(), StdSubMeshInstance::CompileFunc(), CStdFile::Create(), C4ConfigGeneral::CreateSaveFolder(), C4StartupScenSelDlg::DeleteConfirm(), C4PropertyPath::DoCall(), C4EditCursor::DoContextMenu(), C4MainMenu::DoRefillInternal(), C4DownloadDlg::DownloadFile(), C4Game::DrawCrewOverheadText(), C4StartupMainDlg::DrawElement(), C4Chart::DrawElement(), C4TableGraph::DumpToFile(), C4Command::Fail(), C4StartupModsListEntry::FromXML(), C4EditCursorSelection::GetDataString(), C4StartupPlrSelDlg::PlayerListItem::GetDelWarning(), C4ControlVote::getDesc(), C4PlayerInfo::GetLobbyName(), C4RankSystem::GetRankName(), C4Network2::HandleConn(), C4Console::HelpAbout(), C4StartupScenSelDlg::KeyDelete(), C4ComponentHost::Load(), StdMeshMaterialTextureUnit::Load(), C4Network2::OnClientDisconnect(), C4ChatControl::OnConnectBtn(), C4DownloadDlg::OnIdle(), C4StartupNetListEntry::OnReference(), OpenLog(), C4Network2::OpenVoteDialog(), C4MessageInput::ProcessCommand(), C4Game::QuickSave(), C4PlayerInfoList::RecreatePlayerFiles(), C4PlayerInfoList::RecreatePlayers(), C4ScenarioParameterDefs::RegisterScriptConstants(), C4ScenarioListLoader::Entry::RenameTo(), C4PlayerInfoList::RestoreSavegameInfos(), C4Network2::RetrieveScenario(), C4GameSave::SaveDesc(), C4Console::SaveScenario(), C4Network2IRCClient::Send(), C4PlayerInfoList::SetAsRestoreInfos(), C4Network2Res::SetByCore(), C4NetIO::SetError(), C4PropertyPath::SetProperty(), C4StartupNetListEntry::SetReference(), C4StartupNetListEntry::SetRefQuery(), C4PropertyPath::SetSetPath(), C4ScenarioListLoader::Entry::SetTitleInGroup(), C4StartupModsListEntry::ShowPageInfo(), C4Record::Start(), StdMeshMaterialError::StdMeshMaterialError(), C4ScriptGuiWindow::ToC4Value(), C4ChatControl::Update(), C4Network2ClientListDlg::Update(), C4StartupModsListEntry::UpdateInstalledState(), C4Console::UpdateNetMenu(), C4Console::UpdatePlayerMenu(), C4EditCursor::UpdateStatusBar(), C4Console::UpdateStatusBars(), C4Console::UpdateViewportMenu(), and C4FullScreen::ViewportCheck().

Here is the call graph for this function:

◆ FormatV()

void StdStrBuf::FormatV ( const char *  szFmt,
va_list  args 
)

Definition at line 182 of file StdBuf.cpp.

183 {
184  // Clear previous contents
185  Clear();
186  // Format
187  AppendFormatV(szFmt, args);
188 }

References AppendFormatV(), and Clear().

Referenced by C4GUI::InfoDialog::AddLineFmt(), DebugLogF(), Format(), FormatStringV(), LogF(), LogSilentF(), ShaderLogF(), and StdCompiler::Warn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getData()

const char* StdStrBuf::getData ( ) const
inline

Definition at line 442 of file StdBuf.h.

442 { return getBufPtr<char>(*this); }

Referenced by C4Group::AccessEntry(), C4Network2IRCClient::Action(), C4MainMenu::ActivateGoals(), C4MainMenu::ActivateHost(), C4Object::ActivateMenu(), C4MainMenu::ActivateNewPlayer(), C4MainMenu::ActivateSavegame(), C4FileSelDlg::AddCheckedLocation(), C4Shader::AddDefine(), C4Record::AddFile(), C4ScenarioParameters::AddFilename2ID(), C4GUI::InfoDialog::AddLineFmt(), C4GameSaveSavegame::AdjustCore(), C4GameSaveRecord::AdjustCore(), StdMeshMaterialParserCtx::AdvanceFloat(), StdMeshMaterialParserCtx::AdvanceInt(), AlgoScript(), C4GameMessage::Append(), Append(), C4PlayerInfoList::AssignPlayerIDs(), C4Config::AtExePath(), C4Config::AtTempPath(), C4LeagueClient::Auth(), C4LeagueClient::AuthCheck(), c4_group_handle_get_full_name(), c4_mapgen_handle_new(), c4_material_map_crossmap_materials(), C4AulParseError::C4AulParseError(), C4ChatControl::C4ChatControl(), C4ControlJoinPlayer::C4ControlJoinPlayer(), C4GameOverDlg::C4GameOverDlg(), C4Group_ApplyUpdate(), C4LeagueSignupDialog::C4LeagueSignupDialog(), C4PortraitSelDlg::C4PortraitSelDlg(), C4StartupModsDlg::C4StartupModsDlg(), C4StartupOptionsDlg::C4StartupOptionsDlg(), C4Playback::Check(), C4Game::CheckObjectEnumeration(), C4StartupPlrSelDlg::CheckPlayerName(), C4TextureMap::CheckTexture(), C4StartupNetDlg::CheckVersionUpdate(), C4Network2IRCClient::Close(), C4Language::CloseGroup(), C4Game::CloseScenario(), Compare(), CompileFromBuf_Log(), CompileFromBuf_LogWarn(), C4MusicSystem::CompileFunc(), CompileFunc(), C4Game::CompileFunc(), C4DrawTransform::CompileFunc(), C4CustomKey::CompileFunc(), C4MaterialReaction::CompileFunc(), StdSubMeshInstance::CompileFunc(), C4DefGraphicsAdapt::CompileFunc(), C4ScenarioParameters::CompileFunc(), StdEnumAdapt< T, int_t >::CompileFunc(), StdBitfieldAdapt< T >::CompileFunc(), C4ObjectList::CompileFunc(), C4Object::CompileFunc(), StdMeshInstanceAnimationNode::CompileFunc(), C4KeyCodeEx::CompileFunc(), C4Network2IO::ConnectWithSocket(), ConsoleDlgProc(), ConstructionCheck(), CopyDirectory(), C4ComponentHost::CopyFilePathFromGroup(), C4GameLobby::Countdown::Countdown(), CStdFile::Create(), C4GUI::Dialog::CreateConsoleWindow(), C4ScenarioListLoader::Entry::CreateEntryForFile(), C4MapFolderData::CreateGUIElements(), C4ConfigGeneral::CreateSaveFolder(), C4Game::CreateSectionFromTempFile(), CreateValueProviderFromArray(), C4MaterialMap::CrossMapMaterials(), DebugLogF(), C4AulDebug::DebugStep(), DecompileToBuf_Log(), C4PlayerInfoCore::Default(), DefaultExtension(), C4FileSelDlg::DefaultListItem::DefaultListItem(), C4StartupScenSelDlg::DeleteConfirm(), C4PlayerInfo::DeleteTempFile(), C4ConfigGeneral::DeterminePaths(), DisplayGroup(), C4PropertyPath::DoCall(), C4EditCursor::DoContextMenu(), C4EditCursor::DoContextObjCommand(), C4Application::DoInit(), C4ScenarioListLoader::SubFolder::DoLoadContents(), C4ScenarioListLoader::RegularFolder::DoLoadContents(), C4StartupModsDlg::DoOK(), C4StartupNetDlg::DoOK(), C4StartupScenSelDlg::DoOK(), C4MainMenu::DoRefillInternal(), C4StartupNetDlg::DoRefresh(), C4Startup::DoStartup(), C4Network2Client::DoTCPSimultaneousOpen(), C4UpdatePackage::DoUpdate(), C4DownloadDlg::DownloadFile(), C4UpperBoard::Draw(), C4LoaderScreen::Draw(), C4MouseControl::Draw(), C4Object::Draw(), C4GameMessage::Draw(), C4ScriptGuiWindow::Draw(), C4Game::DrawCrewOverheadText(), C4GUI::Label::DrawElement(), C4GUI::WoodenLabel::DrawElement(), C4GUI::GroupBox::DrawElement(), C4GUI::Button::DrawElement(), C4GUI::IconButton::DrawElement(), C4GUI::FacetButton::DrawElement(), C4GUI::CheckBox::DrawElement(), C4GUI::ContextMenu::Entry::DrawElement(), C4MenuItem::DrawElement(), C4StartupMainDlg::DrawElement(), C4Chart::DrawElement(), C4Viewport::DrawMenu(), C4Network2::DrawStatus(), C4GUI::Screen::DrawToolTip(), C4TableGraph::DumpToFile(), C4LeagueClient::End(), EnforceExtension(), C4ScenarioSection::EnsureTempStore(), EnsureUnicode(), C4GUI::ContextMenu::Entry::Entry(), EntrySortFunc(), StdMeshMaterialParserCtx::Error(), StdMeshLoader::StdMeshXML::Error(), C4Game::Evaluate(), C4Object::ExecLife(), C4Player::Execute(), CPNGSaveThread::Execute(), C4UpdatePackage::Execute(), C4HTTPClient::Execute(), C4StdInProc::Execute(), C4Config::ExpandEnvironmentVariables(), C4GUI::ExpandHotkeyMarkup(), C4Command::Fail(), C4Console::FileNew(), C4Console::FileOpen(), C4Console::FileOpenWPlrs(), C4Console::FileSaveAs(), C4Group::FindEntry(), C4Group::FindNextEntry(), C4ComponentHost::FinishLoad(), C4Config::ForceRelativePath(), ForEachFile(), C4Player::GainScenarioAchievement(), C4LeagueResponseHead::getAccount(), C4ScenarioParameterDef::GetAchievement(), C4LeagueResponseHead::getAUID(), C4PlayerInfo::getAuthID(), C4MouseControl::GetCaption(), C4LeagueResponseHeadAuthCheck::getClanTag(), StdMeshMaterialShader::GetCode(), C4Network2Reference::getComment(), C4PlayerControlAssignment::GetControlName(), C4LeagueResponseHead::getCSID(), C4LeagueClient::getCSID(), C4String::GetCStr(), C4ClientCore::getCUID(), C4RoundResultsPlayer::GetCustomEvaluationStrings(), C4RoundResults::GetCustomEvaluationStrings(), C4ComponentHost::GetData(), C4Network2IRCMessage::getData(), C4ScenarioParameterDef::GetDescription(), C4StartupNetListEntry::GetError(), C4HTTPClient::GetError(), C4NetIO::GetError(), GetFatalError(), C4LeagueResponseHead::getFBID(), C4GameRes::getFile(), C4AulUserFile::GetFileContents(), C4FileSelDlg::ListItem::GetFilename(), C4PlayerInfo::GetFilename(), StdMeshMaterialShader::GetFilename(), C4Network2ResCore::getFileName(), C4ComponentHost::GetFilePath(), C4PlayerInfo::GetForcedName(), C4GameParameters::GetGameGoalString(), C4Network2Reference::getGameGoalString(), C4PropertyPath::GetGetPath(), C4Network2Stats::GetGraphByName(), C4ScenarioSection::GetGroupfile(), C4PlayerControlDef::GetGUIDesc(), C4PlayerControlAssignment::GetGUIDesc(), C4PlayerControlDef::GetGUIName(), C4PlayerControlAssignmentSet::GetGUIName(), C4PlayerControlAssignment::GetGUIName(), C4Team::GetIconSpec(), C4GameLobby::C4PacketSetScenarioParameter::GetID(), C4ScenarioParameterDef::GetID(), C4PlayerControlDef::GetIdentifier(), C4TextureMap::GetIndexMatTex(), C4ComponentHost::GetLanguageString(), C4GameParameters::getLeague(), C4LeagueResponseHeadStart::getLeague(), C4LeagueResponseHeadUpdate::getLeague(), C4PlayerInfo::getLeagueAccount(), C4PlayerInfo::GetLeagueProgressData(), C4PlayerInfo::GetLobbyName(), C4PlayerInfo::GetLocalJoinFilename(), C4LeagueResponseHead::getLoginToken(), GetLogPos(), GetLogSection(), C4TexMapEntry::GetMaterialName(), C4LeagueResponseHead::getMessage(), C4MessageBoard::GetMessagePlayer(), C4PacketConnRe::getMsg(), C4PlayerControlAssignmentSet::GetName(), C4PlayerInfo::GetName(), C4ClientCore::getName(), C4Network2IRCUser::getName(), C4Network2IRCChannel::getName(), C4Player::GetName(), C4ScenarioParameterDef::GetName(), StdCompilerINIRead::GetNameByIndex(), C4RoundResults::GetNetResultString(), C4ClientCore::getNick(), C4PlayerInfo::GetOriginalName(), C4GUI::Element::GetOwnToolTip(), C4Language::GetPackGroups(), C4Network2::GetPassword(), C4Network2IOConnection::getPassword(), C4PacketConn::getPassword(), C4ControlEditGraph::GetPath(), StdCompilerINIRead::getPosition(), C4Network2IRCUser::getPrefix(), C4LeagueResponseHeadAuthCheck::getProgressData(), C4ScenarioListLoader::GetProgressInfo(), getRef(), C4Network2RefClient::GetReferences(), C4HTTPClient::getResultString(), C4ClientCore::getRevision(), C4PropertyPath::GetRoot(), C4ScriptHost::GetScript(), C4TeamList::GetScriptPlayerName(), GetSection(), C4FileSelDlg::GetSelection(), C4HTTPClient::getServerName(), C4PropertyPath::GetSetPath(), C4Network2IRCMessage::getSource(), C4LeagueResponseHeadStart::getStreamingAddr(), C4GameVersion::GetString(), C4Network2IRCMessage::getTarget(), C4GUI::Label::GetText(), C4GUI::CheckBox::GetText(), C4GUI::ContextMenu::Entry::GetText(), C4TextureMap::GetTexture(), C4TextureMap::GetTextureIndex(), C4TexMapEntry::GetTextureName(), C4ChatControl::GetTitle(), C4GUI::Tabular::Sheet::GetTitle(), C4Network2Reference::getTitle(), C4Graph::GetTitle(), C4GUI::Element::GetToolTip(), C4Network2IRCChannel::getTopic(), C4Game::GetTranslatedString(), C4Network2UpdateClient::GetUpdateURL(), C4HTTPClient::getURL(), C4Network2IRCClient::getUserName(), C4Network2UpdateClient::GetVersion(), GetWorkingDirectory(), C4MapScriptAlgo::GetXYProps(), C4Network2::HandleConn(), C4Network2::HandleConnRe(), C4Network2IO::HandlePacket(), C4GUI::IconButton::IconButton(), C4GUI::InfoDialog::InfoDialog(), C4Language::Init(), C4Reloc::Init(), C4TexMapEntry::Init(), C4SoundModifierList::Init(), C4RankSystem::Init(), C4Shader::Init(), C4LoaderScreen::Init(), C4Player::InitControl(), C4FileSelDlg::InitElements(), C4MusicSystem::InitForScenario(), C4Game::InitGame(), C4Network2::InitLeague(), C4Menu::InitLocation(), C4Game::InitNetworkFromAddress(), C4Game::InitNetworkFromReference(), C4Game::InitPlayers(), C4Game::InitScriptEngine(), C4GUI::InputDialog::InputDialog(), C4Network2IRCMessage::isChannel(), C4DefinitionSelDlg::IsItemGrayed(), C4StartupNetListEntry::IsSameRefQueryAddress(), C4LeagueResponseHead::isStatusRegister(), C4LeagueResponseHead::isSuccess(), C4PlayerControlAssignmentSet::IsWildcardName(), C4Game::JoinPlayer(), C4StartupScenSelDlg::KeyCheat2(), C4StartupScenSelDlg::KeyDelete(), C4Network2::LeagueEnd(), C4Network2::LeagueNotifyDisconnect(), C4Network2::LeaguePlrAuth(), C4Network2::LeaguePlrAuthCheck(), C4Network2::LeagueStart(), C4Network2::LeagueUpdateProcessReply(), C4ParticleDef::Load(), C4ObjectInfoCore::Load(), C4PlayerInfoCore::Load(), C4GameParameters::Load(), C4GameResList::Load(), C4Surface::Load(), C4ComponentHost::Load(), C4ScenarioListLoader::Entry::Load(), C4UpdatePackage::Load(), C4Config::Load(), C4Player::Load(), C4StartupPlrSelDlg::PlayerListItem::Load(), C4ScenarioListLoader::Load(), StdMeshMaterialShaderParameters::Load(), StdMeshMaterialTextureUnit::Load(), StdMeshMaterialPass::Load(), StdMeshMaterialTechnique::Load(), StdMeshMaterial::Load(), StdMeshMaterialSubLoader::Load(), C4Game::LoadAdditionalSystemGroup(), C4DefGraphics::LoadBitmap(), C4ScenarioListLoader::Scenario::LoadCustomPre(), C4ScenarioListLoader::Folder::LoadCustomPre(), C4Def::LoadDefCore(), C4SoundSystem::LoadEffects(), C4Group::LoadEntry(), C4GroupSet::LoadEntryString(), C4Group::LoadEntryString(), C4MaterialMap::LoadEnumeration(), C4TextureMap::LoadFlags(), StdMeshLoader::LoadMeshBinary(), StdMeshLoader::LoadMeshXml(), C4Game::LoadScenarioSection(), LoadShader(), StdMeshSkeletonLoader::LoadSkeletonXml(), C4TextureMap::LoadTextures(), C4Reloc::LocateItem(), LogF(), LogFatal(), LogSilent(), LogSilentF(), C4Player::MakeCrewMember(), MakeTempFilename(), C4Config::MakeTempUpdateFolder(), C4Network2IRCClient::Message(), C4GUI::MessageDialog::MessageDialog(), StdMeshSkeleton::MirrorAnimation(), C4UpdatePackage::MkUp(), C4StartupPlrSelDlg::PlayerListItem::MoveFilename(), C4Network2IRCClient::Notice(), ObjectComDig(), C4GameOptionButtons::OnBtnComment(), C4ChatDlg::OnChatTitleChange(), C4StartupNetDlg::OnChatTitleChange(), C4Network2::OnClientDisconnect(), C4StartupPlrPropertiesDlg::OnClosed(), C4GameOptionButtons::OnCommentSet(), C4Network2IO::OnConn(), C4Network2::OnConnect(), C4ChatControl::OnConnectBtn(), C4Network2::OnConnectFail(), C4GameLobby::MainDlg::OnCountdownPacket(), C4StartupPlrPropertiesDlg::OnCtrlChangeLeft(), C4StartupPlrPropertiesDlg::OnCtrlChangeRight(), C4GUI::ComboBox::OnCtxComboSelect(), C4StartupPlrSelDlg::OnDelBtn(), C4StartupPlrSelDlg::OnDelBtnConfirm(), C4Network2IO::OnDisconn(), C4Network2::OnDisconnect(), C4DownloadDlg::OnIdle(), C4StartupMainDlg::OnNetJoin(), C4Network2IO::OnPacket(), C4GameOptionButtons::OnPasswordSet(), C4StartupPlrPropertiesDlg::OnPictureBtn(), C4StartupMainDlg::OnPlayerSelContextAdd(), C4StartupMainDlg::OnPlayerSelContextAddPlr(), C4GameLobby::MainDlg::OnRightTabContext(), C4GameLobby::Countdown::OnSec1Timer(), C4DefinitionSelDlg::OnShown(), C4StartupMainDlg::OnShown(), C4Playback::Open(), C4MarkupTagColor::OpeningTag(), OpenLog(), C4Game::OpenScenario(), C4Network2::OpenVoteDialog(), C4Reloc::PathInfo::operator const char *(), operator const void *(), StdCopyStrBuf::operator std::string(), operator<(), C4ScriptHost::Parse(), C4DefScriptHost::Parse(), StdMeshMatManager::Parse(), C4AulParse::Parse_Script(), C4Application::ParseCommandLine(), C4EditCursor::PerformDuplication(), C4MusicSystem::Play(), C4Console::PlayerJoin(), CStdGL::PrepareMaterial(), C4ScriptHost::Preparse(), C4ControlJoinPlayer::PreRec(), C4MessageInput::ProcessCommand(), C4InteractiveThread::ProcessEvents(), C4ChatControl::ProcessInput(), C4GUI::ProgressDialog::ProgressDialog(), C4PlayerInfoCore::Promote(), C4Object::Promote(), C4GameRes::Publish(), StdCompilerINIWrite::PutName(), C4HTTPClient::Query(), C4Network2::QueryClientPassword(), C4Game::QuickSave(), StdCompilerINIRead::Raw(), C4Playback::ReadBinary(), RealPath(), C4PlayerInfoList::RecreatePlayerFiles(), C4PlayerInfoList::RecreatePlayers(), Ref(), C4Shader::Refresh(), C4GraphicsResource::RegisterGlobalGraphics(), C4KeyboardInput::RegisterKey(), C4ScenarioParameterDefs::RegisterScriptConstants(), C4ParticleDef::Reload(), C4Game::ReloadParticle(), C4PlayerList::RemoveAtClient(), C4PlayerList::RemoveAtRemoteClient(), RemoveExtension(), C4PlayerList::RemoveLocal(), StdMeshSkeletonLoader::RemoveSkeletonsInGroup(), C4ScenarioListLoader::Entry::RenameTo(), C4LangStringTable::ReplaceStrings(), C4LeagueClient::ReportDisconnect(), C4PlayerControlAssignment::ResolveRefs(), C4PropertyPath::ResolveRoot(), C4MaterialReaction::ResolveScriptFuncs(), C4PropertyPath::ResolveValue(), C4PlayerInfoList::RestoreSavegameInfos(), C4GameResList::RetrieveFiles(), C4Network2::RetrieveScenario(), C4AulScriptContext::ReturnDump(), C4Playback::ReWriteBinary(), C4Config::Save(), C4PlayerInfoCore::Save(), C4ObjectInfo::Save(), C4PlayerList::Save(), C4StartupOptionsDlg::SaveConfig(), C4GameSave::SaveDesc(), C4Game::SaveGameTitle(), C4TextureMap::SaveMap(), C4Console::SaveScenario(), SaveToFile(), C4ScenarioSection::ScenarioLoad(), C4StartupScenSelDlg::ScenListItem::ScenListItem(), C4DefinitionSelDlg::SelectDefinitions(), C4Network2IRCClient::Send(), StdCompilerINIRead::Separator(), C4NetIO::EndpointAddress::SetAddress(), C4PlayerInfoList::SetAsRestoreInfos(), C4Network2Res::SetByCore(), C4Network2Res::SetByFile(), C4Network2Res::SetByGroup(), C4FileSelDlg::SetCurrentLocation(), C4Application::SetGameFont(), C4NetIO::HostAddress::SetHost(), C4Player::SetHostility(), C4PropertyPath::SetProperty(), C4StartupNetListEntry::SetReference(), C4StartupPlrSelDlg::PlayerListItem::SetSelectionInfo(), C4GUI::ComboBox::SetText(), C4GUI::Label::SetText(), C4Landscape::SetTextureIndex(), C4ScenarioListLoader::Entry::SetTitleInGroup(), ShaderLogF(), C4LeagueSignupDialog::ShowModal(), SplitAtChar(), C4Record::Start(), C4LeagueClient::Start(), C4GameLobby::MainDlg::Start(), C4StartupScenSelDlg::StartScenario(), C4Record::StartStreaming(), StdMeshMaterialError::StdMeshMaterialError(), C4Record::Stop(), StdMeshSkeletonLoader::StoreSkeleton(), C4Network2::StreamOut(), C4Playback::StreamToRecord(), C4KeyCodeEx::String2KeyCode(), C4KeyCodeEx::String2KeyShift(), C4ControlJoinPlayer::Strip(), C4Playback::Strip(), C4Value::ToJSON(), C4EditCursor::ToolFailure(), C4Network2Address::toString(), TrimSpaces(), C4Menu::TryClose(), C4KeyboardInput::UnregisterKey(), C4KeyboardInput::UnregisterKeyBinding(), C4ChatControl::Update(), C4Network2ClientListDlg::Update(), C4FoWLightSection::Update(), C4ChatControl::ChatSheet::NickItem::Update(), C4LeagueClient::Update(), C4Menu::UpdateElementPositions(), C4ScriptGuiWindow::UpdateLayout(), C4Console::UpdateNetMenu(), C4Network2ClientDlg::UpdateText(), C4StartupPlrPropertiesDlg::UserClose(), C4LeagueSignupDialog::UserClose(), ValidateChars(), C4InVal::ValidateString(), C4FullScreen::ViewportCheck(), C4AulCompiler::ConstexprEvaluator::visit(), C4ScriptHost::Warn(), StdCompiler::Warn(), StdMeshMaterialParserCtx::WarningNotSupported(), C4AulError::what(), C4DrawGLError::what(), StdMeshMaterialError::what(), WildcardListMatch(), C4GameSaveRecord::WriteDesc(), and C4ScenarioSection::~C4ScenarioSection().

◆ GetHash()

int StdStrBuf::GetHash ( ) const
inline

Definition at line 664 of file StdBuf.h.

665  {
666  return StdBuf::GetHash();
667  }
int GetHash() const
Definition: StdBuf.h:322

References StdBuf::GetHash().

Here is the call graph for this function:

◆ getLength()

size_t StdStrBuf::getLength ( ) const
inline

Definition at line 445 of file StdBuf.h.

445 { return getSize() ? getSize() - 1 : 0; }

References getSize().

Referenced by C4Group::Add(), C4RoundResultsPlayer::AddCustomEvaluationString(), C4RoundResults::AddCustomEvaluationString(), C4ScenarioParameters::AddFilename2ID(), Append(), AppendBackslash(), AppendCharacter(), AppendChars(), AppendFormatV(), C4Object::AssignInfo(), C4LeagueClient::AuthCheck(), C4StartupOptionsDlg::C4StartupOptionsDlg(), C4StartupPlrSelDlg::CheckPlayerName(), Compare(), CompileFromBuf_Log(), CompileFromBuf_LogWarn(), C4LeagueRequestHeadEnd::CompileFunc(), C4ObjectList::CompileFunc(), C4KeyCodeEx::CompileFunc(), C4Network2IRCClient::Connect(), C4MaterialMap::CrossMapMaterials(), C4ConfigGeneral::DeterminePaths(), C4EditCursor::DoContextMenu(), C4StartupScenSelDlg::DoOK(), C4GameParameters::doStreaming(), C4MenuItem::DoTextProgress(), C4GUI::IconButton::DrawElement(), C4GUI::FacetButton::DrawElement(), C4LeagueClient::End(), EnsureUnicode(), C4Config::ExpandEnvironmentVariables(), C4Player::GainScenarioAchievement(), C4ComponentHost::GetDataSize(), C4AulUserFile::GetFileLength(), C4GameParameters::GetGameGoalString(), C4Network2Reference::getGameGoalString(), C4PlayerControlAssignment::GetGUIDesc(), C4PlayerControlAssignment::GetGUIName(), C4Object::GetInfoString(), C4PlayerInfo::GetLobbyName(), C4SDefinitions::GetModules(), C4PlayerInfo::GetName(), C4Language::GetPackGroups(), getRef(), C4TeamList::GetScriptPlayerName(), GetSection(), C4FileSelDlg::GetSelection(), Grow(), C4GUI::GroupBox::HasTitle(), C4GUI::InfoDialog::InfoDialog(), C4SoundModifierList::Init(), C4GameMessage::Init(), C4Network2::InitLeague(), InsertChar(), ircExtractPar(), C4ScenarioParameterDef::IsAchievement(), C4Network2IRCMessage::isChannel(), C4PropertyPath::IsEmpty(), C4GameParameters::isLeague(), C4ClientCore::isRegistered(), C4PlayerInfo::IsUsingName(), C4Network2::LeagueEnd(), C4Network2::LeaguePlrAuth(), C4Network2::LeagueStart(), C4Network2::LeagueUpdateProcessReply(), LoadFromFile(), LoadShader(), C4TextureMap::LoadTextures(), LogSilent(), MakeTempFilename(), StdMeshSkeleton::MirrorAnimation(), C4GameMessageList::New(), C4ChatControl::OnConnectBtn(), C4Playback::Open(), C4Game::OpenScenario(), StdCopyStrBuf::operator std::string(), operator<(), operator==(), C4ScriptHost::Parse(), CStdGL::PrepareMaterial(), C4ChatControl::ProcessInput(), StdCompilerINIWrite::PutName(), Replace(), ReplaceEnd(), C4LangStringTable::ReplaceStrings(), C4PropertyPath::ResolveRoot(), C4PropertyPath::ResolveValue(), C4Config::Save(), C4UpdatePackageCore::Save(), C4RoundResults::Save(), C4Game::SaveData(), C4TextureMap::SaveMap(), SaveToFile(), C4Network2IRCClient::Send(), C4NetIO::EndpointAddress::SetAddress(), SetLength(), C4ClientCore::SetLocal(), Shrink(), SplitAtChar(), C4KeyCodeEx::String2KeyCode(), C4KeyCodeEx::ToString(), TrimSpaces(), C4ChatControl::Update(), C4LeagueClient::Update(), ValidateChars(), and C4InVal::ValidateString().

Here is the call graph for this function:

◆ getMData()

◆ getMPtr()

char* StdStrBuf::getMPtr ( size_t  i)
inline

Definition at line 449 of file StdBuf.h.

449 { return getMBufPtr<char>(*this, i); }

Referenced by AppendCharacter(), AppendChars(), AppendFormatV(), EnsureUnicode(), Grow(), InsertChar(), Replace(), ReplaceChar(), ReplaceEnd(), Shrink(), ToLowerCase(), TrimSpaces(), and C4InVal::ValidateString().

Here is the caller graph for this function:

◆ getPart()

StdBuf StdBuf::getPart ( size_t  iStart,
size_t  inSize 
) const
inlineinherited

Definition at line 107 of file StdBuf.h.

108  {
109  assert(iStart + inSize <= iSize);
110  return StdBuf(getPtr(iStart), inSize);
111  }

References StdBuf::getPtr(), StdBuf::iSize, and StdBuf::StdBuf().

Referenced by C4NetIOPacket::getPBuf(), C4NetIOTCP::Peer::OnRecv(), C4Playback::ReadBinary(), and C4NetIOTCP::UnpackPacket().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPtr()

const char* StdStrBuf::getPtr ( size_t  i) const
inline

Definition at line 448 of file StdBuf.h.

448 { return getBufPtr<char>(*this, i); }

Referenced by C4ScenarioParameters::AddFilename2ID(), AppendBackslash(), copyPart(), StdCompilerINIRead::CreateNameTree(), C4MenuItem::DoTextProgress(), EnsureUnicode(), InsertChar(), C4StartupScenSelDlg::KeyCheat2(), operator[](), C4ScriptHost::Parse(), Replace(), and C4InVal::ValidateString().

Here is the caller graph for this function:

◆ getRef()

StdStrBuf StdStrBuf::getRef ( ) const
inline

Definition at line 462 of file StdBuf.h.

462 { return StdStrBuf(getData(), getLength()); }

References getData(), getLength(), and StdStrBuf().

Referenced by C4String::GetData(), and operator+().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetSection()

bool StdStrBuf::GetSection ( size_t  idx,
StdStrBuf psOutSection,
char  cSeparator = ';' 
) const

Definition at line 369 of file StdBuf.cpp.

370 {
371  assert(psOutSection);
372  psOutSection->Clear();
373  const char *szStr = getData(), *szSepPos;
374  if (!szStr) return false; // invaid argument
375  while ((szSepPos = strchr(szStr, cSeparator)) && idx) { szStr = szSepPos+1; --idx; }
376  if (idx) return false; // indexed section not found
377  // fill output buffer with section, if not empty
378  if (!szSepPos) szSepPos = getData() + getLength();
379  if (szSepPos != szStr) psOutSection->Copy(szStr, szSepPos - szStr);
380  // return true even if section is empty, because the section obviously exists
381  // (to enable loops like while (buf.GetSection(i++, &sect)) if (sect) ...)
382  return true;
383 }

References Clear(), Copy(), getData(), and getLength().

Referenced by C4TeamList::GetScriptPlayerName(), and WildcardListMatch().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSize()

size_t StdStrBuf::getSize ( ) const
inline

Definition at line 444 of file StdBuf.h.

444 { return StdBuf::getSize(); }

References StdBuf::getSize().

Referenced by c4_group_handle_get_full_name(), C4StartupNetDlg::DoOK(), EnsureUnicode(), C4ComponentHost::FinishLoad(), C4ClientList::GetAllClientNames(), getLength(), GetLogSection(), Grow(), C4Game::HasScenario(), C4Game::OpenScenario(), StdCompilerINIRead::Raw(), and Ref().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GrabPointer()

char* StdStrBuf::GrabPointer ( )
inline

Definition at line 459 of file StdBuf.h.

459 { return reinterpret_cast<char *>(StdBuf::GrabPointer()); }
void * GrabPointer()
Definition: StdBuf.h:133

References StdBuf::GrabPointer().

Referenced by C4Group::Add(), C4ValueMapData::CompileFunc(), C4FileSelDlg::DefaultListItem::DefaultListItem(), C4Network2IO::HandlePacket(), C4Network2Res::SetByCore(), C4ScenarioListLoader::Entry::SetTitleInGroup(), StdCompilerINIRead::String(), C4Markup::StripMarkup(), C4InteractiveThread::ThreadLog(), C4InteractiveThread::ThreadLogDebug(), C4InteractiveThread::ThreadLogFatal(), and C4InteractiveThread::ThreadLogS().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Grow()

void StdStrBuf::Grow ( size_t  iGrow)
inline

Definition at line 498 of file StdBuf.h.

499  {
500  StdBuf::Grow(getSize() ? iGrow : iGrow + 1);
501  *getMPtr(getLength()) = '\0';
502  }

References getLength(), getMPtr(), getSize(), and StdBuf::Grow().

Referenced by Append(), AppendCharacter(), AppendChars(), AppendFormatV(), EnsureUnicode(), InsertChar(), and SetLength().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InsertChar()

void StdStrBuf::InsertChar ( char  cChar,
size_t  insert_before 
)
inline

Definition at line 594 of file StdBuf.h.

595  {
596  assert(insert_before <= getLength());
597  Grow(1);
598  for (size_t i = getLength()-1; i > insert_before; --i)
599  *getMPtr(i) = *getPtr(i-1);
600  *getMPtr(insert_before) = cChar;
601  }

References getLength(), getMPtr(), getPtr(), and Grow().

Here is the call graph for this function:

◆ isNull()

bool StdStrBuf::isNull ( ) const
inline

Definition at line 441 of file StdBuf.h.

441 { return StdBuf::isNull(); }

References StdBuf::isNull().

Referenced by AppendFormatV(), C4Startup::DoStartup(), C4StdInProc::Execute(), C4RankSystem::GetRankName(), C4GUI::Element::GetToolTip(), C4Network2::HandleConn(), C4Language::HasStringTable(), C4RankSystem::Init(), C4TexMapEntry::isNull(), C4Network2::isPassworded(), C4Config::Load(), LogFatal(), operator!(), C4HTTPClient::Query(), ReplaceChar(), C4NetIO::EndpointAddress::SetAddress(), SetLength(), and ToLowerCase().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isRef()

bool StdStrBuf::isRef ( ) const
inline

Definition at line 446 of file StdBuf.h.

446 { return StdBuf::isRef(); }
bool isRef() const
Definition: StdBuf.h:102

References StdBuf::isRef().

Here is the call graph for this function:

◆ LoadFromFile()

bool StdStrBuf::LoadFromFile ( const char *  szFile)

Definition at line 73 of file StdBuf.cpp.

74 {
75  // Open file
76 #ifdef _WIN32
77  int fh = _wopen(::GetWideChar(szFile), O_BINARY | O_RDONLY | O_SEQUENTIAL, S_IREAD | S_IWRITE);
78 #else
79  int fh = open(szFile, O_BINARY | O_CLOEXEC | O_RDONLY | O_SEQUENTIAL, S_IREAD | S_IWRITE);
80 #endif
81  if (fh < 0) return false;
82  // Create buf
83  SetLength(FileSize(fh));
84  // Read
85  if (read(fh, getMData(), getLength()) != (ssize_t) getLength())
86  {
87  close(fh);
88  return false;
89  }
90  close(fh);
91  // Ok
92  return true;
93 }
StdStrBuf::wchar_t_holder GetWideChar(const char *utf8, bool double_null_terminate=false)
ptrdiff_t ssize_t
#define O_CLOEXEC
#define O_BINARY
Definition: StdBuf.cpp:25
#define O_SEQUENTIAL
Definition: StdBuf.cpp:26
size_t FileSize(const char *fname)
char * getMData()
Definition: StdBuf.h:443

References FileSize(), getLength(), getMData(), GetWideChar(), O_BINARY, O_CLOEXEC, O_SEQUENTIAL, and SetLength().

Referenced by GetLogSection(), C4Game::InitNetworkFromReferenceFile(), C4Config::Load(), and C4MusicSystem::LoadMoreMusic().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Move()

void StdStrBuf::Move ( size_t  iFrom,
size_t  inSize,
size_t  iTo = 0 
)
inline

Definition at line 471 of file StdBuf.h.

471 { StdBuf::Move(iFrom, inSize, iTo); }
void Move(size_t iFrom, size_t inSize, size_t iTo=0)
Definition: StdBuf.h:159

References StdBuf::Move().

Referenced by C4ComponentHost::FinishLoad(), and C4GameMessage::Init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ New()

void StdBuf::New ( size_t  inSize)
inlineinherited

Definition at line 146 of file StdBuf.h.

147  {
148  Clear();
149  pMData = malloc(iSize = inSize);
150  fRef = false;
151  }
bool fRef
Definition: StdBuf.h:82

References StdBuf::Clear(), StdBuf::fRef, and StdBuf::iSize.

Referenced by StdCompilerBinWrite::BeginSecond(), C4NetIOPacket::C4NetIOPacket(), StdBuf::CompileFunc(), StdBuf::Copy(), C4NetIOSimpleUDP::Execute(), C4Group::LoadEntry(), StdBuf::LoadFromFile(), C4Playback::NextSequentialChunk(), C4NetpuncherPacket::PackTo(), StdCompilerINIRead::ReadString(), Replace(), C4Network2::StartStreaming(), and C4Playback::StreamToRecord().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator const void *()

StdStrBuf::operator const void * ( ) const
inline

Definition at line 568 of file StdBuf.h.

568 { return getData(); }

References getData().

Here is the call graph for this function:

◆ operator!()

bool StdStrBuf::operator! ( ) const
inline

Definition at line 546 of file StdBuf.h.

546 { return isNull(); }

References isNull().

Here is the call graph for this function:

◆ operator!=() [1/3]

bool StdStrBuf::operator!= ( const char *  szString) const
inline

Definition at line 561 of file StdBuf.h.

561 { return ! operator == (szString); }
bool operator==(const StdStrBuf &Buf2) const
Definition: StdBuf.h:554

References operator==().

Here is the call graph for this function:

◆ operator!=() [2/3]

bool StdBuf::operator!= ( const StdBuf Buf2) const
inlineinherited

Definition at line 312 of file StdBuf.h.

312 { return ! operator == (Buf2); }
bool operator==(const StdBuf &Buf2) const
Definition: StdBuf.h:308

References StdBuf::operator==().

Here is the call graph for this function:

◆ operator!=() [3/3]

bool StdStrBuf::operator!= ( const StdStrBuf Buf2) const
inline

Definition at line 558 of file StdBuf.h.

558 { return !operator == (Buf2); }

References operator==().

Here is the call graph for this function:

◆ operator+() [1/4]

StdStrBuf StdStrBuf::operator+ ( char  c) const
inline

Definition at line 552 of file StdBuf.h.

552 { StdStrBuf Buf = getRef(); Buf.AppendChar(c); return Buf; }
StdStrBuf getRef() const
Definition: StdBuf.h:462

References AppendChar(), and getRef().

Here is the call graph for this function:

◆ operator+() [2/4]

StdStrBuf StdStrBuf::operator+ ( const char *  szString) const
inline

Definition at line 551 of file StdBuf.h.

551 { StdStrBuf Buf = getRef(); Buf.Append(szString); return Buf; }

References Append(), and getRef().

Here is the call graph for this function:

◆ operator+() [3/4]

StdBuf StdBuf::operator+ ( const StdBuf Buf2) const
inlineinherited

Definition at line 300 of file StdBuf.h.

301  {
302  StdBuf Buf(getRef());
303  Buf.Append(Buf2);
304  return Buf;
305  }
Definition: StdBuf.h:30
StdBuf getRef() const
Definition: StdBuf.h:271

References StdBuf::Append(), and StdBuf::getRef().

Here is the call graph for this function:

◆ operator+() [4/4]

StdStrBuf StdStrBuf::operator+ ( const StdStrBuf Buf2) const
inline

Definition at line 550 of file StdBuf.h.

550 { StdStrBuf Buf = getRef(); Buf.Append(Buf2); return Buf; }

References Append(), and getRef().

Here is the call graph for this function:

◆ operator+=() [1/3]

StdStrBuf& StdStrBuf::operator+= ( const char *  szString)
inline

Definition at line 549 of file StdBuf.h.

549 { Append(szString); return *this; }

References Append().

Here is the call graph for this function:

◆ operator+=() [2/3]

StdBuf StdBuf::operator+= ( const StdBuf Buf2)
inlineinherited

Definition at line 295 of file StdBuf.h.

296  {
297  Append(Buf2);
298  return *this;
299  }

References StdBuf::Append().

Here is the call graph for this function:

◆ operator+=() [3/3]

StdStrBuf& StdStrBuf::operator+= ( const StdStrBuf Buf2)
inline

Definition at line 548 of file StdBuf.h.

548 { Append(Buf2); return *this; }

References Append().

Here is the call graph for this function:

◆ operator<()

bool StdStrBuf::operator< ( const StdStrBuf v2) const
inline

Definition at line 571 of file StdBuf.h.

572  {
573  size_t iLen = getLength(), iLen2 = v2.getLength();
574  if (iLen == iLen2)
575  return iLen ? (std::strcmp(getData(), v2.getData())<0) : false;
576  else
577  return iLen < iLen2;
578  }

References getData(), and getLength().

Here is the call graph for this function:

◆ operator=() [1/2]

StdStrBuf& StdStrBuf::operator= ( const char *  szString)
inline

Definition at line 565 of file StdBuf.h.

565 { Ref(szString); return *this; }
void Ref(const char *pnData)
Definition: StdBuf.h:455

References Ref().

Here is the call graph for this function:

◆ operator=() [2/2]

StdStrBuf& StdStrBuf::operator= ( const StdStrBuf Buf2)
inline

Definition at line 564 of file StdBuf.h.

564 { Ref(Buf2); return *this; }

References Ref().

Here is the call graph for this function:

◆ operator==() [1/3]

bool StdStrBuf::operator== ( const char *  szString) const
inline

Definition at line 560 of file StdBuf.h.

560 { return StdStrBuf(szString) == *this; }

References StdStrBuf().

Here is the call graph for this function:

◆ operator==() [2/3]

bool StdBuf::operator== ( const StdBuf Buf2) const
inlineinherited

Definition at line 308 of file StdBuf.h.

309  {
310  return getSize() == Buf2.getSize() && !Compare(Buf2);
311  }

References StdBuf::Compare(), and StdBuf::getSize().

Referenced by StdBuf::operator!=().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator==() [3/3]

bool StdStrBuf::operator== ( const StdStrBuf Buf2) const
inline

Definition at line 554 of file StdBuf.h.

555  {
556  return getLength() == Buf2.getLength() && !Compare(Buf2);
557  }

References Compare(), and getLength().

Referenced by operator!=().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator[]()

char StdStrBuf::operator[] ( size_t  i) const
inline

Definition at line 452 of file StdBuf.h.

452 { return *getPtr(i); }

References getPtr().

Here is the call graph for this function:

◆ Ref() [1/5]

void StdStrBuf::Ref ( const char *  pnData)
inline

◆ Ref() [2/5]

void StdStrBuf::Ref ( const char *  pnData,
size_t  iLength 
)
inline

Definition at line 456 of file StdBuf.h.

456 { assert((!pnData && !iLength) || std::strlen(pnData) == iLength); StdBuf::Ref(pnData, iLength + 1); }

References StdBuf::Ref().

Here is the call graph for this function:

◆ Ref() [3/5]

void StdBuf::Ref ( const StdBuf Buf2)
inlineinherited

Definition at line 266 of file StdBuf.h.

267  {
268  Ref(Buf2.getData(), Buf2.getSize());
269  }

References StdBuf::getData(), StdBuf::getSize(), and StdBuf::Ref().

Here is the call graph for this function:

◆ Ref() [4/5]

void StdStrBuf::Ref ( const StdStrBuf Buf2)
inline

Definition at line 461 of file StdBuf.h.

461 { StdBuf::Ref(Buf2.getData(), Buf2.getSize()); }

References getData(), getSize(), and StdBuf::Ref().

Here is the call graph for this function:

◆ Ref() [5/5]

void StdBuf::Ref ( const void *  pnData,
size_t  inSize 
)
inlineinherited

Definition at line 118 of file StdBuf.h.

119  {
120  Clear();
121  fRef = true; pData = pnData; iSize = inSize;
122  }

References StdBuf::Clear(), StdBuf::fRef, and StdBuf::iSize.

Referenced by StdBuf::Copy(), StdBuf::operator=(), Ref(), StdBuf::Ref(), and StdBuf::StdBuf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Replace()

int StdStrBuf::Replace ( const char *  szOld,
const char *  szNew,
size_t  iStartSearch = 0 
)

Definition at line 284 of file StdBuf.cpp.

285 {
286  if (!getPtr(0) || !szOld) return 0;
287  if (!szNew) szNew = "";
288  int cnt=0;
289  size_t iOldLen = strlen(szOld), iNewLen = strlen(szNew);
290  if (iOldLen != iNewLen)
291  {
292  // count number of occurences to calculate new string length
293  size_t iResultLen = getLength();
294  const char *szPos = getPtr(iStartSearch);
295  while ((szPos = SSearch(szPos, szOld)))
296  {
297  iResultLen += iNewLen - iOldLen;
298  ++cnt;
299  }
300  if (!cnt) return 0;
301  // now construct new string by replacement
302  StdStrBuf sResult;
303  sResult.New(iResultLen+1);
304  const char *szRPos = getPtr(0), *szRNextPos;
305  char *szWrite = sResult.getMPtr(0);
306  if (iStartSearch)
307  {
308  memcpy(szWrite, szRPos, iStartSearch * sizeof(char));
309  szRPos += iStartSearch;
310  szWrite += iStartSearch;
311  }
312  while ((szRNextPos = SSearch(szRPos, szOld)))
313  {
314  memcpy(szWrite, szRPos, (szRNextPos - szRPos - iOldLen) * sizeof(char));
315  szWrite += (szRNextPos - szRPos - iOldLen);
316  memcpy(szWrite, szNew, iNewLen * sizeof(char));
317  szWrite += iNewLen;
318  szRPos = szRNextPos;
319  }
320  strcpy(szWrite, szRPos);
321  Take(std::move(sResult));
322  }
323  else
324  {
325  // replace directly in this string
326  char *szRPos = getMPtr(iStartSearch);
327  while ((szRPos = const_cast<char *>(SSearch(szRPos, szOld))))
328  {
329  memcpy(szRPos - iOldLen, szNew, iOldLen * sizeof(char));
330  ++cnt;
331  }
332  }
333  return cnt;
334 }
const char * SSearch(const char *szString, const char *szIndex)
Definition: Standard.cpp:369

References getLength(), getMPtr(), getPtr(), StdBuf::New(), SSearch(), and Take().

Referenced by EscapeString(), C4ScenarioListLoader::Scenario::LoadCustomPre(), C4MessageInput::ProcessCommand(), C4PlayerInfoList::SetAsRestoreInfos(), C4GUI::ComboBox::SetText(), C4Value::ToJSON(), and C4InVal::ValidateString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReplaceChar()

int StdStrBuf::ReplaceChar ( char  cOld,
char  cNew 
)

Definition at line 336 of file StdBuf.cpp.

337 {
338  if (isNull()) return 0;
339  char *szPos = getMPtr(0);
340  if (!cOld) return 0;
341  if (!cNew) cNew = '_';
342  int cnt=0;
343  while ((szPos = strchr(szPos, cOld)))
344  {
345  *szPos++ = cNew;
346  ++cnt;
347  }
348  return cnt;
349 }

References getMPtr(), and isNull().

Referenced by C4ScenarioParameters::AddFilename2ID(), C4SHead::CompileFunc(), C4DefList::Load(), C4Application::ParseCommandLine(), and C4InVal::ValidateString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReplaceEnd()

void StdStrBuf::ReplaceEnd ( size_t  iPos,
const char *  szNewEnd 
)

Definition at line 351 of file StdBuf.cpp.

352 {
353  size_t iLen = getLength();
354  assert(iPos <= iLen); if (iPos > iLen) return;
355  size_t iEndLen = strlen(szNewEnd);
356  if (iLen - iPos != iEndLen) SetLength(iPos + iEndLen);
357  memcpy(getMPtr(iPos), szNewEnd, iEndLen * sizeof(char));
358 }

References getLength(), getMPtr(), and SetLength().

Referenced by EnforceExtension().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SaveToFile()

bool StdStrBuf::SaveToFile ( const char *  szFile) const

Definition at line 94 of file StdBuf.cpp.

95 {
96  // Open file
97 #ifdef _WIN32
98  int fh = _wopen(::GetWideChar(szFile), O_BINARY | O_CREAT | O_WRONLY | O_SEQUENTIAL | O_TRUNC, S_IREAD | S_IWRITE);
99 #else
100  int fh = open(szFile, O_BINARY | O_CLOEXEC | O_CREAT | O_WRONLY | O_SEQUENTIAL | O_TRUNC, S_IREAD | S_IWRITE);
101 #endif
102  if (fh < 0) return false;
103  // Write data
104  if (write(fh, getData(), getLength()) != (ssize_t) getLength())
105  {
106  close(fh);
107  return false;
108  }
109  close(fh);
110  // Ok
111  return true;
112 }

References getData(), getLength(), GetWideChar(), O_BINARY, O_CLOEXEC, and O_SEQUENTIAL.

Referenced by C4StartupNetDlg::DoOK(), C4Playback::Open(), and C4Config::Save().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetLength()

void StdStrBuf::SetLength ( size_t  iLength)
inline

Definition at line 509 of file StdBuf.h.

510  {
511  if (iLength == getLength() && !isNull()) return;
512  if (iLength >= getLength())
513  Grow(iLength - getLength());
514  else
515  Shrink(getLength() - iLength);
516  }
void Shrink(size_t iShrink)
Definition: StdBuf.h:503

References getLength(), Grow(), isNull(), and Shrink().

Referenced by C4DrawTransform::CompileFunc(), C4Network2IRCClient::Connect(), C4ConfigGeneral::DeterminePaths(), EnsureUnicode(), C4GameParameters::GetGameGoalString(), C4Group::LoadEntryString(), LoadFromFile(), C4TextureMap::LoadTextures(), LogSilent(), C4HTTPClient::Query(), RemoveExtension(), ReplaceEnd(), C4LangStringTable::ReplaceStrings(), TrimSpaces(), and C4InVal::ValidateString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetSize()

void StdBuf::SetSize ( size_t  inSize)
inlineinherited

Definition at line 204 of file StdBuf.h.

205  {
206  if (inSize > iSize)
207  Grow(inSize - iSize);
208  else
209  Shrink(iSize - inSize);
210  }
void Shrink(size_t iShrink)
Definition: StdBuf.h:180

References StdBuf::Grow(), StdBuf::iSize, and StdBuf::Shrink().

Referenced by AppendFormatV(), C4Playback::Check(), C4Record::ClearStreamingBuf(), CStdVectorFont::CStdVectorFont(), C4NetIOSimpleUDP::Execute(), C4Playback::NextSequentialChunk(), C4Playback::ReWriteBinary(), and C4Playback::StreamToRecord().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Shrink()

void StdStrBuf::Shrink ( size_t  iShrink)
inline

Definition at line 503 of file StdBuf.h.

504  {
505  assert(iShrink <= getLength());
506  StdBuf::Shrink(iShrink);
507  *getMPtr(getLength()) = '\0';
508  }

References getLength(), getMPtr(), and StdBuf::Shrink().

Referenced by C4ComponentHost::FinishLoad(), C4GameMessage::Init(), SetLength(), and SplitAtChar().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SplitAtChar()

bool StdStrBuf::SplitAtChar ( char  cSplit,
StdStrBuf psSplit 
)
inline

Definition at line 619 of file StdBuf.h.

620  {
621  if (!getData()) return false;
622  const char *pPos = std::strchr(getData(), cSplit);
623  if (!pPos) return false;
624  size_t iPos = pPos - getData();
625  if (psSplit) psSplit->Take(copyPart(iPos + 1, getLength() - iPos - 1));
626  Shrink(getLength() - iPos);
627  return true;
628  }
StdStrBuf copyPart(size_t iStart, size_t inSize) const
Definition: StdBuf.h:635

References copyPart(), getData(), getLength(), Shrink(), and Take().

Referenced by C4Application::ParseCommandLine(), C4ChatControl::ProcessInput(), C4ChatControl::Update(), and C4InVal::ValidateString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Take() [1/7]

void StdStrBuf::Take ( char *  pnData)
inline

Definition at line 457 of file StdBuf.h.

457 { StdBuf::Take(pnData, pnData ? std::strlen(pnData) + 1 : 0); }
void Take(void *pnData, size_t inSize)
Definition: StdBuf.h:124

References StdBuf::Take().

Referenced by AppendFormatV(), C4ControlJoinPlayer::C4ControlJoinPlayer(), CompileFunc(), C4NetFilenameAdapt::CompileFunc(), C4KeyCodeEx::CompileFunc(), StdCompilerINIRead::CreateNameTree(), C4FileSelDlg::DefaultListItem::DefaultListItem(), C4MainMenu::DoRefillInternal(), EnsureUnicode(), C4GUI::ExpandHotkeyMarkup(), C4Config::ForceRelativePath(), C4EditCursorSelection::GetDataString(), C4PropListStatic::GetDataString(), C4AulFunc::GetFullName(), C4PlayerControlAssignment::GetKeysAsString(), GetWorkingDirectory(), C4AulUserFile::GrabFileContents(), C4MusicSystem::InitForScenario(), C4Network2::LeagueEnd(), C4Network2::LeaguePlrAuth(), C4ScriptHost::LoadData(), C4StartupPlrSelDlg::ListItem::LoadError::LoadError(), C4StartupPlrSelDlg::OnDelBtn(), C4InteractiveThread::ProcessEvents(), Replace(), C4LangStringTable::ReplaceStrings(), C4Scenario::Save(), C4PortraitSelDlg::SelectPortrait(), C4Network2Res::SetByCore(), C4ScenarioListLoader::Entry::SetTitleInGroup(), SplitAtChar(), C4Markup::StripMarkup(), and C4ChatControl::UpdateTitle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Take() [2/7]

void StdStrBuf::Take ( char *  pnData,
size_t  iLength 
)
inline

Definition at line 458 of file StdBuf.h.

458 { assert((!pnData && !iLength) || std::strlen(pnData) == iLength); StdBuf::Take(pnData, iLength + 1); }

References StdBuf::Take().

Here is the call graph for this function:

◆ Take() [3/7]

void StdBuf::Take ( StdBuf &&  Buf2)
inlineinherited

Definition at line 280 of file StdBuf.h.

281  {
282  Take(Buf2.GrabPointer(), Buf2.getSize());
283  }

References StdBuf::Take().

Here is the call graph for this function:

◆ Take() [4/7]

void StdBuf::Take ( StdBuf Buf2)
inlineinherited

Definition at line 276 of file StdBuf.h.

277  {
278  Take(Buf2.GrabPointer(), Buf2.getSize());
279  }

References StdBuf::getSize(), StdBuf::GrabPointer(), and StdBuf::Take().

Here is the call graph for this function:

◆ Take() [5/7]

void StdStrBuf::Take ( StdStrBuf &&  Buf2)
inline

Definition at line 464 of file StdBuf.h.

464 { StdBuf::Take(std::move(Buf2)); }

References StdBuf::Take().

Here is the call graph for this function:

◆ Take() [6/7]

void StdStrBuf::Take ( StdStrBuf Buf2)
inline

Definition at line 463 of file StdBuf.h.

463 { StdBuf::Take(Buf2); }

References StdBuf::Take().

Here is the call graph for this function:

◆ Take() [7/7]

void StdBuf::Take ( void *  pnData,
size_t  inSize 
)
inlineinherited

Definition at line 124 of file StdBuf.h.

125  {
126  Clear();
127  if (pnData)
128  {
129  fRef = false; pMData = pnData; iSize = inSize;
130  }
131  }

References StdBuf::Clear(), StdBuf::fRef, and StdBuf::iSize.

Referenced by C4Network2IO::HandlePacket(), StdBuf::operator=(), C4Network2ResChunk::Set(), StdBuf::StdBuf(), Take(), and StdBuf::Take().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ToLowerCase()

void StdStrBuf::ToLowerCase ( )

Definition at line 385 of file StdBuf.cpp.

386 {
387  if (!isNull())
388  for (char *szPos = getMPtr(0); *szPos; ++szPos)
389  *szPos = tolower(*szPos);
390 }

References getMPtr(), and isNull().

Referenced by StdMeshSkeletonLoader::MakeFullSkeletonPath(), and StdMeshSkeletonLoader::RemoveSkeletonsInGroup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TrimSpaces()

bool StdStrBuf::TrimSpaces ( )

Definition at line 470 of file StdBuf.cpp.

471 {
472  // get left trim
473  int32_t iSpaceLeftCount = 0, iLength = getLength();
474  if (!iLength) return false;
475  const char *szStr = getData();
476  while (iSpaceLeftCount < iLength)
477  if (isspace((unsigned char)(unsigned char) szStr[iSpaceLeftCount]))
478  ++iSpaceLeftCount;
479  else
480  break;
481  // only spaces? Clear!
482  if (iSpaceLeftCount == iLength)
483  {
484  Clear();
485  return true;
486  }
487  // get right trim
488  int32_t iSpaceRightCount = 0;
489  while (isspace((unsigned char)szStr[iLength - 1 - iSpaceRightCount])) ++iSpaceRightCount;
490  // anything to trim?
491  if (!iSpaceLeftCount && !iSpaceRightCount) return false;
492  // only right trim? Can do this by shortening
493  if (!iSpaceLeftCount)
494  {
495  SetLength(iLength - iSpaceRightCount);
496  return true;
497  }
498  // left trim involved - move text and shorten
499  memmove(getMPtr(0), szStr+iSpaceLeftCount, iLength - iSpaceLeftCount - iSpaceRightCount);
500  SetLength(iLength - iSpaceLeftCount - iSpaceRightCount);
501  return true;
502 }

References Clear(), getData(), getLength(), getMPtr(), and SetLength().

Referenced by C4InVal::ValidateString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ValidateChars()

bool StdStrBuf::ValidateChars ( const char *  szInitialChars,
const char *  szMidChars 
)

Definition at line 360 of file StdBuf.cpp.

361 {
362  // only given chars may be in string
363  for (size_t i=0; i<getLength(); ++i)
364  if (!strchr(i ? szMidChars : szInitialChars, getData()[i]))
365  return false;
366  return true;
367 }

References getData(), and getLength().

Referenced by C4InVal::ValidateString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Write() [1/2]

void StdBuf::Write ( const StdBuf Buf2,
size_t  iAt = 0 
)
inlineinherited

Definition at line 213 of file StdBuf.h.

214  {
215  Write(Buf2.getData(), Buf2.getSize(), iAt);
216  }

References StdBuf::getData(), StdBuf::getSize(), and StdBuf::Write().

Here is the call graph for this function:

◆ Write() [2/2]

void StdBuf::Write ( const void *  pnData,
size_t  inSize,
size_t  iAt = 0 
)
inlineinherited

Definition at line 153 of file StdBuf.h.

154  {
155  assert(iAt + inSize <= iSize);
156  if (pnData && inSize) std::memcpy(getMPtr(iAt), pnData, inSize);
157  }
void * getMPtr(size_t i)
Definition: StdBuf.h:105

References StdBuf::getMPtr(), and StdBuf::iSize.

Referenced by Append(), StdBuf::Append(), C4NetIOPacket::C4NetIOPacket(), StdBuf::Copy(), C4NetIOTCP::PackPacket(), StdCompilerBinWrite::Raw(), C4Playback::ReWriteBinary(), StdBuf::Write(), and StdCompilerBinWrite::WriteData().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ 

union { ... }

◆ fRef

bool StdBuf::fRef = true
protectedinherited

◆ iSize


The documentation for this class was generated from the following files: