OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
ValidatedStdCopyStrBuf< V > Struct Template Reference

#include <C4InputValidation.h>

Inheritance diagram for ValidatedStdCopyStrBuf< V >:
[legend]
Collaboration diagram for ValidatedStdCopyStrBuf< V >:
[legend]

Public Member Functions

 ValidatedStdCopyStrBuf (const char *szCopy)
 
 ValidatedStdCopyStrBuf ()
 
bool Validate () override
 
template<class D >
bool operator== (const D &nValue) const
 
template<class D >
ValidatedStdCopyStrBuf< V > & operator= (const D &nValue)
 
void CompileFunc (StdCompiler *pComp, int iRawType=0)
 
void CopyValidated (const char *szFromVal)
 
void CopyValidated (const StdStrBuf &sFromVal)
 
 operator std::string () const
 
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 StdBuf &Buf2) 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 ()
 

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
 
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 = nullptr
 
void * pMData
 
}; 
 
unsigned int iSize = 0
 

Detailed Description

template<int V>
struct ValidatedStdCopyStrBuf< V >

Definition at line 96 of file C4InputValidation.h.

Constructor & Destructor Documentation

template<int V>
ValidatedStdCopyStrBuf< V >::ValidatedStdCopyStrBuf ( const char *  szCopy)
inline

Definition at line 98 of file C4InputValidation.h.

template<int V>
ValidatedStdCopyStrBuf< V >::ValidatedStdCopyStrBuf ( )
inline

Definition at line 99 of file C4InputValidation.h.

Member Function Documentation

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

Definition at line 254 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().

255  {
256  Grow(inSize);
257  Write(pnData, inSize, iSize - inSize);
258  }
void Grow(size_t iGrow)
Definition: StdBuf.h:171
void Write(const void *pnData, size_t inSize, size_t iAt=0)
Definition: StdBuf.h:153
unsigned int iSize
Definition: StdBuf.h:92

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 260 of file StdBuf.h.

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

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

Here is the call graph for this function:

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

Definition at line 519 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::StringN(), C4PropList::ToJSON(), C4Value::ToJSON(), C4KeyCodeEx::ToString(), C4Network2ClientDlg::UpdateText(), C4InVal::ValidateString(), C4AulUserFile::Write(), C4GameSave::WriteDescDefinitions(), C4GameSave::WriteDescLineFeed(), C4GameSave::WriteDescNetworkClients(), C4GameSave::WriteDescPlayers(), and StdCompilerINIWrite::WriteEscaped().

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

Here is the call graph for this function:

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

Definition at line 524 of file StdBuf.h.

References StdStrBuf::Append().

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

Here is the call graph for this function:

void StdStrBuf::Append ( const StdStrBuf Buf2)
inlineinherited

Definition at line 528 of file StdBuf.h.

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

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

Here is the call graph for this function:

void StdStrBuf::AppendBackslash ( )
inherited

Definition at line 248 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().

249 {
250  if(getLength() && *getPtr(getLength() - 1) == DirectorySeparator) return;
252 }
void AppendChar(char cChar)
Definition: StdBuf.h:588
const char * getPtr(size_t i) const
Definition: StdBuf.h:448
size_t getLength() const
Definition: StdBuf.h:445
#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 392 of file StdBuf.cpp.

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

Referenced by FnStringFormat().

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

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 582 of file StdBuf.h.

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

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

583  {
584  Grow(iCnt);
585  for (size_t i = getLength() - iCnt; i < getLength(); i++)
586  *getMPtr(i) = cChar;
587  }
int iCnt
Definition: TstC4NetIO.cpp:32
void Grow(size_t iGrow)
Definition: StdBuf.h:498
size_t getLength() const
Definition: StdBuf.h:445
char * getMPtr(size_t i)
Definition: StdBuf.h:449

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 190 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().

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

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 198 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().

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

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 604 of file StdBuf.h.

References StdStrBuf::Append().

Referenced by StdStrBuf::CopyUntil().

605  {
606  const char *pPos = std::strchr(szString, cUntil);
607  if (pPos)
608  Append(szString, pPos - szString);
609  else
610  Append(szString);
611  }
void Append(const char *pnData, size_t iChars)
Definition: StdBuf.h:519

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 489 of file StdBuf.h.

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

Definition at line 466 of file StdBuf.h.

References StdBuf::Clear().

Referenced by StdMeshMaterialParserCtx::Advance(), StdCompilerINIWrite::Begin(), CStdFont::BreakMessage(), C4ComponentHost::Clear(), C4ScriptHost::Clear(), C4PropertyPath::Clear(), C4Team::Clear(), C4GameRes::Clear(), C4TexMapEntry::Clear(), C4ParticleDef::Clear(), C4Network2ResCore::Clear(), C4PlayerInfo::Clear(), C4TeamList::Clear(), C4MaterialCore::Clear(), C4Game::Clear(), C4GameParameters::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().

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

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 165 of file StdBuf.h.

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

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

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

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 219 of file StdBuf.h.

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

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

Here is the call graph for this function:

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

Definition at line 474 of file StdBuf.h.

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

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

475  {
476  assert(iAt <= getLength());
477  const int result = StdBuf::Compare(Buf2.getData(), std::min(getLength() - iAt, Buf2.getLength()), iAt);
478  if (result) return result;
479 
480  if (getLength() < Buf2.getLength() + iAt) return -1;
481  else if (getLength() > Buf2.getLength() + iAt) return 1;
482  return 0;
483  }
const char * getData() const
Definition: StdBuf.h:442
int Compare(const void *pCData, size_t iCSize, size_t iAt=0) const
Definition: StdBuf.h:165
size_t getLength() const
Definition: StdBuf.h:445

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 484 of file StdBuf.h.

References StdStrBuf::Compare().

Referenced by StdMeshSkeleton::MirrorAnimation().

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

Here is the call graph for this function:

Here is the caller graph for this function:

void ValidatedStdCopyStrBufBase::CompileFunc ( StdCompiler pComp,
int  iRawType = 0 
)
inlineinherited

Definition at line 74 of file C4InputValidation.h.

References StdCompiler::isDeserializer(), mkParAdapt(), ValidatedStdCopyStrBufBase::Validate(), and StdCompiler::Value().

75  {
76  pComp->Value(mkParAdapt(static_cast<StdCopyStrBuf &>(*this), iRawType));
77  if (pComp->isDeserializer()) Validate();
78  }
void Value(const T &rStruct)
Definition: StdCompiler.h:161
virtual bool isDeserializer()
Definition: StdCompiler.h:53
StdParameterAdapt< T, P > mkParAdapt(T &&rObj, P &&rPar)
Definition: StdAdaptors.h:458
virtual bool Validate()=0

Here is the call graph for this function:

void StdBuf::Copy ( size_t  inSize)
inlineinherited

Definition at line 225 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().

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

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 238 of file StdBuf.h.

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

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

Here is the call graph for this function:

void StdBuf::Copy ( const StdBuf Buf2)
inlineinherited

Definition at line 243 of file StdBuf.h.

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

244  {
245  Copy(Buf2.getData(), Buf2.getSize());
246  }
const void * getData() const
Definition: StdBuf.h:99
void Copy()
Definition: StdBuf.h:233
size_t getSize() const
Definition: StdBuf.h:101

Here is the call graph for this function:

void StdStrBuf::Copy ( )
inlineinherited

Definition at line 467 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(), StdCopyStrBuf::operator=(), C4Application::ParseCommandLine(), C4Console::PlayerJoin(), C4ControlJoinPlayer::PreRec(), C4MessageInput::ProcessCommand(), C4ChatControl::ProcessInput(), C4ObjectInfoCore::Promote(), C4Network2::QueryClientPassword(), C4ObjectInfo::Recruit(), C4PlayerList::Save(), C4Game::SaveData(), C4ScenarioSection::ScenarioLoad(), C4DefinitionSelDlg::SelectDefinitions(), C4Network2ResCore::Set(), C4ScriptGuiWindowProperty::Set(), C4PlayerInfoList::SetAsRestoreInfos(), C4Network2Res::SetByCore(), C4Network2Res::SetByGroup(), C4Menu::SetCloseCommand(), C4PlayerControlAssignment::SetControlName(), C4NetIO::SetError(), C4Application::SetGameFont(), C4PlayerInfo::SetLeagueData(), C4ConfigNetwork::SetLeagueLoginData(), C4PlayerInfo::SetLeagueProgressData(), C4ClientCore::SetLocal(), C4Network2::SetPassword(), C4FileSelDlg::SetPath(), C4MusicSystem::SetPlayList(), C4StartupNetListEntry::SetRefQuery(), C4PropertyPath::SetSetPath(), 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().

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

Here is the call graph for this function:

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

Definition at line 468 of file StdBuf.h.

References StdBuf::Copy().

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

Here is the call graph for this function:

void StdStrBuf::Copy ( const StdStrBuf Buf2)
inlineinherited

Definition at line 469 of file StdBuf.h.

References StdBuf::Copy().

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

Here is the call graph for this function:

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

Definition at line 534 of file StdBuf.h.

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

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

Here is the call graph for this function:

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

Definition at line 635 of file StdBuf.h.

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

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

636  {
637  assert(iStart + inSize <= iSize);
638  if (!inSize) return StdStrBuf();
639  StdStrBuf sResult;
640  sResult.Copy(getPtr(iStart), inSize);
641  return sResult;
642  }
unsigned int iSize
Definition: StdBuf.h:92
const char * getPtr(size_t i) const
Definition: StdBuf.h:448
void Copy()
Definition: StdBuf.h:467
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 613 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().

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

Here is the call graph for this function:

Here is the caller graph for this function:

void ValidatedStdCopyStrBufBase::CopyValidated ( const char *  szFromVal)
inlineinherited

Definition at line 82 of file C4InputValidation.h.

References StdStrBuf::Copy(), and ValidatedStdCopyStrBufBase::Validate().

Referenced by C4Network2Reference::InitLocal(), C4GameOptionButtons::OnCommentSet(), C4Application::ParseCommandLine(), C4MessageInput::ProcessCommand(), C4GameVersion::Set(), C4PlayerInfo::SetAsScriptPlayer(), C4PlayerInfo::SetForcedName(), C4PlayerInfo::SetLeagueData(), C4ClientCore::SetLocal(), and C4ClientCore::SetName().

83  {
84  Copy(szFromVal);
85  Validate();
86  }
virtual bool Validate()=0
void Copy()
Definition: StdBuf.h:467

Here is the call graph for this function:

Here is the caller graph for this function:

void ValidatedStdCopyStrBufBase::CopyValidated ( const StdStrBuf sFromVal)
inlineinherited

Definition at line 87 of file C4InputValidation.h.

References StdStrBuf::Copy(), and ValidatedStdCopyStrBufBase::Validate().

88  {
89  Copy(sFromVal);
90  Validate();
91  }
virtual bool Validate()=0
void Copy()
Definition: StdBuf.h:467

Here is the call graph for this function:

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

Definition at line 196 of file StdBuf.h.

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

197  {
198  free(data);
199  }

Here is the caller graph for this function:

StdStrBuf StdStrBuf::Duplicate ( ) const
inlineinherited

Definition at line 470 of file StdBuf.h.

References StdStrBuf::Copy().

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

Here is the call graph for this function:

bool StdStrBuf::EnsureUnicode ( )
inherited

Definition at line 421 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().

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

Here is the call graph for this function:

Here is the caller graph for this function:

void StdStrBuf::EscapeString ( )
inlineinherited

Definition at line 669 of file StdBuf.h.

References StdStrBuf::Replace().

Referenced by C4Value::ToJSON().

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

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 174 of file StdBuf.cpp.

References StdStrBuf::FormatV().

Referenced by C4MainMenu::ActivateGoals(), C4MainMenu::ActivateHost(), C4MainMenu::ActivateNewPlayer(), C4MainMenu::ActivateSavegame(), C4TimeMilliseconds::AsString(), C4LeagueSignupDialog::C4LeagueSignupDialog(), C4PortraitSelDlg::C4PortraitSelDlg(), C4PropertyPath::C4PropertyPath(), C4StartupOptionsDlg::C4StartupOptionsDlg(), C4ScenarioListLoader::Scenario::CanOpen(), C4Playback::Check(), C4StartupNetDlg::CheckVersionUpdate(), C4DrawTransform::CompileFunc(), StdSubMeshInstance::CompileFunc(), CStdFile::Create(), C4ConfigGeneral::CreateSaveFolder(), C4StartupScenSelDlg::DeleteConfirm(), C4PropertyPath::DoCall(), C4EditCursor::DoContextMenu(), C4MainMenu::DoRefillInternal(), C4DownloadDlg::DownloadFile(), 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(), C4PropertyPath::SetProperty(), C4StartupNetListEntry::SetReference(), C4StartupNetListEntry::SetRefQuery(), C4PropertyPath::SetSetPath(), 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().

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

Here is the call graph for this function:

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

Definition at line 182 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().

183 {
184  // Clear previous contents
185  Clear();
186  // Format
187  AppendFormatV(szFmt, args);
188 }
void Clear()
Definition: StdBuf.h:466
void AppendFormatV(const char *szFmt, va_list args)
Definition: StdBuf.cpp:198

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 442 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(), C4ScenarioParameters::CompileFunc(), C4MusicSystem::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(), C4PropertyPath::DoCall(), 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(), C4PropertyPath::GetGetPath(), 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(), C4ScenarioParameterDef::GetName(), C4ClientCore::getName(), C4Network2IRCUser::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(), C4ScenarioListLoader::GetProgressInfo(), StdStrBuf::getRef(), C4Network2RefClient::GetReferences(), C4Network2HTTPClient::getRequest(), C4Network2HTTPClient::getResultString(), C4ClientCore::getRevision(), C4PropertyPath::GetRoot(), C4ScriptHost::GetScript(), C4TeamList::GetScriptPlayerName(), StdStrBuf::GetSection(), C4FileSelDlg::GetSelection(), C4Network2HTTPClient::getServerName(), C4PropertyPath::GetSetPath(), C4Network2IRCMessage::getSource(), C4LeagueResponseHeadStart::getStreamingAddr(), C4GameVersion::GetString(), C4Network2IRCMessage::getTarget(), C4GUI::Label::GetText(), C4GUI::CheckBox::GetText(), C4GUI::ContextMenu::Entry::GetText(), C4TextureMap::GetTexture(), C4TextureMap::GetTextureIndex(), C4TexMapEntry::GetTextureName(), C4Graph::GetTitle(), C4Network2Reference::getTitle(), C4ChatControl::GetTitle(), C4GUI::Tabular::Sheet::GetTitle(), C4GUI::Element::GetToolTip(), C4Network2IRCChannel::getTopic(), C4Game::GetTranslatedString(), 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(), 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(), C4Network2HTTPClient::OnConn(), C4Network2IO::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 *(), StdCopyStrBuf::operator std::string(), 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(), C4PropertyPath::ResolveRoot(), C4MaterialReaction::ResolveScriptFuncs(), C4PropertyPath::ResolveValue(), 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(), C4PropertyPath::SetProperty(), 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().

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

Definition at line 664 of file StdBuf.h.

References StdBuf::GetHash().

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

Here is the call graph for this function:

size_t StdStrBuf::getLength ( ) const
inlineinherited

Definition at line 445 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(), C4PropertyPath::IsEmpty(), 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(), StdCopyStrBuf::operator std::string(), StdStrBuf::operator<(), StdStrBuf::operator==(), C4ScriptHost::Parse(), CStdGL::PrepareMaterial(), C4ChatControl::ProcessInput(), StdCompilerINIWrite::PutName(), C4Network2HTTPClient::Query(), StdStrBuf::Replace(), StdStrBuf::ReplaceEnd(), C4LangStringTable::ReplaceStrings(), C4PropertyPath::ResolveRoot(), C4PropertyPath::ResolveValue(), 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().

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

Here is the call graph for this function:

char* StdStrBuf::getMPtr ( size_t  i)
inlineinherited

Definition at line 449 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().

449 { 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 107 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().

108  {
109  assert(iStart + inSize <= iSize);
110  return StdBuf(getPtr(iStart), inSize);
111  }
StdBuf()=default
unsigned int iSize
Definition: StdBuf.h:92
const void * getPtr(size_t i) const
Definition: StdBuf.h:104

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 448 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().

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

Here is the caller graph for this function:

StdStrBuf StdStrBuf::getRef ( ) const
inlineinherited

Definition at line 462 of file StdBuf.h.

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

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

462 { return StdStrBuf(getData(), getLength()); }
const char * getData() const
Definition: StdBuf.h:442
size_t getLength() const
Definition: StdBuf.h:445
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 369 of file StdBuf.cpp.

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

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

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

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 444 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().

444 { return StdBuf::getSize(); }
size_t getSize() const
Definition: StdBuf.h:101

Here is the call graph for this function:

Here is the caller graph for this function:

char* StdStrBuf::GrabPointer ( )
inlineinherited

Definition at line 459 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().

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

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 498 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().

499  {
500  StdBuf::Grow(getSize() ? iGrow : iGrow + 1);
501  *getMPtr(getLength()) = '\0';
502  }
void Grow(size_t iGrow)
Definition: StdBuf.h:171
size_t getSize() const
Definition: StdBuf.h:444
size_t getLength() const
Definition: StdBuf.h:445
char * getMPtr(size_t i)
Definition: StdBuf.h:449

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 594 of file StdBuf.h.

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

595  {
596  assert(insert_before <= getLength());
597  Grow(1);
598  for (size_t i = getLength()-1; i > insert_before; --i)
599  *getMPtr(i) = *getPtr(i-1);
600  *getMPtr(insert_before) = cChar;
601  }
void Grow(size_t iGrow)
Definition: StdBuf.h:498
const char * getPtr(size_t i) const
Definition: StdBuf.h:448
size_t getLength() const
Definition: StdBuf.h:445
char * getMPtr(size_t i)
Definition: StdBuf.h:449

Here is the call graph for this function:

bool StdStrBuf::isNull ( ) const
inlineinherited

Definition at line 441 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().

441 { return StdBuf::isNull(); }
bool isNull() const
Definition: StdBuf.h:98

Here is the call graph for this function:

Here is the caller graph for this function:

bool StdStrBuf::isRef ( ) const
inlineinherited

Definition at line 446 of file StdBuf.h.

References StdBuf::isRef().

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

Here is the call graph for this function:

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

Definition at line 73 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().

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

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 471 of file StdBuf.h.

References StdBuf::Move().

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

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

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 146 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().

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

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 568 of file StdBuf.h.

References StdStrBuf::getData().

568 { return getData(); }
const char * getData() const
Definition: StdBuf.h:442

Here is the call graph for this function:

StdCopyStrBuf::operator std::string ( ) const
inlineinherited

Definition at line 722 of file StdBuf.h.

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

723  {
724  return std::string(getData(), getLength());
725  }
const char * getData() const
Definition: StdBuf.h:442
size_t getLength() const
Definition: StdBuf.h:445

Here is the call graph for this function:

bool StdStrBuf::operator! ( ) const
inlineinherited

Definition at line 546 of file StdBuf.h.

References StdStrBuf::isNull().

546 { return isNull(); }
bool isNull() const
Definition: StdBuf.h:441

Here is the call graph for this function:

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

Definition at line 312 of file StdBuf.h.

References StdBuf::operator==().

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

Here is the call graph for this function:

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

Definition at line 558 of file StdBuf.h.

References StdStrBuf::operator==().

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

Here is the call graph for this function:

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

Definition at line 561 of file StdBuf.h.

References StdStrBuf::operator==().

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

Here is the call graph for this function:

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

Definition at line 300 of file StdBuf.h.

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

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

Here is the call graph for this function:

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

Definition at line 550 of file StdBuf.h.

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

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

Here is the call graph for this function:

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

Definition at line 551 of file StdBuf.h.

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

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

Here is the call graph for this function:

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

Definition at line 552 of file StdBuf.h.

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

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

Here is the call graph for this function:

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

Definition at line 295 of file StdBuf.h.

References StdBuf::Append().

296  {
297  Append(Buf2);
298  return *this;
299  }
void Append(const void *pnData, size_t inSize)
Definition: StdBuf.h:254

Here is the call graph for this function:

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

Definition at line 548 of file StdBuf.h.

References StdStrBuf::Append().

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

Here is the call graph for this function:

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

Definition at line 549 of file StdBuf.h.

References StdStrBuf::Append().

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

Here is the call graph for this function:

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

Definition at line 571 of file StdBuf.h.

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

572  {
573  size_t iLen = getLength(), iLen2 = v2.getLength();
574  if (iLen == iLen2)
575  return iLen ? (std::strcmp(getData(), v2.getData())<0) : false;
576  else
577  return iLen < iLen2;
578  }
const char * getData() const
Definition: StdBuf.h:442
size_t getLength() const
Definition: StdBuf.h:445

Here is the call graph for this function:

template<int V>
template<class D >
ValidatedStdCopyStrBuf<V>& ValidatedStdCopyStrBuf< V >::operator= ( const D &  nValue)
inline

Definition at line 107 of file C4InputValidation.h.

107 { static_cast<StdCopyStrBuf &>(*this) = nValue; return *this; }
template<int V>
template<class D >
bool ValidatedStdCopyStrBuf< V >::operator== ( const D &  nValue) const
inline

Definition at line 106 of file C4InputValidation.h.

106 { return static_cast<const StdCopyStrBuf &>(*this) == nValue; }
bool StdBuf::operator== ( const StdBuf Buf2) const
inlineinherited

Definition at line 308 of file StdBuf.h.

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

Referenced by StdBuf::operator!=().

309  {
310  return getSize() == Buf2.getSize() && !Compare(Buf2);
311  }
size_t getSize() const
Definition: StdBuf.h:101
int Compare(const void *pCData, size_t iCSize, size_t iAt=0) const
Definition: StdBuf.h:165

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 554 of file StdBuf.h.

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

Referenced by StdStrBuf::operator!=().

555  {
556  return getLength() == Buf2.getLength() && !Compare(Buf2);
557  }
int Compare(const StdStrBuf &Buf2, size_t iAt=0) const
Definition: StdBuf.h:474
size_t getLength() const
Definition: StdBuf.h:445

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 560 of file StdBuf.h.

References StdStrBuf::StdStrBuf().

560 { 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 452 of file StdBuf.h.

References StdStrBuf::getPtr().

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

Here is the call graph for this function:

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

Definition at line 118 of file StdBuf.h.

References StdBuf::Clear().

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

119  {
120  Clear();
121  fRef = true; pData = pnData; iSize = inSize;
122  }
void Clear()
Definition: StdBuf.h:190
bool fRef
Definition: StdBuf.h:82
unsigned int iSize
Definition: StdBuf.h:92

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 266 of file StdBuf.h.

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

267  {
268  Ref(Buf2.getData(), Buf2.getSize());
269  }
const void * getData() const
Definition: StdBuf.h:99
size_t getSize() const
Definition: StdBuf.h:101
void Ref(const void *pnData, size_t inSize)
Definition: StdBuf.h:118

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 456 of file StdBuf.h.

References StdBuf::Ref().

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

Here is the call graph for this function:

void StdStrBuf::Ref ( const StdStrBuf Buf2)
inlineinherited

Definition at line 461 of file StdBuf.h.

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

461 { StdBuf::Ref(Buf2.getData(), Buf2.getSize()); }
const char * getData() const
Definition: StdBuf.h:442
void Ref(const void *pnData, size_t inSize)
Definition: StdBuf.h:118
size_t getSize() const
Definition: StdBuf.h:444

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 284 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().

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

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 336 of file StdBuf.cpp.

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

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

337 {
338  if (isNull()) return 0;
339  char *szPos = getMPtr(0);
340  if (!cOld) return 0;
341  if (!cNew) cNew = '_';
342  int cnt=0;
343  while ((szPos = strchr(szPos, cOld)))
344  {
345  *szPos++ = cNew;
346  ++cnt;
347  }
348  return cnt;
349 }
bool isNull() const
Definition: StdBuf.h:441
char * getMPtr(size_t i)
Definition: StdBuf.h:449

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 351 of file StdBuf.cpp.

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

Referenced by EnforceExtension().

352 {
353  size_t iLen = getLength();
354  assert(iPos <= iLen); if (iPos > iLen) return;
355  size_t iEndLen = strlen(szNewEnd);
356  if (iLen - iPos != iEndLen) SetLength(iPos + iEndLen);
357  memcpy(getMPtr(iPos), szNewEnd, iEndLen * sizeof(char));
358 }
size_t getLength() const
Definition: StdBuf.h:445
void SetLength(size_t iLength)
Definition: StdBuf.h:509
char * getMPtr(size_t i)
Definition: StdBuf.h:449

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 94 of file StdBuf.cpp.

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

Referenced by C4Playback::Open().

95 {
96  // Open file
97 #ifdef _WIN32
98  int fh = _wopen(::GetWideChar(szFile), O_BINARY | O_CREAT | O_WRONLY | O_SEQUENTIAL | O_TRUNC, S_IREAD | S_IWRITE);
99 #else
100  int fh = open(szFile, O_BINARY | O_CLOEXEC | O_CREAT | O_WRONLY | O_SEQUENTIAL | O_TRUNC, S_IREAD | S_IWRITE);
101 #endif
102  if (fh < 0) return false;
103  // Write data
104  if (write(fh, getData(), getLength()) != (ssize_t) getLength())
105  {
106  close(fh);
107  return false;
108  }
109  close(fh);
110  // Ok
111  return true;
112 }
const char * getData() const
Definition: StdBuf.h:442
StdStrBuf::wchar_t_holder GetWideChar(const char *utf8, bool double_null_terminate=false)
#define O_BINARY
Definition: StdBuf.cpp:25
#define O_CLOEXEC
ptrdiff_t ssize_t
size_t getLength() const
Definition: StdBuf.h:445
#define O_SEQUENTIAL
Definition: StdBuf.cpp:26

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 509 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().

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

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 204 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().

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

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 503 of file StdBuf.h.

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

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

504  {
505  assert(iShrink <= getLength());
506  StdBuf::Shrink(iShrink);
507  *getMPtr(getLength()) = '\0';
508  }
void Shrink(size_t iShrink)
Definition: StdBuf.h:180
size_t getLength() const
Definition: StdBuf.h:445
char * getMPtr(size_t i)
Definition: StdBuf.h:449

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 619 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().

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

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 124 of file StdBuf.h.

References StdBuf::Clear().

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

125  {
126  Clear();
127  if (pnData)
128  {
129  fRef = false; pMData = pnData; iSize = inSize;
130  }
131  }
void Clear()
Definition: StdBuf.h:190
bool fRef
Definition: StdBuf.h:82
unsigned int iSize
Definition: StdBuf.h:92

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 276 of file StdBuf.h.

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

277  {
278  Take(Buf2.GrabPointer(), Buf2.getSize());
279  }
void Take(void *pnData, size_t inSize)
Definition: StdBuf.h:124
void * GrabPointer()
Definition: StdBuf.h:133
size_t getSize() const
Definition: StdBuf.h:101

Here is the call graph for this function:

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

Definition at line 280 of file StdBuf.h.

References StdBuf::Take().

281  {
282  Take(Buf2.GrabPointer(), Buf2.getSize());
283  }
void Take(void *pnData, size_t inSize)
Definition: StdBuf.h:124
void * GrabPointer()
Definition: StdBuf.h:133
size_t getSize() const
Definition: StdBuf.h:101

Here is the call graph for this function:

void StdStrBuf::Take ( char *  pnData)
inlineinherited

Definition at line 457 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().

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

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 458 of file StdBuf.h.

References StdBuf::Take().

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

Here is the call graph for this function:

void StdStrBuf::Take ( StdStrBuf Buf2)
inlineinherited

Definition at line 463 of file StdBuf.h.

References StdBuf::Take().

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

Here is the call graph for this function:

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

Definition at line 464 of file StdBuf.h.

References StdBuf::Take().

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

Here is the call graph for this function:

void StdStrBuf::ToLowerCase ( )
inherited

Definition at line 385 of file StdBuf.cpp.

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

Referenced by StdMeshSkeletonLoader::MakeFullSkeletonPath().

386 {
387  if (!isNull())
388  for (char *szPos = getMPtr(0); *szPos; ++szPos)
389  *szPos = tolower(*szPos);
390 }
bool isNull() const
Definition: StdBuf.h:441
char * getMPtr(size_t i)
Definition: StdBuf.h:449

Here is the call graph for this function:

Here is the caller graph for this function:

bool StdStrBuf::TrimSpaces ( )
inherited

Definition at line 470 of file StdBuf.cpp.

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

Referenced by C4InVal::ValidateString().

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

Here is the call graph for this function:

Here is the caller graph for this function:

template<int V>
bool ValidatedStdCopyStrBuf< V >::Validate ( )
inlineoverridevirtual

Implements ValidatedStdCopyStrBufBase.

Definition at line 101 of file C4InputValidation.h.

102  {
104  }
bool ValidateString(char *szString, ValidationOption eOption, size_t iMaxSize)
bool StdStrBuf::ValidateChars ( const char *  szInitialChars,
const char *  szMidChars 
)
inherited

Definition at line 360 of file StdBuf.cpp.

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

Referenced by C4InVal::ValidateString().

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

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 153 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().

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

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 213 of file StdBuf.h.

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

214  {
215  Write(Buf2.getData(), Buf2.getSize(), iAt);
216  }
const void * getData() const
Definition: StdBuf.h:99
size_t getSize() const
Definition: StdBuf.h:101
void Write(const void *pnData, size_t inSize, size_t iAt=0)
Definition: StdBuf.h:153

Here is the call graph for this function:

Member Data Documentation

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

Definition at line 82 of file StdBuf.h.

Referenced by StdBuf::isRef().

unsigned int StdBuf::iSize = 0
protectedinherited

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