OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
StdCopyStrBuf Class Reference

#include <StdBuf.h>

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

Public Member Functions

 StdCopyStrBuf ()=default
 
 StdCopyStrBuf (const StdStrBuf &Buf2, bool fCopy=true)
 
 StdCopyStrBuf (const StdCopyStrBuf &Buf2, bool fCopy=true)
 
 StdCopyStrBuf (StdStrBuf &&Buf2) noexcept
 
 StdCopyStrBuf (StdCopyStrBuf &&Buf2) noexcept
 
 StdCopyStrBuf (const char *pData, bool fCopy=true)
 
StdCopyStrBufoperator= (const StdStrBuf &Buf2)
 
StdCopyStrBufoperator= (const StdCopyStrBuf &Buf2)
 
StdCopyStrBufoperator= (const char *szString)
 
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 Ref (const StdStrBuf &Buf2)
 
void Take (char *pnData)
 
void Take (char *pnData, size_t iLength)
 
void Take (StdStrBuf &Buf2)
 
void Take (StdStrBuf &&Buf2)
 
char * GrabPointer ()
 
StdStrBuf getRef () const
 
void Clear ()
 
void Copy ()
 
void Copy (const char *pnData)
 
void Copy (const StdStrBuf &Buf2)
 
void Copy (const char *pnData, size_t iChars)
 
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)
 
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 char *szString) const
 
bool operator!= (const StdStrBuf &Buf2) const
 
bool operator!= (const char *szString) const
 
 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

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 Copy (size_t inSize)
 
void Copy (const void *pnData, size_t inSize)
 
void Copy (const StdBuf &Buf2)
 
int Compare (const void *pCData, size_t iCSize, size_t iAt=0) const
 
int Compare (const StdBuf &Buf2, size_t iAt=0) const
 
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
 
StdBuf getPart (size_t iStart, size_t inSize) const
 
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)
 
void SetSize (size_t inSize)
 

Static Protected Member Functions

static void DeletePointer (void *data)
 

Protected Attributes

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

Detailed Description

Definition at line 692 of file StdBuf.h.

Constructor & Destructor Documentation

StdCopyStrBuf::StdCopyStrBuf ( )
default
StdCopyStrBuf::StdCopyStrBuf ( const StdStrBuf Buf2,
bool  fCopy = true 
)
inlineexplicit

Definition at line 698 of file StdBuf.h.

699  : StdStrBuf(Buf2.getRef(), fCopy)
700  { }
StdStrBuf getRef() const
Definition: StdBuf.h:470
StdStrBuf()=default
StdCopyStrBuf::StdCopyStrBuf ( const StdCopyStrBuf Buf2,
bool  fCopy = true 
)
inline

Definition at line 702 of file StdBuf.h.

703  : StdStrBuf(Buf2.getRef(), fCopy)
704  { }
StdStrBuf getRef() const
Definition: StdBuf.h:470
StdStrBuf()=default
StdCopyStrBuf::StdCopyStrBuf ( StdStrBuf &&  Buf2)
inlinenoexcept

Definition at line 705 of file StdBuf.h.

706  : StdStrBuf(std::move(Buf2))
707  { }
StdStrBuf()=default
StdCopyStrBuf::StdCopyStrBuf ( StdCopyStrBuf &&  Buf2)
inlinenoexcept

Definition at line 708 of file StdBuf.h.

709  : StdStrBuf(std::move(Buf2))
710  { }
StdStrBuf()=default
StdCopyStrBuf::StdCopyStrBuf ( const char *  pData,
bool  fCopy = true 
)
inlineexplicit

Definition at line 713 of file StdBuf.h.

714  : StdStrBuf(pData, fCopy)
715  { }
StdStrBuf()=default

Member Function Documentation

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

Definition at line 262 of file StdBuf.h.

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

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

263  {
264  Grow(inSize);
265  Write(pnData, inSize, iSize - inSize);
266  }
void Grow(size_t iGrow)
Definition: StdBuf.h:179
void Write(const void *pnData, size_t inSize, size_t iAt=0)
Definition: StdBuf.h:161
unsigned int iSize
Definition: StdBuf.h:100

Here is the call graph for this function:

Here is the caller graph for this function:

void StdBuf::Append ( const StdBuf Buf2)
inlineinherited

Definition at line 268 of file StdBuf.h.

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

269  {
270  Append(Buf2.getData(), Buf2.getSize());
271  }
const void * getData() const
Definition: StdBuf.h:107
size_t getSize() const
Definition: StdBuf.h:109
void Append(const void *pnData, size_t inSize)
Definition: StdBuf.h:262

Here is the call graph for this function:

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

Definition at line 527 of file StdBuf.h.

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

Referenced by C4DefGraphicsPtrBackup::Add(), C4RoundResultsPlayer::AddCustomEvaluationString(), C4RoundResults::AddCustomEvaluationString(), C4ScenarioParameters::AddFilename2ID(), StdStrBuf::Append(), C4PropList::AppendDataString(), StdStrBuf::AppendFormatV(), StdStrBuf::AppendUntil(), StdCompilerINIWrite::Boolean(), CStdFont::BreakMessage(), C4AulParseError::C4AulParseError(), C4Playback::Check(), C4StartupPlrSelDlg::CheckPlayerName(), C4Network2IRCClient::Close(), C4DrawTransform::CompileFunc(), StdStrBuf::Copy(), C4ComponentHost::CopyFilePathFromGroup(), DefaultExtension(), C4DownloadDlg::DownloadFile(), C4Object::Draw(), C4Network2::DrawStatus(), EnforceExtension(), StdStrBuf::EnsureUnicode(), C4Console::FileSaveAs(), FnStringFormat(), C4PlayerInfoList::GetActivePlayerNames(), C4ClientList::GetAllClientNames(), C4Value::GetDataString(), C4PropListStatic::GetDataString(), C4Object::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(), StdStrBuf::operator+(), StdStrBuf::operator+=(), C4Application::ParseCommandLine(), C4Console::PlayerJoin(), StdCompilerINIWrite::PutName(), StdCompilerINIWrite::Raw(), C4AulScriptContext::ReturnDump(), C4Playback::ReWriteText(), C4PlayerInfoCore::Save(), C4GameSave::SaveDesc(), C4TextureMap::SaveMap(), C4Network2Res::SetByCore(), C4StartupNetListEntry::SetReference(), StdCompilerINIWrite::String(), C4PropList::ToJSON(), C4Value::ToJSON(), C4KeyCodeEx::ToString(), C4Network2ClientDlg::UpdateText(), C4InVal::ValidateString(), C4AulUserFile::Write(), C4GameSave::WriteDescDefinitions(), C4GameSave::WriteDescLineFeed(), C4GameSave::WriteDescNetworkClients(), C4GameSave::WriteDescPlayers(), and StdCompilerINIWrite::WriteEscaped().

528  {
529  Grow(iChars);
530  Write(pnData, iChars, iSize - iChars - 1);
531  }
void Write(const void *pnData, size_t inSize, size_t iAt=0)
Definition: StdBuf.h:161
void Grow(size_t iGrow)
Definition: StdBuf.h:506
unsigned int iSize
Definition: StdBuf.h:100

Here is the call graph for this function:

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

Definition at line 532 of file StdBuf.h.

References StdStrBuf::Append().

533  {
534  Append(pnData, std::strlen(pnData));
535  }
void Append(const char *pnData, size_t iChars)
Definition: StdBuf.h:527

Here is the call graph for this function:

void StdStrBuf::Append ( const StdStrBuf Buf2)
inlineinherited

Definition at line 536 of file StdBuf.h.

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

537  {
538  Append(Buf2.getData(), Buf2.getLength());
539  }
const char * getData() const
Definition: StdBuf.h:450
void Append(const char *pnData, size_t iChars)
Definition: StdBuf.h:527
size_t getLength() const
Definition: StdBuf.h:453

Here is the call graph for this function:

void StdStrBuf::AppendBackslash ( )
inherited

Definition at line 255 of file StdBuf.cpp.

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

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

256 {
257  if(getLength() && *getPtr(getLength() - 1) == DirectorySeparator) return;
259 }
void AppendChar(char cChar)
Definition: StdBuf.h:596
const char * getPtr(size_t i) const
Definition: StdBuf.h:456
size_t getLength() const
Definition: StdBuf.h:453
#define DirectorySeparator

Here is the call graph for this function:

Here is the caller graph for this function:

void StdStrBuf::AppendCharacter ( uint32_t  unicodechar)
inherited

Definition at line 399 of file StdBuf.cpp.

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

Referenced by FnStringFormat().

400 {
401  if (unicodechar < 0x80)
402  AppendChar(unicodechar);
403  else if (unicodechar < 0x800)
404  {
405  Grow(2);
406  *getMPtr(getLength() - 2) = (0xC0 | (unicodechar >> 6));
407  *getMPtr(getLength() - 1) = (0x80 | (unicodechar & 0x3F));
408  }
409  else if (unicodechar < 0x10000)
410  {
411  Grow(3);
412  *getMPtr(getLength() - 3) = (0xE0 | (unicodechar >> 12));
413  *getMPtr(getLength() - 2) = (0x80 | ((unicodechar >> 6) & 0x3F));
414  *getMPtr(getLength() - 1) = (0x80 | (unicodechar & 0x3F));
415  }
416  else if (unicodechar < 0x110000)
417  {
418  Grow(4);
419  *getMPtr(getLength() - 4) = (0xF0 | (unicodechar >> 18));
420  *getMPtr(getLength() - 3) = (0x80 | ((unicodechar >> 12) & 0x3F));
421  *getMPtr(getLength() - 2) = (0x80 | ((unicodechar >> 6) & 0x3F));
422  *getMPtr(getLength() - 1) = (0x80 | (unicodechar & 0x3F));
423  }
424  else /* not an unicode code point, ignore */ {}
425 }
void AppendChar(char cChar)
Definition: StdBuf.h:596
void Grow(size_t iGrow)
Definition: StdBuf.h:506
size_t getLength() const
Definition: StdBuf.h:453
char * getMPtr(size_t i)
Definition: StdBuf.h:457

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 590 of file StdBuf.h.

References StdStrBuf::getLength(), StdStrBuf::getMPtr(), and StdStrBuf::Grow().

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

591  {
592  Grow(iCnt);
593  for (size_t i = getLength() - iCnt; i < getLength(); i++)
594  *getMPtr(i) = cChar;
595  }
int iCnt
Definition: TstC4NetIO.cpp:35
void Grow(size_t iGrow)
Definition: StdBuf.h:506
size_t getLength() const
Definition: StdBuf.h:453
char * getMPtr(size_t i)
Definition: StdBuf.h:457

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 197 of file StdBuf.cpp.

References StdStrBuf::AppendFormatV().

Referenced by C4GameMessage::Append(), StdCompilerINIWrite::Byte(), C4AulParseError::C4AulParseError(), StdCompilerINIWrite::Character(), C4Object::Draw(), C4Network2::DrawStatus(), StdCompilerINIWrite::DWord(), C4GUI::ExpandHotkeyMarkup(), FnStringFormat(), 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().

198 {
199  // Create argument list
200  va_list args; va_start(args, szFmt);
201  // Format
202  AppendFormatV(szFmt, args);
203 }
void AppendFormatV(const char *szFmt, va_list args)
Definition: StdBuf.cpp:205

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 205 of file StdBuf.cpp.

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

Referenced by StdStrBuf::AppendFormat(), and StdStrBuf::FormatV().

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 612 of file StdBuf.h.

References StdStrBuf::Append().

Referenced by StdStrBuf::CopyUntil().

613  {
614  const char *pPos = std::strchr(szString, cUntil);
615  if (pPos)
616  Append(szString, pPos - szString);
617  else
618  Append(szString);
619  }
void Append(const char *pnData, size_t iChars)
Definition: StdBuf.h:527

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 497 of file StdBuf.h.

498  {
499  // Return whether string starts with beginning
500  return strncmp((const char
501  *)pData, beginning, strlen(beginning)) == 0;
502  }
void StdStrBuf::Clear ( )
inlineinherited

Definition at line 474 of file StdBuf.h.

References StdBuf::Clear().

Referenced by StdMeshMaterialParserCtx::Advance(), StdCompilerINIWrite::Begin(), CStdFont::BreakMessage(), C4ComponentHost::Clear(), C4ScriptHost::Clear(), C4GameRes::Clear(), C4Team::Clear(), C4TexMapEntry::Clear(), C4ParticleDef::Clear(), C4Network2ResCore::Clear(), C4PlayerInfo::Clear(), C4TeamList::Clear(), C4MaterialCore::Clear(), C4GameParameters::Clear(), C4Game::Clear(), C4RoundResults::Clear(), C4Network2HTTPClient::Clear(), C4Network2::Clear(), C4Player::ClearControl(), C4StartupNetListEntry::ClearRef(), C4Game::CloseScenario(), C4Object::CompileFunc(), StdStrBuf::Copy(), StdStrBuf::CopyUntil(), C4ObjectInfoCore::Default(), C4SHead::Default(), C4PlayerInfoCore::Default(), C4MouseControl::Default(), C4Menu::Default(), C4Object::Default(), C4Game::Default(), C4Player::DefaultRuntimeData(), C4Network2::DeinitLeague(), C4PlayerInfo::DeleteTempFile(), C4RoundResults::EvaluateNetwork(), C4StdInProc::Execute(), C4StartupNetListEntry::Execute(), StdStrBuf::FormatV(), GetLogSection(), StdStrBuf::GetSection(), C4Network2::InitLeague(), C4Network2::LeagueStart(), C4FileSelDlg::ListItem::ListItem(), C4Config::Load(), C4ScriptHost::LoadData(), C4Def::LoadDefCore(), C4Group::LoadEntryString(), C4ScriptHost::MakeScript(), C4MouseControl::Move(), C4Network2HTTPClient::Query(), C4LangStringTable::ReplaceStrings(), 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(), StdStrBuf::TrimSpaces(), C4ObjectInfoCore::UpdateCustomRanks(), and C4InVal::ValidateString().

474 { StdBuf::Clear(); }
void Clear()
Definition: StdBuf.h:198

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 173 of file StdBuf.h.

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

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

174  {
175  assert(iAt + iCSize <= getSize());
176  return std::memcmp(getPtr(iAt), pCData, iCSize);
177  }
size_t getSize() const
Definition: StdBuf.h:109
const void * getPtr(size_t i) const
Definition: StdBuf.h:112

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 227 of file StdBuf.h.

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

228  {
229  return Compare(Buf2.getData(), Buf2.getSize(), iAt);
230  }
const void * getData() const
Definition: StdBuf.h:107
size_t getSize() const
Definition: StdBuf.h:109
int Compare(const void *pCData, size_t iCSize, size_t iAt=0) const
Definition: StdBuf.h:173

Here is the call graph for this function:

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

Definition at line 482 of file StdBuf.h.

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

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

483  {
484  assert(iAt <= getLength());
485  const int result = StdBuf::Compare(Buf2.getData(), std::min(getLength() - iAt, Buf2.getLength()), iAt);
486  if (result) return result;
487 
488  if (getLength() < Buf2.getLength() + iAt) return -1;
489  else if (getLength() > Buf2.getLength() + iAt) return 1;
490  return 0;
491  }
const char * getData() const
Definition: StdBuf.h:450
int Compare(const void *pCData, size_t iCSize, size_t iAt=0) const
Definition: StdBuf.h:173
size_t getLength() const
Definition: StdBuf.h:453

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 492 of file StdBuf.h.

References StdStrBuf::Compare().

Referenced by StdMeshSkeleton::MirrorAnimation().

493  {
494  StdStrBuf str(pCData); // GCC needs this, for some obscure reason
495  return Compare(str, iAt);
496  }
int Compare(const StdStrBuf &Buf2, size_t iAt=0) const
Definition: StdBuf.h:482

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 261 of file StdBuf.cpp.

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

262 {
263  if (pComp->isDeserializer())
264  {
265  char *pnData;
266  pComp->String(&pnData, StdCompiler::RawCompileType(iRawType));
267  Take(pnData);
268  }
269  else
270  {
271  char *pData = const_cast<char *>(getData());
272  if (!pData) pData = const_cast<char *>("");
273  pComp->String(&pData, StdCompiler::RawCompileType(iRawType));
274  }
275 }
const char * getData() const
Definition: StdBuf.h:450
void Take(char *pnData)
Definition: StdBuf.h:465

Here is the call graph for this function:

void StdBuf::Copy ( size_t  inSize)
inlineinherited

Definition at line 233 of file StdBuf.h.

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

Referenced by C4PktBuf::C4PktBuf(), StdBuf::Duplicate(), and C4Network2HTTPClient::UnpackPacket().

234  {
235  if (isNull() && !inSize) return;
236  const void *pOldData = getData();
237  size_t iOldSize = iSize;
238  New(inSize);
239  Write(pOldData, std::min(iOldSize, inSize));
240  }
const void * getData() const
Definition: StdBuf.h:107
bool isNull() const
Definition: StdBuf.h:106
void New(size_t inSize)
Definition: StdBuf.h:154
void Write(const void *pnData, size_t inSize, size_t iAt=0)
Definition: StdBuf.h:161
unsigned int iSize
Definition: StdBuf.h:100

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 246 of file StdBuf.h.

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

247  {
248  Ref(pnData, inSize); Copy();
249  }
void Copy()
Definition: StdBuf.h:241
void Ref(const void *pnData, size_t inSize)
Definition: StdBuf.h:126

Here is the call graph for this function:

void StdBuf::Copy ( const StdBuf Buf2)
inlineinherited

Definition at line 251 of file StdBuf.h.

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

252  {
253  Copy(Buf2.getData(), Buf2.getSize());
254  }
const void * getData() const
Definition: StdBuf.h:107
void Copy()
Definition: StdBuf.h:241
size_t getSize() const
Definition: StdBuf.h:109

Here is the call graph for this function:

void StdStrBuf::Copy ( )
inlineinherited

Definition at line 475 of file StdBuf.h.

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(), C4ComponentHost::CopyFilePathFromGroup(), StdStrBuf::copyPart(), ValidatedStdCopyStrBufBase::CopyValidated(), C4ObjectInfoCore::Default(), C4FileSelDlg::DefaultListItem::DefaultListItem(), C4EditCursor::DoContextMenu(), C4Application::DoInit(), StdStrBuf::Duplicate(), C4ScenarioSection::EnsureTempStore(), C4GUI::ContextMenu::Entry::Entry(), C4RoundResults::EvaluateNetwork(), C4RoundResultsPlayer::EvaluatePlayer(), C4StartupNetListEntry::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(), StdStrBuf::GetSection(), C4FileSelDlg::GetSelection(), C4LeagueClient::GetStartReply(), C4LeagueClient::GetUpdateReply(), C4Language::Init(), C4GameMessage::Init(), C4Shader::Init(), C4Game::Init(), C4Player::Init(), C4PlayerControlAssignmentSet::InitEmptyFromTemplate(), C4KeyCodeEx::KeyCode2String(), C4Network2::LeagueEnd(), C4Network2::LeaguePlrAuth(), C4FileSelDlg::ListItem::ListItem(), C4ComponentHost::Load(), C4ParticleDef::Load(), C4Surface::Load(), C4Config::Load(), C4ScriptHost::LoadData(), C4SoundSystem::LoadEffects(), C4Reloc::LocateItem(), MakeTempFilename(), C4Config::MakeTempUpdateFolder(), StdCompilerINIWrite::Name(), C4StartupPlrSelDlg::OnDelBtnConfirm(), C4StartupNetListEntry::OnReference(), C4Game::OpenScenario(), 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(), C4Startup::SetStartScreen(), C4GUI::Label::SetText(), C4GUI::Button::SetText(), C4Landscape::SetTextureIndex(), C4Graph::SetTitle(), C4GUI::GroupBox::SetTitle(), C4GUI::Dialog::SetTitle(), C4ScenarioListLoader::Entry::SetTitleInGroup(), C4GUI::Element::SetToolTip(), C4GUI::Tabular::Sheet::Sheet(), C4LeagueSignupDialog::ShowModal(), C4StartupScenSelDlg::StartScenario(), C4Record::Stop(), C4Network2::StreamOut(), C4Playback::StreamToRecord(), C4Network2HTTPClient::UnpackPacket(), C4ChatControl::Update(), C4ObjectInfoCore::UpdateCustomRanks(), C4InVal::ValidateString(), and C4GameSave::WriteDescDefinitions().

475 { StdBuf::Copy(); }
void Copy()
Definition: StdBuf.h:241

Here is the call graph for this function:

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

Definition at line 476 of file StdBuf.h.

References StdBuf::Copy().

476 { StdBuf::Copy(pnData, pnData ? std::strlen(pnData) + 1 : 0); }
void Copy()
Definition: StdBuf.h:241

Here is the call graph for this function:

void StdStrBuf::Copy ( const StdStrBuf Buf2)
inlineinherited

Definition at line 477 of file StdBuf.h.

References StdBuf::Copy().

477 { StdBuf::Copy(Buf2); }
void Copy()
Definition: StdBuf.h:241

Here is the call graph for this function:

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

Definition at line 542 of file StdBuf.h.

References StdStrBuf::Append(), and StdStrBuf::Clear().

543  {
544  Clear();
545  Append(pnData, iChars);
546  }
void Clear()
Definition: StdBuf.h:474
void Append(const char *pnData, size_t iChars)
Definition: StdBuf.h:527

Here is the call graph for this function:

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

Definition at line 643 of file StdBuf.h.

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

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

644  {
645  assert(iStart + inSize <= iSize);
646  if (!inSize) return StdStrBuf();
647  StdStrBuf sResult;
648  sResult.Copy(getPtr(iStart), inSize);
649  return sResult;
650  }
unsigned int iSize
Definition: StdBuf.h:100
const char * getPtr(size_t i) const
Definition: StdBuf.h:456
void Copy()
Definition: StdBuf.h:475
StdStrBuf()=default

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 621 of file StdBuf.h.

References StdStrBuf::AppendUntil(), and StdStrBuf::Clear().

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

622  {
623  Clear();
624  AppendUntil(szString, cUntil);
625  }
void Clear()
Definition: StdBuf.h:474
void AppendUntil(const char *szString, char cUntil)
Definition: StdBuf.h:612

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 204 of file StdBuf.h.

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

205  {
206  free(data);
207  }

Here is the caller graph for this function:

StdStrBuf StdStrBuf::Duplicate ( ) const
inlineinherited

Definition at line 478 of file StdBuf.h.

References StdStrBuf::Copy().

478 { StdStrBuf Buf; Buf.Copy(*this); return Buf; }
void Copy()
Definition: StdBuf.h:475

Here is the call graph for this function:

bool StdStrBuf::EnsureUnicode ( )
inherited

Definition at line 428 of file StdBuf.cpp.

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

Referenced by C4ComponentHost::FinishLoad().

429 {
430  // assume that it's windows-1252 and convert to utf-8
431  if (!IsValidUtf8(getData(), getLength()))
432  {
433  size_t j = 0;
434  StdStrBuf buf;
435  buf.Grow(getLength());
436  // totally unfounded statistic: most texts have less than 20 umlauts.
437  enum { GROWSIZE = 20 };
438  for (size_t i = 0; i < getSize(); ++i)
439  {
440  unsigned char c = *getPtr(i);
441  // ASCII
442  if (c < 0x80)
443  {
444  if (j >= buf.getLength())
445  buf.Grow(GROWSIZE);
446  *buf.getMPtr(j++) = c;
447  continue;
448  }
449  // Is c one of the control characters only in ISO/IEC_8859-1 or part of the common subset with windows-1252?
450  if (c == 0x81 || c == 0x8D || c == 0x8F || c == 0x90 || c == 0x9D || c >= 0xA0)
451  {
452  if (j + 1 >= buf.getLength())
453  buf.Grow(GROWSIZE);
454  *buf.getMPtr(j++) = (0xC0 | (c >> 6));
455  *buf.getMPtr(j++) = (0x80 | (c & 0x3F));
456  continue;
457  }
458  // Extra windows-1252-characters
459  buf.SetLength(j);
460  static const char * extra_chars [] =
461  {
462  //"€", 0, "‚", "ƒ", "„", "…", "†", "‡", "ˆ", "‰", "Š", "‹", "Œ", 0, "Ž", 0,
463  // 0, "‘", "’", "“", "”", "•", "–", "—", "˜", "™", "š", "›", "œ", 0, "ž", "Ÿ" };
464  "\xe2\x82\xac", 0, "\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", 0, "\xc5\xbd", 0,
465  0, "\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", 0, "\xc5\xbe", "\xc5\xb8"
466  };
467  buf.Append(extra_chars[c - 0x80]);
468  j += strlen(extra_chars[c - 0x80]);
469  }
470  buf.SetLength(j);
471  Take(std::move(buf));
472  return true;
473  }
474  return false;
475 }
const char * getData() const
Definition: StdBuf.h:450
void Take(char *pnData)
Definition: StdBuf.h:465
void Append(const char *pnData, size_t iChars)
Definition: StdBuf.h:527
bool IsValidUtf8(const char *text, int length)
Definition: Standard.cpp:682
void Grow(size_t iGrow)
Definition: StdBuf.h:506
size_t getSize() const
Definition: StdBuf.h:452
const char * getPtr(size_t i) const
Definition: StdBuf.h:456
size_t getLength() const
Definition: StdBuf.h:453
void SetLength(size_t iLength)
Definition: StdBuf.h:517
char * getMPtr(size_t i)
Definition: StdBuf.h:457

Here is the call graph for this function:

Here is the caller graph for this function:

void StdStrBuf::EscapeString ( )
inlineinherited

Definition at line 677 of file StdBuf.h.

References StdStrBuf::Replace().

Referenced by C4Value::ToJSON().

678  {
679  Replace("\\", "\\\\");
680  Replace("\"", "\\\"");
681  }
int Replace(const char *szOld, const char *szNew, size_t iStartSearch=0)
Definition: StdBuf.cpp:291

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 181 of file StdBuf.cpp.

References StdStrBuf::FormatV().

Referenced by C4MainMenu::ActivateGoals(), C4MainMenu::ActivateHost(), C4MainMenu::ActivateNewPlayer(), C4MainMenu::ActivateSavegame(), C4TimeMilliseconds::AsString(), C4LeagueSignupDialog::C4LeagueSignupDialog(), C4PortraitSelDlg::C4PortraitSelDlg(), C4StartupOptionsDlg::C4StartupOptionsDlg(), C4ScenarioListLoader::Scenario::CanOpen(), C4Playback::Check(), C4StartupNetDlg::CheckVersionUpdate(), C4DrawTransform::CompileFunc(), StdSubMeshInstance::CompileFunc(), CStdFile::Create(), C4ConfigGeneral::CreateSaveFolder(), C4StartupScenSelDlg::DeleteConfirm(), C4EditCursor::DoContextMenu(), C4MainMenu::DoRefillInternal(), C4DownloadDlg::DownloadFile(), C4Object::Draw(), C4Game::DrawCrewOverheadText(), C4StartupMainDlg::DrawElement(), C4Chart::DrawElement(), C4TableGraph::DumpToFile(), C4Command::Fail(), C4GraphicsSystem::FlashMessageOnOff(), C4EditCursorSelection::GetDataString(), C4StartupPlrSelDlg::PlayerListItem::GetDelWarning(), C4ControlVote::getDesc(), C4PlayerInfo::GetLobbyName(), C4RankSystem::GetRankName(), C4Network2::HandleConn(), C4Console::HelpAbout(), C4KeyCodeEx::KeyCode2String(), C4StartupScenSelDlg::KeyDelete(), C4ComponentHost::Load(), StdMeshMaterialTextureUnit::Load(), C4Network2::OnClientDisconnect(), C4Network2HTTPClient::OnConn(), C4ChatControl::OnConnectBtn(), C4Network2HTTPClient::OnDisconn(), C4DownloadDlg::OnIdle(), C4StartupNetListEntry::OnReference(), OpenLog(), C4Network2::OpenVoteDialog(), C4MessageInput::ProcessCommand(), C4Network2HTTPClient::Query(), 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(), C4StartupNetListEntry::SetReference(), C4StartupNetListEntry::SetRefQuery(), C4ScenarioListLoader::Entry::SetTitleInGroup(), C4Record::Start(), StdMeshMaterialError::StdMeshMaterialError(), C4ScriptGuiWindow::ToC4Value(), C4ChatControl::Update(), C4Network2ClientListDlg::Update(), C4Console::UpdateNetMenu(), C4Console::UpdatePlayerMenu(), C4EditCursor::UpdateStatusBar(), C4Console::UpdateStatusBars(), C4Console::UpdateViewportMenu(), and C4FullScreen::ViewportCheck().

182 {
183  // Create argument list
184  va_list args; va_start(args, szFmt);
185  // Format
186  FormatV(szFmt, args);
187 }
void FormatV(const char *szFmt, va_list args)
Definition: StdBuf.cpp:189

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 189 of file StdBuf.cpp.

References StdStrBuf::AppendFormatV(), and StdStrBuf::Clear().

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

190 {
191  // Clear previous contents
192  Clear();
193  // Format
194  AppendFormatV(szFmt, args);
195 }
void Clear()
Definition: StdBuf.h:474
void AppendFormatV(const char *szFmt, va_list args)
Definition: StdBuf.cpp:205

Here is the call graph for this function:

Here is the caller graph for this function:

const char* StdStrBuf::getData ( ) const
inlineinherited

Definition at line 450 of file StdBuf.h.

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(), StdStrBuf::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(), C4ID::C4ID(), C4LeagueSignupDialog::C4LeagueSignupDialog(), C4PortraitSelDlg::C4PortraitSelDlg(), C4StartupOptionsDlg::C4StartupOptionsDlg(), C4Playback::Check(), C4StartupPlrSelDlg::CheckPlayerName(), C4TextureMap::CheckTexture(), C4StartupNetDlg::CheckVersionUpdate(), C4Network2IRCClient::Close(), C4Language::CloseGroup(), C4Game::CloseScenario(), StdStrBuf::Compare(), CompileFromBuf_Log(), CompileFromBuf_LogWarn(), C4MaterialReaction::CompileFunc(), C4DrawTransform::CompileFunc(), C4MusicSystem::CompileFunc(), C4ScenarioParameters::CompileFunc(), C4ObjectList::CompileFunc(), C4Effect::CompileFunc(), C4DefGraphicsAdapt::CompileFunc(), C4Value::CompileFunc(), C4Object::CompileFunc(), C4KeyCodeEx::CompileFunc(), StdSubMeshInstance::CompileFunc(), C4Game::CompileFunc(), StdMeshInstanceAnimationNode::CompileFunc(), C4CustomKey::CompileFunc(), StdStrBuf::CompileFunc(), StdEnumAdapt< T, int_t >::CompileFunc(), StdBitfieldAdapt< T >::CompileFunc(), C4Network2IO::Connect(), ConsoleDlgProc(), CopyDirectory(), C4ComponentHost::CopyFilePathFromGroup(), CStdFile::Create(), C4GUI::Dialog::CreateConsoleWindow(), C4ScenarioListLoader::Entry::CreateEntryForFile(), C4ConfigGeneral::CreateSaveFolder(), C4Game::CreateSectionFromTempFile(), CreateValueProviderFromArray(), C4MaterialMap::CrossMapMaterials(), CStdVectorFont::CStdVectorFont(), DebugLogF(), C4AulDebug::DebugStep(), DecompileToBuf_Log(), C4PlayerInfoCore::Default(), DefaultExtension(), C4FileSelDlg::DefaultListItem::DefaultListItem(), C4StartupScenSelDlg::DeleteConfirm(), C4PlayerInfo::DeleteTempFile(), C4ConfigGeneral::DeterminePaths(), DisplayGroup(), C4EditCursor::DoContextMenu(), C4EditCursor::DoContextObjCommand(), C4Application::DoInit(), C4ScenarioListLoader::SubFolder::DoLoadContents(), C4ScenarioListLoader::RegularFolder::DoLoadContents(), C4StartupNetDlg::DoOK(), C4StartupScenSelDlg::DoOK(), C4MainMenu::DoRefillInternal(), C4StartupNetDlg::DoRefresh(), C4Startup::DoStartup(), C4UpdatePackage::DoUpdate(), C4DownloadDlg::DownloadFile(), C4UpperBoard::Draw(), C4LoaderScreen::Draw(), C4GameMessage::Draw(), C4MouseControl::Draw(), C4Object::Draw(), C4ScriptGuiWindow::Draw(), C4Game::DrawCrewOverheadText(), C4StartupMainDlg::DrawElement(), C4MenuItem::DrawElement(), C4Chart::DrawElement(), 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(), C4Network2::DrawStatus(), C4GUI::Screen::DrawToolTip(), C4AulScriptFunc::DumpByteCode(), C4TableGraph::DumpToFile(), C4LeagueClient::End(), EnforceExtension(), C4ScenarioSection::EnsureTempStore(), StdStrBuf::EnsureUnicode(), C4GUI::ContextMenu::Entry::Entry(), EntrySortFunc(), StdMeshLoader::StdMeshXML::Error(), StdMeshMaterialParserCtx::Error(), C4Game::Evaluate(), C4Object::ExecLife(), C4StdInProc::Execute(), C4UpdatePackage::Execute(), C4Player::Execute(), C4Network2HTTPClient::Execute(), CPNGSaveThread::Execute(), C4Config::ExpandEnvironmentVariables(), C4GUI::ExpandHotkeyMarkup(), C4Command::Fail(), C4Console::FileNew(), C4Console::FileOpen(), C4Console::FileOpenWPlrs(), C4Console::FileSaveAs(), C4Group::FindEntry(), C4Group::FindNextEntry(), C4ComponentHost::FinishLoad(), C4GraphicsSystem::FlashMessageOnOff(), 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(), C4NetIO::GetError(), GetFatalError(), C4LeagueResponseHead::getFBID(), C4GameRes::getFile(), C4AulUserFile::GetFileContents(), C4FileSelDlg::ListItem::GetFilename(), C4Network2ResCore::getFileName(), StdMeshMaterialShader::GetFilename(), C4PlayerInfo::GetFilename(), C4ComponentHost::GetFilePath(), C4PlayerInfo::GetForcedName(), C4Network2Reference::getGameGoalString(), C4GameParameters::GetGameGoalString(), C4Network2Stats::GetGraphByName(), C4ScenarioSection::GetGroupfile(), C4PlayerControlDef::GetGUIDesc(), C4PlayerControlAssignment::GetGUIDesc(), C4PlayerControlDef::GetGUIName(), C4PlayerControlAssignment::GetGUIName(), C4PlayerControlAssignmentSet::GetGUIName(), C4Team::GetIconSpec(), C4GameLobby::C4PacketSetScenarioParameter::GetID(), C4ScenarioParameterDef::GetID(), C4PlayerControlDef::GetIdentifier(), C4TextureMap::GetIndexMatTex(), C4ComponentHost::GetLanguageString(), C4LeagueResponseHeadStart::getLeague(), C4GameParameters::getLeague(), C4LeagueResponseHeadUpdate::getLeague(), C4PlayerInfo::getLeagueAccount(), C4PlayerInfo::GetLeagueProgressData(), C4PlayerInfo::GetLobbyName(), C4PlayerInfo::GetLocalJoinFilename(), C4LeagueResponseHead::getLoginToken(), GetLogPos(), GetLogSection(), C4TexMapEntry::GetMaterialName(), C4LeagueResponseHead::getMessage(), C4MessageBoard::GetMessagePlayer(), C4PacketConnRe::getMsg(), C4ClientCore::getName(), C4Network2IRCUser::getName(), C4ScenarioParameterDef::GetName(), C4Network2IRCChannel::getName(), C4Player::GetName(), C4PlayerInfo::GetName(), C4PlayerControlAssignmentSet::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(), StdStrBuf::getRef(), C4Network2RefClient::GetReferences(), C4Network2HTTPClient::getRequest(), C4Network2HTTPClient::getResultString(), C4ClientCore::getRevision(), C4ScriptHost::GetScript(), C4TeamList::GetScriptPlayerName(), StdStrBuf::GetSection(), C4FileSelDlg::GetSelection(), C4Network2HTTPClient::getServerName(), C4Network2IRCMessage::getSource(), C4LeagueResponseHeadStart::getStreamingAddr(), C4GameVersion::GetString(), C4Network2IRCMessage::getTarget(), C4GUI::Label::GetText(), C4GUI::CheckBox::GetText(), C4GUI::ContextMenu::Entry::GetText(), C4TextureMap::GetTexture(), C4TextureMap::GetTextureIndex(), C4TexMapEntry::GetTextureName(), C4Graph::GetTitle(), C4Network2Reference::getTitle(), C4ChatControl::GetTitle(), C4GUI::Tabular::Sheet::GetTitle(), C4GUI::Element::GetToolTip(), C4Network2IRCChannel::getTopic(), C4Network2UpdateClient::GetUpdateURL(), C4Network2IRCClient::getUserName(), C4Network2UpdateClient::GetVersion(), GetWorkingDirectory(), C4Network2::HandleConn(), C4Network2::HandleConnRe(), C4Network2IO::HandlePacket(), C4GUI::IconButton::IconButton(), C4GUI::InfoDialog::InfoDialog(), C4Reloc::Init(), C4RankSystem::Init(), C4Language::Init(), C4TexMapEntry::Init(), C4SoundModifierList::Init(), C4Shader::Init(), C4Player::InitControl(), C4MusicSystem::InitForScenario(), C4Game::InitGame(), C4Network2::InitLeague(), C4Menu::InitLocation(), C4GameRes::InitNetwork(), C4Game::InitNetworkFromAddress(), 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(), C4ComponentHost::Load(), C4UpdatePackage::Load(), C4ObjectInfoCore::Load(), C4Landscape::Load(), C4ScenarioListLoader::Entry::Load(), C4GameResList::Load(), C4ParticleDef::Load(), C4StartupPlrSelDlg::PlayerListItem::Load(), StdMeshMaterialShaderParameters::Load(), C4PlayerInfoCore::Load(), C4Surface::Load(), C4MaterialCore::Load(), C4GameParameters::Load(), C4Player::Load(), StdMeshMaterialSubLoader::Load(), C4ScenarioListLoader::Load(), C4Config::Load(), StdMeshMaterialTextureUnit::Load(), StdMeshMaterialPass::Load(), StdMeshMaterialTechnique::Load(), StdMeshMaterial::Load(), C4Game::LoadAdditionalSystemGroup(), C4DefGraphics::LoadBitmap(), C4ScenarioListLoader::Scenario::LoadCustomPre(), C4Def::LoadDefCore(), C4SoundSystem::LoadEffects(), C4Group::LoadEntry(), C4GroupSet::LoadEntryString(), C4Group::LoadEntryString(), C4MaterialMap::LoadEnumeration(), C4TextureMap::LoadFlags(), StdMeshLoader::LoadMeshBinary(), StdMeshLoader::LoadMeshXml(), C4Player::LoadRuntimeData(), C4Game::LoadScenarioSection(), LoadShader(), StdMeshSkeletonLoader::LoadSkeletonXml(), C4TextureMap::LoadTextures(), C4Reloc::LocateItem(), LogF(), LogFatal(), LogSilent(), LogSilentF(), C4Player::MakeCrewMember(), MakeOriginalFilename(), MakeTempFilename(), C4Config::MakeTempUpdateFolder(), C4Network2IRCClient::Message(), C4GUI::MessageDialog::MessageDialog(), StdMeshSkeleton::MirrorAnimation(), C4UpdatePackage::MkUp(), C4StartupPlrSelDlg::PlayerListItem::MoveFilename(), C4Network2IRCClient::Notice(), C4GameOptionButtons::OnBtnComment(), C4StartupNetDlg::OnChatTitleChange(), C4ChatDlg::OnChatTitleChange(), C4Network2::OnClientDisconnect(), C4StartupPlrPropertiesDlg::OnClosed(), C4GameOptionButtons::OnCommentSet(), C4Network2IO::OnConn(), C4Network2HTTPClient::OnConn(), C4Network2::OnConnect(), 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(), C4StartupMainDlg::OnShown(), C4DefinitionSelDlg::OnShown(), C4Playback::Open(), OpenLog(), C4Game::OpenScenario(), C4Network2::OpenVoteDialog(), C4Reloc::PathInfo::operator const char *(), StdStrBuf::operator const void *(), StdStrBuf::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(), C4Network2HTTPClient::Query(), C4Network2::QueryClientPassword(), C4Game::QuickSave(), C4Playback::ReadBinary(), RealPath(), C4PlayerInfoList::RecreatePlayerFiles(), C4PlayerInfoList::RecreatePlayers(), StdStrBuf::Ref(), C4Shader::Refresh(), C4KeyboardInput::RegisterKey(), C4ScenarioParameterDefs::RegisterScriptConstants(), C4StringTable::RegString(), C4ParticleDef::Reload(), C4Game::ReloadParticle(), RemoveExtension(), C4ScenarioListLoader::Entry::RenameTo(), C4LangStringTable::ReplaceStrings(), C4LeagueClient::ReportDisconnect(), C4PlayerControlAssignment::ResolveRefs(), C4MaterialReaction::ResolveScriptFuncs(), C4PlayerInfoList::RestoreSavegameInfos(), C4GameResList::RetrieveFiles(), C4Network2::RetrieveScenario(), C4AulScriptContext::ReturnDump(), C4Playback::ReWriteBinary(), C4ObjectInfo::Save(), C4PlayerList::Save(), C4PlayerInfoCore::Save(), C4Config::Save(), C4StartupOptionsDlg::SaveConfig(), C4GameSave::SaveDesc(), C4Game::SaveGameTitle(), C4TextureMap::SaveMap(), C4Console::SaveScenario(), StdStrBuf::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(), C4StartupNetListEntry::SetReference(), C4StartupPlrSelDlg::PlayerListItem::SetSelectionInfo(), C4Network2HTTPClient::SetServer(), C4GUI::Label::SetText(), C4GUI::ComboBox::SetText(), C4Landscape::SetTextureIndex(), C4ScenarioListLoader::Entry::SetTitleInGroup(), ShaderLogF(), C4LeagueSignupDialog::ShowModal(), StdStrBuf::SplitAtChar(), C4GameLobby::MainDlg::Start(), C4LeagueClient::Start(), C4Record::Start(), C4StartupScenSelDlg::StartScenario(), C4Record::StartStreaming(), StdMeshMaterialError::StdMeshMaterialError(), C4Record::Stop(), StdMeshSkeletonLoader::StoreSkeleton(), C4Network2::StreamOut(), C4Playback::StreamToRecord(), C4KeyCodeEx::String2KeyCode(), C4KeyCodeEx::String2KeyShift(), C4Playback::Strip(), C4ControlJoinPlayer::Strip(), C4Value::ToJSON(), C4EditCursor::ToolFailure(), ToolsDlgProc(), C4Network2Address::toString(), StdStrBuf::TrimSpaces(), C4Menu::TryClose(), C4Network2HTTPClient::UnpackPacket(), C4KeyboardInput::UnregisterKey(), C4KeyboardInput::UnregisterKeyBinding(), C4FoWLightSection::Update(), C4ChatControl::Update(), C4Network2ClientListDlg::Update(), C4LeagueClient::Update(), C4Menu::UpdateElementPositions(), C4ScriptGuiWindow::UpdateLayout(), C4Console::UpdateNetMenu(), C4Network2ClientDlg::UpdateText(), C4LeagueSignupDialog::UserClose(), StdStrBuf::ValidateChars(), C4InVal::ValidateString(), C4FullScreen::ViewportCheck(), ViewportWinProc(), C4ScriptHost::Warn(), StdCompiler::Warn(), StdMeshMaterialParserCtx::WarningNotSupported(), StdMeshMaterialError::what(), C4DrawGLError::what(), WildcardListMatch(), C4GameSaveRecord::WriteDesc(), and C4ScenarioSection::~C4ScenarioSection().

450 { return getBufPtr<char>(*this); }
int StdStrBuf::GetHash ( ) const
inlineinherited

Definition at line 672 of file StdBuf.h.

References StdBuf::GetHash().

673  {
674  return StdBuf::GetHash();
675  }
int GetHash() const
Definition: StdBuf.h:330

Here is the call graph for this function:

size_t StdStrBuf::getLength ( ) const
inlineinherited

Definition at line 453 of file StdBuf.h.

References StdStrBuf::getSize().

Referenced by C4Group::Add(), C4RoundResultsPlayer::AddCustomEvaluationString(), C4RoundResults::AddCustomEvaluationString(), C4ScenarioParameters::AddFilename2ID(), StdStrBuf::Append(), StdStrBuf::AppendBackslash(), StdStrBuf::AppendCharacter(), StdStrBuf::AppendChars(), StdStrBuf::AppendFormatV(), C4Object::AssignInfo(), C4LeagueClient::AuthCheck(), C4StartupOptionsDlg::C4StartupOptionsDlg(), C4StartupPlrSelDlg::CheckPlayerName(), StdStrBuf::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(), C4AulScriptFunc::DumpByteCode(), C4LeagueClient::End(), StdStrBuf::EnsureUnicode(), C4Config::ExpandEnvironmentVariables(), C4Player::GainScenarioAchievement(), C4ComponentHost::GetDataSize(), C4AulUserFile::GetFileLength(), C4Network2Reference::getGameGoalString(), C4GameParameters::GetGameGoalString(), C4PlayerControlAssignment::GetGUIDesc(), C4PlayerControlAssignment::GetGUIName(), C4Object::GetInfoString(), C4PlayerInfo::GetLobbyName(), C4SDefinitions::GetModules(), C4PlayerInfo::GetName(), C4Language::GetPackGroups(), StdStrBuf::getRef(), C4TeamList::GetScriptPlayerName(), StdStrBuf::GetSection(), C4FileSelDlg::GetSelection(), StdStrBuf::Grow(), C4GUI::GroupBox::HasTitle(), C4GUI::InfoDialog::InfoDialog(), C4GameMessage::Init(), C4SoundModifierList::Init(), C4Network2::InitLeague(), StdStrBuf::InsertChar(), ircExtractPar(), C4ScenarioParameterDef::IsAchievement(), C4Network2IRCMessage::isChannel(), C4GameParameters::isLeague(), C4ClientCore::isRegistered(), C4PlayerInfo::IsUsingName(), C4KeyCodeEx::KeyCode2String(), C4Network2::LeagueEnd(), C4Network2::LeaguePlrAuth(), C4Network2::LeagueStart(), C4Network2::LeagueUpdateProcessReply(), StdStrBuf::LoadFromFile(), LoadShader(), C4TextureMap::LoadTextures(), LogSilent(), MakeTempFilename(), StdMeshSkeleton::MirrorAnimation(), C4GameMessageList::New(), C4Playback::Open(), C4Game::OpenScenario(), StdStrBuf::operator<(), StdStrBuf::operator==(), C4ScriptHost::Parse(), CStdGL::PrepareMaterial(), C4ChatControl::ProcessInput(), StdCompilerINIWrite::PutName(), C4Network2HTTPClient::Query(), StdStrBuf::Replace(), StdStrBuf::ReplaceEnd(), C4LangStringTable::ReplaceStrings(), C4UpdatePackageCore::Save(), C4RoundResults::Save(), C4Config::Save(), C4TextureMap::SaveMap(), StdStrBuf::SaveToFile(), C4Network2IRCClient::Send(), C4NetIO::EndpointAddress::SetAddress(), StdStrBuf::SetLength(), C4ClientCore::SetLocal(), StdStrBuf::Shrink(), StdStrBuf::SplitAtChar(), C4KeyCodeEx::String2KeyCode(), C4KeyCodeEx::ToString(), StdStrBuf::TrimSpaces(), C4ChatControl::Update(), C4LeagueClient::Update(), StdStrBuf::ValidateChars(), and C4InVal::ValidateString().

453 { return getSize() ? getSize() - 1 : 0; }
size_t getSize() const
Definition: StdBuf.h:452

Here is the call graph for this function:

char* StdStrBuf::getMPtr ( size_t  i)
inlineinherited

Definition at line 457 of file StdBuf.h.

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

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

Here is the caller graph for this function:

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

Definition at line 115 of file StdBuf.h.

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

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

116  {
117  assert(iStart + inSize <= iSize);
118  return StdBuf(getPtr(iStart), inSize);
119  }
StdBuf()=default
unsigned int iSize
Definition: StdBuf.h:100
const void * getPtr(size_t i) const
Definition: StdBuf.h:112

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 456 of file StdBuf.h.

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

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

Here is the caller graph for this function:

StdStrBuf StdStrBuf::getRef ( ) const
inlineinherited

Definition at line 470 of file StdBuf.h.

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

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

470 { return StdStrBuf(getData(), getLength()); }
const char * getData() const
Definition: StdBuf.h:450
size_t getLength() const
Definition: StdBuf.h:453
StdStrBuf()=default

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 376 of file StdBuf.cpp.

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

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

377 {
378  assert(psOutSection);
379  psOutSection->Clear();
380  const char *szStr = getData(), *szSepPos;
381  if (!szStr) return false; // invaid argument
382  while ((szSepPos = strchr(szStr, cSeparator)) && idx) { szStr = szSepPos+1; --idx; }
383  if (idx) return false; // indexed section not found
384  // fill output buffer with section, if not empty
385  if (!szSepPos) szSepPos = getData() + getLength();
386  if (szSepPos != szStr) psOutSection->Copy(szStr, szSepPos - szStr);
387  // return true even if section is empty, because the section obviously exists
388  // (to enable loops like while (buf.GetSection(i++, &sect)) if (sect) ...)
389  return true;
390 }
const char * getData() const
Definition: StdBuf.h:450
void Clear()
Definition: StdBuf.h:474
size_t getLength() const
Definition: StdBuf.h:453
void Copy()
Definition: StdBuf.h:475

Here is the call graph for this function:

Here is the caller graph for this function:

size_t StdStrBuf::getSize ( ) const
inlineinherited

Definition at line 452 of file StdBuf.h.

References StdBuf::getSize().

Referenced by c4_group_handle_get_full_name(), C4ObjectInfoCore::Decompile(), StdStrBuf::EnsureUnicode(), C4ComponentHost::FinishLoad(), C4ClientList::GetAllClientNames(), StdStrBuf::getLength(), GetLogSection(), StdStrBuf::Grow(), C4Game::HasScenario(), C4Game::OpenScenario(), and StdStrBuf::Ref().

452 { return StdBuf::getSize(); }
size_t getSize() const
Definition: StdBuf.h:109

Here is the call graph for this function:

Here is the caller graph for this function:

char* StdStrBuf::GrabPointer ( )
inlineinherited

Definition at line 467 of file StdBuf.h.

References StdBuf::GrabPointer().

Referenced by C4Group::Add(), C4ValueMapData::CompileFunc(), C4ObjectInfoCore::Decompile(), C4FileSelDlg::DefaultListItem::DefaultListItem(), C4Network2HTTPClient::Query(), C4Network2Res::SetByCore(), C4ScenarioListLoader::Entry::SetTitleInGroup(), C4Markup::StripMarkup(), C4InteractiveThread::ThreadLog(), C4InteractiveThread::ThreadLogDebug(), C4InteractiveThread::ThreadLogFatal(), and C4InteractiveThread::ThreadLogS().

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

Here is the call graph for this function:

Here is the caller graph for this function:

void StdStrBuf::Grow ( size_t  iGrow)
inlineinherited

Definition at line 506 of file StdBuf.h.

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

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

507  {
508  StdBuf::Grow(getSize() ? iGrow : iGrow + 1);
509  *getMPtr(getLength()) = '\0';
510  }
void Grow(size_t iGrow)
Definition: StdBuf.h:179
size_t getSize() const
Definition: StdBuf.h:452
size_t getLength() const
Definition: StdBuf.h:453
char * getMPtr(size_t i)
Definition: StdBuf.h:457

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 602 of file StdBuf.h.

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

603  {
604  assert(insert_before <= getLength());
605  Grow(1);
606  for (size_t i = getLength()-1; i > insert_before; --i)
607  *getMPtr(i) = *getPtr(i-1);
608  *getMPtr(insert_before) = cChar;
609  }
void Grow(size_t iGrow)
Definition: StdBuf.h:506
const char * getPtr(size_t i) const
Definition: StdBuf.h:456
size_t getLength() const
Definition: StdBuf.h:453
char * getMPtr(size_t i)
Definition: StdBuf.h:457

Here is the call graph for this function:

bool StdStrBuf::isNull ( ) const
inlineinherited

Definition at line 449 of file StdBuf.h.

References StdBuf::isNull().

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

449 { return StdBuf::isNull(); }
bool isNull() const
Definition: StdBuf.h:106

Here is the call graph for this function:

Here is the caller graph for this function:

bool StdStrBuf::isRef ( ) const
inlineinherited

Definition at line 454 of file StdBuf.h.

References StdBuf::isRef().

454 { return StdBuf::isRef(); }
bool isRef() const
Definition: StdBuf.h:110

Here is the call graph for this function:

bool StdStrBuf::LoadFromFile ( const char *  szFile)
inherited

Definition at line 80 of file StdBuf.cpp.

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

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

81 {
82  // Open file
83 #ifdef _WIN32
84  int fh = _wopen(::GetWideChar(szFile), O_BINARY | O_RDONLY | O_SEQUENTIAL, S_IREAD | S_IWRITE);
85 #else
86  int fh = open(szFile, O_BINARY | O_CLOEXEC | O_RDONLY | O_SEQUENTIAL, S_IREAD | S_IWRITE);
87 #endif
88  if (fh < 0) return false;
89  // Create buf
90  SetLength(FileSize(fh));
91  // Read
92  if (read(fh, getMData(), getLength()) != (ssize_t) getLength())
93  {
94  close(fh);
95  return false;
96  }
97  close(fh);
98  // Ok
99  return true;
100 }
StdStrBuf::wchar_t_holder GetWideChar(const char *utf8, bool double_null_terminate=false)
#define O_BINARY
Definition: StdBuf.cpp:28
#define O_CLOEXEC
char * getMData()
Definition: StdBuf.h:451
ptrdiff_t ssize_t
size_t FileSize(const char *szFilename)
Definition: StdFile.cpp:448
size_t getLength() const
Definition: StdBuf.h:453
void SetLength(size_t iLength)
Definition: StdBuf.h:517
#define O_SEQUENTIAL
Definition: StdBuf.cpp:29

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 479 of file StdBuf.h.

References StdBuf::Move().

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

void StdBuf::New ( size_t  inSize)
inlineinherited

Definition at line 154 of file StdBuf.h.

References StdBuf::Clear().

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

155  {
156  Clear();
157  pMData = malloc(iSize = inSize);
158  fRef = false;
159  }
void Clear()
Definition: StdBuf.h:198
bool fRef
Definition: StdBuf.h:90
unsigned int iSize
Definition: StdBuf.h:100

Here is the call graph for this function:

Here is the caller graph for this function:

StdStrBuf::operator const void * ( ) const
inlineinherited

Definition at line 576 of file StdBuf.h.

References StdStrBuf::getData().

576 { return getData(); }
const char * getData() const
Definition: StdBuf.h:450

Here is the call graph for this function:

bool StdStrBuf::operator! ( ) const
inlineinherited

Definition at line 554 of file StdBuf.h.

References StdStrBuf::isNull().

554 { return isNull(); }
bool isNull() const
Definition: StdBuf.h:449

Here is the call graph for this function:

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

Definition at line 320 of file StdBuf.h.

References StdBuf::operator==().

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

Here is the call graph for this function:

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

Definition at line 566 of file StdBuf.h.

References StdStrBuf::operator==().

566 { return !operator == (Buf2); }
bool operator==(const StdStrBuf &Buf2) const
Definition: StdBuf.h:562

Here is the call graph for this function:

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

Definition at line 569 of file StdBuf.h.

References StdStrBuf::operator==().

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

Here is the call graph for this function:

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

Definition at line 308 of file StdBuf.h.

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

309  {
310  StdBuf Buf(getRef());
311  Buf.Append(Buf2);
312  return Buf;
313  }
Definition: StdBuf.h:37
StdBuf getRef() const
Definition: StdBuf.h:279

Here is the call graph for this function:

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

Definition at line 558 of file StdBuf.h.

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

558 { StdStrBuf Buf = getRef(); Buf.Append(Buf2); return Buf; }
StdStrBuf getRef() const
Definition: StdBuf.h:470
void Append(const char *pnData, size_t iChars)
Definition: StdBuf.h:527

Here is the call graph for this function:

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

Definition at line 559 of file StdBuf.h.

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

559 { StdStrBuf Buf = getRef(); Buf.Append(szString); return Buf; }
StdStrBuf getRef() const
Definition: StdBuf.h:470
void Append(const char *pnData, size_t iChars)
Definition: StdBuf.h:527

Here is the call graph for this function:

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

Definition at line 560 of file StdBuf.h.

References StdStrBuf::AppendChar(), and StdStrBuf::getRef().

560 { StdStrBuf Buf = getRef(); Buf.AppendChar(c); return Buf; }
void AppendChar(char cChar)
Definition: StdBuf.h:596
StdStrBuf getRef() const
Definition: StdBuf.h:470

Here is the call graph for this function:

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

Definition at line 303 of file StdBuf.h.

References StdBuf::Append().

304  {
305  Append(Buf2);
306  return *this;
307  }
void Append(const void *pnData, size_t inSize)
Definition: StdBuf.h:262

Here is the call graph for this function:

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

Definition at line 556 of file StdBuf.h.

References StdStrBuf::Append().

556 { Append(Buf2); return *this; }
void Append(const char *pnData, size_t iChars)
Definition: StdBuf.h:527

Here is the call graph for this function:

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

Definition at line 557 of file StdBuf.h.

References StdStrBuf::Append().

557 { Append(szString); return *this; }
void Append(const char *pnData, size_t iChars)
Definition: StdBuf.h:527

Here is the call graph for this function:

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

Definition at line 579 of file StdBuf.h.

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

580  {
581  size_t iLen = getLength(), iLen2 = v2.getLength();
582  if (iLen == iLen2)
583  return iLen ? (std::strcmp(getData(), v2.getData())<0) : false;
584  else
585  return iLen < iLen2;
586  }
const char * getData() const
Definition: StdBuf.h:450
size_t getLength() const
Definition: StdBuf.h:453

Here is the call graph for this function:

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

Definition at line 721 of file StdBuf.h.

References StdStrBuf::Copy().

721 { Copy(Buf2); return *this; }
void Copy()
Definition: StdBuf.h:475

Here is the call graph for this function:

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

Definition at line 722 of file StdBuf.h.

References StdStrBuf::Copy().

722 { Copy(Buf2); return *this; }
void Copy()
Definition: StdBuf.h:475

Here is the call graph for this function:

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

Definition at line 723 of file StdBuf.h.

References StdStrBuf::Copy().

723 { Copy(szString); return *this; }
void Copy()
Definition: StdBuf.h:475

Here is the call graph for this function:

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

Definition at line 316 of file StdBuf.h.

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

Referenced by StdBuf::operator!=().

317  {
318  return getSize() == Buf2.getSize() && !Compare(Buf2);
319  }
size_t getSize() const
Definition: StdBuf.h:109
int Compare(const void *pCData, size_t iCSize, size_t iAt=0) const
Definition: StdBuf.h:173

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 562 of file StdBuf.h.

References StdStrBuf::Compare(), and StdStrBuf::getLength().

Referenced by StdStrBuf::operator!=().

563  {
564  return getLength() == Buf2.getLength() && !Compare(Buf2);
565  }
int Compare(const StdStrBuf &Buf2, size_t iAt=0) const
Definition: StdBuf.h:482
size_t getLength() const
Definition: StdBuf.h:453

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 568 of file StdBuf.h.

References StdStrBuf::StdStrBuf().

568 { return StdStrBuf(szString) == *this; }
StdStrBuf()=default

Here is the call graph for this function:

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

Definition at line 460 of file StdBuf.h.

References StdStrBuf::getPtr().

460 { return *getPtr(i); }
const char * getPtr(size_t i) const
Definition: StdBuf.h:456

Here is the call graph for this function:

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

Definition at line 126 of file StdBuf.h.

References StdBuf::Clear().

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

127  {
128  Clear();
129  fRef = true; pData = pnData; iSize = inSize;
130  }
void Clear()
Definition: StdBuf.h:198
bool fRef
Definition: StdBuf.h:90
unsigned int iSize
Definition: StdBuf.h:100

Here is the call graph for this function:

Here is the caller graph for this function:

void StdBuf::Ref ( const StdBuf Buf2)
inlineinherited

Definition at line 274 of file StdBuf.h.

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

275  {
276  Ref(Buf2.getData(), Buf2.getSize());
277  }
const void * getData() const
Definition: StdBuf.h:107
size_t getSize() const
Definition: StdBuf.h:109
void Ref(const void *pnData, size_t inSize)
Definition: StdBuf.h:126

Here is the call graph for this function:

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

Definition at line 464 of file StdBuf.h.

References StdBuf::Ref().

464 { assert((!pnData && !iLength) || std::strlen(pnData) == iLength); StdBuf::Ref(pnData, iLength + 1); }
void Ref(const void *pnData, size_t inSize)
Definition: StdBuf.h:126

Here is the call graph for this function:

void StdStrBuf::Ref ( const StdStrBuf Buf2)
inlineinherited

Definition at line 469 of file StdBuf.h.

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

469 { StdBuf::Ref(Buf2.getData(), Buf2.getSize()); }
const char * getData() const
Definition: StdBuf.h:450
void Ref(const void *pnData, size_t inSize)
Definition: StdBuf.h:126
size_t getSize() const
Definition: StdBuf.h:452

Here is the call graph for this function:

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

Definition at line 291 of file StdBuf.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 343 of file StdBuf.cpp.

References StdStrBuf::getMPtr(), and StdStrBuf::isNull().

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

344 {
345  if (isNull()) return 0;
346  char *szPos = getMPtr(0);
347  if (!cOld) return 0;
348  if (!cNew) cNew = '_';
349  int cnt=0;
350  while ((szPos = strchr(szPos, cOld)))
351  {
352  *szPos++ = cNew;
353  ++cnt;
354  }
355  return cnt;
356 }
bool isNull() const
Definition: StdBuf.h:449
char * getMPtr(size_t i)
Definition: StdBuf.h:457

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 358 of file StdBuf.cpp.

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

Referenced by EnforceExtension().

359 {
360  size_t iLen = getLength();
361  assert(iPos <= iLen); if (iPos > iLen) return;
362  size_t iEndLen = strlen(szNewEnd);
363  if (iLen - iPos != iEndLen) SetLength(iPos + iEndLen);
364  memcpy(getMPtr(iPos), szNewEnd, iEndLen * sizeof(char));
365 }
size_t getLength() const
Definition: StdBuf.h:453
void SetLength(size_t iLength)
Definition: StdBuf.h:517
char * getMPtr(size_t i)
Definition: StdBuf.h:457

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 101 of file StdBuf.cpp.

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

Referenced by C4Playback::Open().

102 {
103  // Open file
104 #ifdef _WIN32
105  int fh = _wopen(::GetWideChar(szFile), O_BINARY | O_CREAT | O_WRONLY | O_SEQUENTIAL | O_TRUNC, S_IREAD | S_IWRITE);
106 #else
107  int fh = open(szFile, O_BINARY | O_CLOEXEC | O_CREAT | O_WRONLY | O_SEQUENTIAL | O_TRUNC, S_IREAD | S_IWRITE);
108 #endif
109  if (fh < 0) return false;
110  // Write data
111  if (write(fh, getData(), getLength()) != (ssize_t) getLength())
112  {
113  close(fh);
114  return false;
115  }
116  close(fh);
117  // Ok
118  return true;
119 }
const char * getData() const
Definition: StdBuf.h:450
StdStrBuf::wchar_t_holder GetWideChar(const char *utf8, bool double_null_terminate=false)
#define O_BINARY
Definition: StdBuf.cpp:28
#define O_CLOEXEC
ptrdiff_t ssize_t
size_t getLength() const
Definition: StdBuf.h:453
#define O_SEQUENTIAL
Definition: StdBuf.cpp:29

Here is the call graph for this function:

Here is the caller graph for this function:

void StdStrBuf::SetLength ( size_t  iLength)
inlineinherited

Definition at line 517 of file StdBuf.h.

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

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

518  {
519  if (iLength == getLength() && !isNull()) return;
520  if (iLength >= getLength())
521  Grow(iLength - getLength());
522  else
523  Shrink(getLength() - iLength);
524  }
void Grow(size_t iGrow)
Definition: StdBuf.h:506
bool isNull() const
Definition: StdBuf.h:449
void Shrink(size_t iShrink)
Definition: StdBuf.h:511
size_t getLength() const
Definition: StdBuf.h:453

Here is the call graph for this function:

Here is the caller graph for this function:

void StdBuf::SetSize ( size_t  inSize)
inlineinherited

Definition at line 212 of file StdBuf.h.

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

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

213  {
214  if (inSize > iSize)
215  Grow(inSize - iSize);
216  else
217  Shrink(iSize - inSize);
218  }
void Grow(size_t iGrow)
Definition: StdBuf.h:179
void Shrink(size_t iShrink)
Definition: StdBuf.h:188
unsigned int iSize
Definition: StdBuf.h:100

Here is the call graph for this function:

Here is the caller graph for this function:

void StdStrBuf::Shrink ( size_t  iShrink)
inlineinherited

Definition at line 511 of file StdBuf.h.

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

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

512  {
513  assert(iShrink <= getLength());
514  StdBuf::Shrink(iShrink);
515  *getMPtr(getLength()) = '\0';
516  }
void Shrink(size_t iShrink)
Definition: StdBuf.h:188
size_t getLength() const
Definition: StdBuf.h:453
char * getMPtr(size_t i)
Definition: StdBuf.h:457

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 627 of file StdBuf.h.

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

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

628  {
629  if (!getData()) return false;
630  const char *pPos = std::strchr(getData(), cSplit);
631  if (!pPos) return false;
632  size_t iPos = pPos - getData();
633  if (psSplit) psSplit->Take(copyPart(iPos + 1, getLength() - iPos - 1));
634  Shrink(getLength() - iPos);
635  return true;
636  }
const char * getData() const
Definition: StdBuf.h:450
void Take(char *pnData)
Definition: StdBuf.h:465
StdStrBuf copyPart(size_t iStart, size_t inSize) const
Definition: StdBuf.h:643
void Shrink(size_t iShrink)
Definition: StdBuf.h:511
size_t getLength() const
Definition: StdBuf.h:453

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 132 of file StdBuf.h.

References StdBuf::Clear().

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

133  {
134  Clear();
135  if (pnData)
136  {
137  fRef = false; pMData = pnData; iSize = inSize;
138  }
139  }
void Clear()
Definition: StdBuf.h:198
bool fRef
Definition: StdBuf.h:90
unsigned int iSize
Definition: StdBuf.h:100

Here is the call graph for this function:

Here is the caller graph for this function:

void StdBuf::Take ( StdBuf Buf2)
inlineinherited

Definition at line 284 of file StdBuf.h.

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

285  {
286  Take(Buf2.GrabPointer(), Buf2.getSize());
287  }
void Take(void *pnData, size_t inSize)
Definition: StdBuf.h:132
void * GrabPointer()
Definition: StdBuf.h:141
size_t getSize() const
Definition: StdBuf.h:109

Here is the call graph for this function:

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

Definition at line 288 of file StdBuf.h.

References StdBuf::Take().

289  {
290  Take(Buf2.GrabPointer(), Buf2.getSize());
291  }
void Take(void *pnData, size_t inSize)
Definition: StdBuf.h:132
void * GrabPointer()
Definition: StdBuf.h:141
size_t getSize() const
Definition: StdBuf.h:109

Here is the call graph for this function:

void StdStrBuf::Take ( char *  pnData)
inlineinherited

Definition at line 465 of file StdBuf.h.

References StdBuf::Take().

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 466 of file StdBuf.h.

References StdBuf::Take().

466 { assert((!pnData && !iLength) || std::strlen(pnData) == iLength); StdBuf::Take(pnData, iLength + 1); }
void Take(void *pnData, size_t inSize)
Definition: StdBuf.h:132

Here is the call graph for this function:

void StdStrBuf::Take ( StdStrBuf Buf2)
inlineinherited

Definition at line 471 of file StdBuf.h.

References StdBuf::Take().

471 { StdBuf::Take(Buf2); }
void Take(void *pnData, size_t inSize)
Definition: StdBuf.h:132

Here is the call graph for this function:

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

Definition at line 472 of file StdBuf.h.

References StdBuf::Take().

472 { StdBuf::Take(std::move(Buf2)); }
void Take(void *pnData, size_t inSize)
Definition: StdBuf.h:132

Here is the call graph for this function:

void StdStrBuf::ToLowerCase ( )
inherited

Definition at line 392 of file StdBuf.cpp.

References StdStrBuf::getMPtr(), and StdStrBuf::isNull().

Referenced by StdMeshSkeletonLoader::MakeFullSkeletonPath().

393 {
394  if (!isNull())
395  for (char *szPos = getMPtr(0); *szPos; ++szPos)
396  *szPos = tolower(*szPos);
397 }
bool isNull() const
Definition: StdBuf.h:449
char * getMPtr(size_t i)
Definition: StdBuf.h:457

Here is the call graph for this function:

Here is the caller graph for this function:

bool StdStrBuf::TrimSpaces ( )
inherited

Definition at line 477 of file StdBuf.cpp.

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

Referenced by C4InVal::ValidateString().

478 {
479  // get left trim
480  int32_t iSpaceLeftCount = 0, iLength = getLength();
481  if (!iLength) return false;
482  const char *szStr = getData();
483  while (iSpaceLeftCount < iLength)
484  if (isspace((unsigned char)(unsigned char) szStr[iSpaceLeftCount]))
485  ++iSpaceLeftCount;
486  else
487  break;
488  // only spaces? Clear!
489  if (iSpaceLeftCount == iLength)
490  {
491  Clear();
492  return true;
493  }
494  // get right trim
495  int32_t iSpaceRightCount = 0;
496  while (isspace((unsigned char)szStr[iLength - 1 - iSpaceRightCount])) ++iSpaceRightCount;
497  // anything to trim?
498  if (!iSpaceLeftCount && !iSpaceRightCount) return false;
499  // only right trim? Can do this by shortening
500  if (!iSpaceLeftCount)
501  {
502  SetLength(iLength - iSpaceRightCount);
503  return true;
504  }
505  // left trim involved - move text and shorten
506  memmove(getMPtr(0), szStr+iSpaceLeftCount, iLength - iSpaceLeftCount - iSpaceRightCount);
507  SetLength(iLength - iSpaceLeftCount - iSpaceRightCount);
508  return true;
509 }
const char * getData() const
Definition: StdBuf.h:450
void Clear()
Definition: StdBuf.h:474
size_t getLength() const
Definition: StdBuf.h:453
void SetLength(size_t iLength)
Definition: StdBuf.h:517
char * getMPtr(size_t i)
Definition: StdBuf.h:457

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 367 of file StdBuf.cpp.

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

Referenced by C4InVal::ValidateString().

368 {
369  // only given chars may be in string
370  for (size_t i=0; i<getLength(); ++i)
371  if (!strchr(i ? szMidChars : szInitialChars, getData()[i]))
372  return false;
373  return true;
374 }
const char * getData() const
Definition: StdBuf.h:450
size_t getLength() const
Definition: StdBuf.h:453

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 161 of file StdBuf.h.

References StdBuf::getMPtr().

Referenced by C4NetIOUDP::Packet::AddFragment(), StdBuf::Append(), StdStrBuf::Append(), C4NetIOPacket::C4NetIOPacket(), StdBuf::Copy(), C4NetIOUDP::Peer::DoCheck(), C4NetIOUDP::Packet::GetFragment(), C4NetpuncherPacket::PackTo(), StdCompilerBinWrite::Raw(), StdBuf::Write(), and StdCompilerBinWrite::WriteData().

162  {
163  assert(iAt + inSize <= iSize);
164  if (pnData && inSize) std::memcpy(getMPtr(iAt), pnData, inSize);
165  }
void * getMPtr(size_t i)
Definition: StdBuf.h:113
unsigned int iSize
Definition: StdBuf.h:100

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 221 of file StdBuf.h.

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

222  {
223  Write(Buf2.getData(), Buf2.getSize(), iAt);
224  }
const void * getData() const
Definition: StdBuf.h:107
size_t getSize() const
Definition: StdBuf.h:109
void Write(const void *pnData, size_t inSize, size_t iAt=0)
Definition: StdBuf.h:161

Here is the call graph for this function:

Member Data Documentation

union { ... }
bool StdBuf::fRef = true
protectedinherited

Definition at line 90 of file StdBuf.h.

Referenced by StdBuf::isRef().

unsigned int StdBuf::iSize = 0
protectedinherited

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