More string fixes

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
Esteban Papp
2021-07-29 15:53:32 -07:00
parent 95c6fd83ea
commit 99bf5e54c4
43 changed files with 439 additions and 432 deletions
+3 -8
View File
@@ -112,7 +112,7 @@ public:
CAnimParamType()
: m_type(kAnimParamTypeInvalid) {}
CAnimParamType(const string& name)
CAnimParamType(const AZStd::string& name)
{
*this = name;
}
@@ -128,17 +128,12 @@ public:
m_type = type;
}
void operator =(const string& name)
{
m_type = kAnimParamTypeByString;
m_name = name;
}
void operator =(const AZStd::string& name)
{
m_type = kAnimParamTypeByString;
m_name = name;
}
// Convert to enum. This needs to be explicit,
// otherwise operator== will be ambiguous
AnimParamType GetType() const { return m_type; }
@@ -1437,7 +1432,7 @@ inline void SAnimContext::Serialize(XmlNodeRef& xmlNode, bool bLoading)
{
if (sequence)
{
string fullname = sequence->GetName();
AZStd::string fullname = sequence->GetName();
xmlNode->setAttr("sequence", fullname.c_str());
}
xmlNode->setAttr("dt", dt);
+5 -5
View File
@@ -46,7 +46,7 @@ public:
virtual AZ::EntityId CreateCanvas() = 0;
//! Load a UI Canvas from in-game
virtual AZ::EntityId LoadCanvas(const string& assetIdPathname) = 0;
virtual AZ::EntityId LoadCanvas(const AZStd::string& assetIdPathname) = 0;
//! Create an empty UI Canvas (for the UI editor)
//
@@ -54,7 +54,7 @@ public:
virtual AZ::EntityId CreateCanvasInEditor(UiEntityContext* entityContext) = 0;
//! Load a UI Canvas from the UI editor
virtual AZ::EntityId LoadCanvasInEditor(const string& assetIdPathname, const string& sourceAssetPathname, UiEntityContext* entityContext) = 0;
virtual AZ::EntityId LoadCanvasInEditor(const AZStd::string& assetIdPathname, const AZStd::string& sourceAssetPathname, UiEntityContext* entityContext) = 0;
//! Reload a UI Canvas from xml. For use in the editor for the undo system only
virtual AZ::EntityId ReloadCanvasFromXml(const AZStd::string& xmlString, UiEntityContext* entityContext) = 0;
@@ -65,7 +65,7 @@ public:
//! Get a loaded canvas by path name
//! NOTE: this only searches canvases loaded in the game (not the editor)
virtual AZ::EntityId FindLoadedCanvasByPathName(const string& assetIdPathname) = 0;
virtual AZ::EntityId FindLoadedCanvasByPathName(const AZStd::string& assetIdPathname) = 0;
//! Release a canvas from use either in-game or in editor, destroy UI Canvas if no longer used in either
virtual void ReleaseCanvas(AZ::EntityId canvas, bool forEditor = false) = 0;
@@ -74,10 +74,10 @@ public:
virtual void ReleaseCanvasDeferred(AZ::EntityId canvas) = 0;
//! Load a sprite object.
virtual ISprite* LoadSprite(const string& pathname) = 0;
virtual ISprite* LoadSprite(const AZStd::string& pathname) = 0;
//! Create a sprite that references the specified render target
virtual ISprite* CreateSprite(const string& renderTargetName) = 0;
virtual ISprite* CreateSprite(const AZStd::string& renderTargetName) = 0;
//! Check if a sprite's texture asset exists. The .sprite sidecar file is optional and is not checked
virtual bool DoesSpriteTextureAssetExist(const AZStd::string& pathname) = 0;
+4 -4
View File
@@ -29,13 +29,13 @@ public:
virtual const ICmdLineArg* GetArg(int n) const;
virtual int GetArgCount() const;
virtual const ICmdLineArg* FindArg(const ECmdLineArgType ArgType, const char* name, bool caseSensitive = false) const;
virtual const char* GetCommandLine() const { return m_sCmdLine; };
virtual const char* GetCommandLine() const { return m_sCmdLine.c_str(); };
private:
void PushCommand(const string& sCommand, const string& sParameter);
string Next(char*& str);
void PushCommand(const AZStd::string& sCommand, const AZStd::string& sParameter);
AZStd::string Next(char*& str);
string m_sCmdLine;
AZStd::string m_sCmdLine;
std::vector<CCmdLineArg> m_args;
};
+2 -2
View File
@@ -34,8 +34,8 @@ public:
private:
ECmdLineArgType m_type;
string m_name;
string m_value;
AZStd::string m_name;
AZStd::string m_value;
};
#endif // CRYINCLUDE_CRYSYSTEM_CMDLINEARG_H
+13 -13
View File
@@ -57,7 +57,7 @@ bool CConsoleBatchFile::ExecuteConfigFile(const char* sFilename)
Init();
}
string filename;
AZStd::string filename;
if (sFilename[0] != '@') // console config files are actually by default in @root@ instead of @assets@
{
@@ -78,7 +78,7 @@ bool CConsoleBatchFile::ExecuteConfigFile(const char* sFilename)
filename = sFilename;
}
if (strlen(PathUtil::GetExt(filename)) == 0)
if (strlen(PathUtil::GetExt(filename.c_str())) == 0)
{
filename = PathUtil::ReplaceExtension(filename, "cfg");
}
@@ -88,20 +88,20 @@ bool CConsoleBatchFile::ExecuteConfigFile(const char* sFilename)
{
const char* szLog = "Executing console batch file (try game,config,root):";
string filenameLog;
string sfn = PathUtil::GetFile(filename);
AZStd::string filenameLog;
AZStd::string sfn = PathUtil::GetFile(filename);
if (file.Open(filename, "rb", AZ::IO::IArchive::FOPEN_HINT_QUIET | AZ::IO::IArchive::FOPEN_ONDISK))
if (file.Open(filename.c_str(), "rb", AZ::IO::IArchive::FOPEN_HINT_QUIET | AZ::IO::IArchive::FOPEN_ONDISK))
{
filenameLog = string("game/") + sfn;
filenameLog = AZStd::string("game/") + sfn;
}
else if (file.Open(string("config/") + sfn, "rb", AZ::IO::IArchive::FOPEN_HINT_QUIET | AZ::IO::IArchive::FOPEN_ONDISK))
else if (file.Open((AZStd::string("config/") + sfn).c_str(), "rb", AZ::IO::IArchive::FOPEN_HINT_QUIET | AZ::IO::IArchive::FOPEN_ONDISK))
{
filenameLog = string("game/config/") + sfn;
filenameLog = AZStd::string("game/config/") + sfn;
}
else if (file.Open(string("./") + sfn, "rb", AZ::IO::IArchive::FOPEN_HINT_QUIET | AZ::IO::IArchive::FOPEN_ONDISK))
else if (file.Open((AZStd::string("./") + sfn).c_str(), "rb", AZ::IO::IArchive::FOPEN_HINT_QUIET | AZ::IO::IArchive::FOPEN_ONDISK))
{
filenameLog = string("./") + sfn;
filenameLog = AZStd::string("./") + sfn;
}
else
{
@@ -142,11 +142,11 @@ bool CConsoleBatchFile::ExecuteConfigFile(const char* sFilename)
str++;
}
string strLine = s;
AZStd::string strLine = s;
//trim all whitespace characters at the beginning and the end of the current line and store its size
strLine.Trim();
AZ::StringFunc::TrimWhiteSpace(strLine, true, true);
size_t strLineSize = strLine.size();
//skip comments, comments start with ";" or "--" but may have preceding whitespace characters
@@ -168,7 +168,7 @@ bool CConsoleBatchFile::ExecuteConfigFile(const char* sFilename)
}
{
m_pConsole->ExecuteString(strLine);
m_pConsole->ExecuteString(strLine.c_str());
}
}
// See above
+34 -34
View File
@@ -17,9 +17,9 @@
// remove bad characters, toupper, not very fast
string CConsoleHelpGen::FixAnchorName(const char* szName)
AZStd::string CConsoleHelpGen::FixAnchorName(const char* szName)
{
string ret;
AZStd::string ret;
const char* p = szName;
@@ -45,9 +45,9 @@ string CConsoleHelpGen::FixAnchorName(const char* szName)
return ret;
}
string CConsoleHelpGen::GetCleanPrefix(const char* p)
AZStd::string CConsoleHelpGen::GetCleanPrefix(const char* p)
{
string sRet;
AZStd::string sRet;
while (*p != '_' && *p != 0)
{
@@ -58,9 +58,9 @@ string CConsoleHelpGen::GetCleanPrefix(const char* p)
}
string CConsoleHelpGen::SplitPrefixString_Part1(const char* p)
AZStd::string CConsoleHelpGen::SplitPrefixString_Part1(const char* p)
{
string sRet;
AZStd::string sRet;
while (*p != 10 && *p != 13 && *p != 0)
{
@@ -140,7 +140,7 @@ void CConsoleHelpGen::LogVersion(FILE* f) const
char fext[_MAX_PATH];
_splitpath_s(s, fdrive, fdir, file, fext);
KeyValue(f, "Executable", (string(file) + fext).c_str());
KeyValue(f, "Executable", (AZStd::string(file) + fext).c_str());
}
{
@@ -273,11 +273,11 @@ void CConsoleHelpGen::SingleLinePrefix(FILE* f, const char* szPrefix, const char
}
else if (m_eWorkMode == eWM_Confluence)
{
string sPrefix;
AZStd::string sPrefix;
if (*szPrefix)
{
sPrefix = string(szPrefix) + "_";
sPrefix = AZStd::string(szPrefix) + "_";
}
// fprintf(f,"| %s | [%s|%s] |\n",sPrefix.c_str(),szPrefixDesc,szLink); // e.g. "" "CL_" "CC_" "I_" "T_"
@@ -406,7 +406,7 @@ void CConsoleHelpGen::InsertConsoleCommands(std::set<const char*, string_nocase_
{
const CConsoleCommand& cmd = itrCmd->second;
if (_strnicmp(cmd.m_sName, szLocalPrefix, strlen(szLocalPrefix)) == 0)
if (_strnicmp(cmd.m_sName.c_str(), szLocalPrefix, strlen(szLocalPrefix)) == 0)
{
setCmdAndVars.insert(cmd.m_sName.c_str());
}
@@ -415,7 +415,7 @@ void CConsoleHelpGen::InsertConsoleCommands(std::set<const char*, string_nocase_
void CConsoleHelpGen::InsertConsoleVars(std::set<const char*, string_nocase_lt>& setCmdAndVars, std::map<string, const char*> mapPrefix) const
void CConsoleHelpGen::InsertConsoleVars(std::set<const char*, string_nocase_lt>& setCmdAndVars, std::map<AZStd::string, const char*> mapPrefix) const
{
CXConsole::ConsoleVariablesMap::const_iterator itrVar, itrVarEnd = m_rParent.m_mapVariables.end();
@@ -425,11 +425,11 @@ void CConsoleHelpGen::InsertConsoleVars(std::set<const char*, string_nocase_lt>&
bool bInsert = true;
{
std::map<string, const char*>::const_iterator it2, end = mapPrefix.end();
std::map<AZStd::string, const char*>::const_iterator it2, end = mapPrefix.end();
for (it2 = mapPrefix.begin(); it2 != end; ++it2)
{
if (it2->first != "___" && _strnicmp(var->GetName(), it2->first, it2->first.size()) == 0)
if (it2->first != "___" && _strnicmp(var->GetName(), it2->first.c_str(), it2->first.size()) == 0)
{
bInsert = false;
break;
@@ -446,7 +446,7 @@ void CConsoleHelpGen::InsertConsoleVars(std::set<const char*, string_nocase_lt>&
void CConsoleHelpGen::InsertConsoleCommands(std::set<const char*, string_nocase_lt>& setCmdAndVars, std::map<string, const char*> mapPrefix) const
void CConsoleHelpGen::InsertConsoleCommands(std::set<const char*, string_nocase_lt>& setCmdAndVars, std::map<AZStd::string, const char*> mapPrefix) const
{
CXConsole::ConsoleCommandsMap::const_iterator itrCmd, itrCmdEnd = m_rParent.m_mapCommands.end();
@@ -456,11 +456,11 @@ void CConsoleHelpGen::InsertConsoleCommands(std::set<const char*, string_nocase_
bool bInsert = true;
{
std::map<string, const char*>::const_iterator it2, end = mapPrefix.end();
std::map<AZStd::string, const char*>::const_iterator it2, end = mapPrefix.end();
for (it2 = mapPrefix.begin(); it2 != end; ++it2)
{
if (it2->first != "___" && _strnicmp(cmd.m_sName, it2->first, it2->first.size()) == 0)
if (it2->first != "___" && _strnicmp(cmd.m_sName.c_str(), it2->first.c_str(), it2->first.size()) == 0)
{
bInsert = false;
break;
@@ -480,7 +480,7 @@ void CConsoleHelpGen::CreateSingleEntryFile(const char* szName) const
assert(m_eWorkMode == eWM_Confluence); // only needed for confluence
FILE* f3 = nullptr;
azfopen(&f3, (string(GetFolderName()) + GetFileExtension() + "/" + FixAnchorName(szName)).c_str(), "w");
azfopen(&f3, (AZStd::string(GetFolderName()) + GetFileExtension() + "/" + FixAnchorName(szName)).c_str(), "w");
if (!f3)
{
@@ -582,7 +582,7 @@ void CConsoleHelpGen::IncludeSingleEntry(FILE* f, const char* szName) const
{
fprintf(f, "<pre>\n");
string sHelp = szHelp;
AZStd::string sHelp = szHelp;
// currently not required as the {noformat} is used
// sHelp.replace("[","\\["); sHelp.replace("]","\\]");
@@ -604,7 +604,7 @@ void CConsoleHelpGen::IncludeSingleEntry(FILE* f, const char* szName) const
void CConsoleHelpGen::Work()
{
// string sEngineFolder = string("@user@/")+GetFolderName();
// AZStd::string sEngineFolder = AZStd::string("@user@/")+GetFolderName();
// gEnv->pCryPak->RemoveDir(sEngineFolder.c_str()); // todo: check if that works
// gEnv->pFileIO->CreatePath(sEngineFolder.c_str());
@@ -653,7 +653,7 @@ void CConsoleHelpGen::CreateMainPages()
{
gEnv->pFileIO->CreatePath(GetFolderName());
std::map<string, const char*> mapPrefix;
std::map<AZStd::string, const char*> mapPrefix;
// order here doesn't matter, after the name some help can be added (after the first return)
mapPrefix[ "AI_"] = "Artificial Intelligence";
@@ -701,7 +701,7 @@ void CConsoleHelpGen::CreateMainPages()
mapPrefix[ "___"] = "Remaining"; // key defined to get it sorted in the end
FILE* f1 = nullptr;
azfopen(&f1, (string(GetFolderName()) + "/index" + GetFileExtension()).c_str(), "w");
azfopen(&f1, (AZStd::string(GetFolderName()) + "/index" + GetFileExtension()).c_str(), "w");
if (!f1)
{
return;
@@ -729,17 +729,17 @@ void CConsoleHelpGen::CreateMainPages()
// show all registered Prefix with one line
{
std::map<string, const char*>::const_iterator it, end = mapPrefix.end();
std::map<AZStd::string, const char*>::const_iterator it, end = mapPrefix.end();
StartH3(f1, "Registered Prefixes");
for (it = mapPrefix.begin(); it != end; ++it)
{
const char* szLocalPrefix = it->first.c_str(); // can be 0 for remaining ones
string sCleanPrefix = GetCleanPrefix(szLocalPrefix);
string sPrefixName = SplitPrefixString_Part1(it->second);
AZStd::string sCleanPrefix = GetCleanPrefix(szLocalPrefix);
AZStd::string sPrefixName = SplitPrefixString_Part1(it->second);
SingleLinePrefix(f1, sCleanPrefix.c_str(), sPrefixName.c_str(), (string("CONSOLEPREFIX") + FixAnchorName(sCleanPrefix.c_str()) + GetFileExtension()).c_str());
SingleLinePrefix(f1, sCleanPrefix.c_str(), sPrefixName.c_str(), (AZStd::string("CONSOLEPREFIX") + FixAnchorName(sCleanPrefix.c_str()) + GetFileExtension()).c_str());
// fprintf(f1," * [[CONSOLEPREFIX%s][%s_ %s]]\n",FixAnchorName(sCleanPrefix.c_str()).c_str(),sCleanPrefix.c_str(),sPrefixName.c_str());
}
@@ -750,15 +750,15 @@ void CConsoleHelpGen::CreateMainPages()
{
std::map<string, const char*>::const_iterator it, it2, end = mapPrefix.end();
std::map<AZStd::string, const char*>::const_iterator it, it2, end = mapPrefix.end();
StartH3(f1, "Console Commands and Variables Sorted by Prefix");
for (it = mapPrefix.begin(); it != end; ++it)
{
const char* szLocalPrefix = it->first.c_str(); // can be 0 for remaining ones
string sCleanPrefix = GetCleanPrefix(szLocalPrefix);
string sPrefixName = SplitPrefixString_Part1(it->second);
AZStd::string sCleanPrefix = GetCleanPrefix(szLocalPrefix);
AZStd::string sPrefixName = SplitPrefixString_Part1(it->second);
std::set<const char*, string_nocase_lt> setCmdAndVars; // to get console variables and commands sorted together
@@ -777,11 +777,11 @@ void CConsoleHelpGen::CreateMainPages()
// -------------------------------
string sSubName = string("CONSOLEPREFIX") + sCleanPrefix;
AZStd::string sSubName = AZStd::string("CONSOLEPREFIX") + sCleanPrefix;
StartPrefix(f1, sCleanPrefix.c_str(), sPrefixName.c_str(), (sSubName + GetFileExtension()).c_str());
string sFileOut = string(GetFolderName()) + "/" + sSubName + GetFileExtension();
AZStd::string sFileOut = AZStd::string(GetFolderName()) + "/" + sSubName + GetFileExtension();
FILE* f2 = nullptr;
azfopen(&f2, sFileOut.c_str(), "w");
if (!f2)
@@ -792,7 +792,7 @@ void CConsoleHelpGen::CreateMainPages()
// headline
{
string sHeadline;
AZStd::string sHeadline;
if (sCleanPrefix.empty())
{
@@ -800,7 +800,7 @@ void CConsoleHelpGen::CreateMainPages()
}
else
{
sHeadline = string("Console Commands and Variables with Prefix ") + sCleanPrefix + "_";
sHeadline = AZStd::string("Console Commands and Variables with Prefix ") + sCleanPrefix + "_";
}
StartH1(f2, sHeadline.c_str());
@@ -821,7 +821,7 @@ void CConsoleHelpGen::CreateMainPages()
for (itI = setCmdAndVars.begin(); itI != endI; ++itI)
{
SingleLineEntry_InGlobal(f1, *itI, (sSubName + GetFileExtension() + "#Anchor" + FixAnchorName(*itI)).c_str());
SingleLineEntry_InGroup(f2, *itI, (string("#Anchor") + FixAnchorName(*itI)).c_str());
SingleLineEntry_InGroup(f2, *itI, (AZStd::string("#Anchor") + FixAnchorName(*itI)).c_str());
}
EndH3(f2);
@@ -842,7 +842,7 @@ void CConsoleHelpGen::CreateMainPages()
}
bFirst = false;
Anchor(f2, (string("Anchor") + FixAnchorName(*itI)).c_str()); // anchor
Anchor(f2, (AZStd::string("Anchor") + FixAnchorName(*itI)).c_str()); // anchor
IncludeSingleEntry(f2, *itI);
}
+5 -5
View File
@@ -59,19 +59,19 @@ private: // --------------------------------------------------------
// insert if the name starts with the with prefix
void InsertConsoleCommands(std::set<const char*, string_nocase_lt>& setCmdAndVars, const char* szPrefix) const;
// insert if the name does not start with any of the prefix in the map
void InsertConsoleVars(std::set<const char*, string_nocase_lt>& setCmdAndVars, std::map<string, const char*> mapPrefix) const;
void InsertConsoleVars(std::set<const char*, string_nocase_lt>& setCmdAndVars, std::map<AZStd::string, const char*> mapPrefix) const;
// insert if the name does not start with any of the prefix in the map
void InsertConsoleCommands(std::set<const char*, string_nocase_lt>& setCmdAndVars, std::map<string, const char*> mapPrefix) const;
void InsertConsoleCommands(std::set<const char*, string_nocase_lt>& setCmdAndVars, std::map<AZStd::string, const char*> mapPrefix) const;
// a single file for the entry is generate
void CreateSingleEntryFile(const char* szName) const;
void IncludeSingleEntry(FILE* f, const char* szName) const;
static string FixAnchorName(const char* szName);
static string GetCleanPrefix(const char* p);
static AZStd::string FixAnchorName(const char* szName);
static AZStd::string GetCleanPrefix(const char* p);
// split before "|" (to get the prefix itself)
static string SplitPrefixString_Part1(const char* p);
static AZStd::string SplitPrefixString_Part1(const char* p);
// split string after "|" (to get the optional help)
static const char* SplitPrefixString_Part2(const char* p);
+19 -19
View File
@@ -348,7 +348,7 @@ void DebugCallStack::ReportBug(const char* szErrorMessage)
m_szBugMessage = NULL;
}
void DebugCallStack::dumpCallStack(std::vector<string>& funcs)
void DebugCallStack::dumpCallStack(std::vector<AZStd::string>& funcs)
{
WriteLineToLog("=============================================================================");
int len = (int)funcs.size();
@@ -364,7 +364,7 @@ void DebugCallStack::dumpCallStack(std::vector<string>& funcs)
//////////////////////////////////////////////////////////////////////////
void DebugCallStack::LogExceptionInfo(EXCEPTION_POINTERS* pex)
{
string path("");
AZStd::string path("");
if ((gEnv) && (gEnv->pFileIO))
{
const char* logAlias = gEnv->pFileIO->GetAlias("@log@");
@@ -379,12 +379,12 @@ void DebugCallStack::LogExceptionInfo(EXCEPTION_POINTERS* pex)
}
}
string fileName = path;
AZStd::string fileName = path;
fileName += "error.log";
struct stat fileInfo;
string timeStamp;
string backupPath;
AZStd::string timeStamp;
AZStd::string backupPath;
if (gEnv->IsDedicated())
{
backupPath = PathUtil::ToUnixPath(PathUtil::AddSlash(path + "DumpBackups"));
@@ -399,7 +399,7 @@ void DebugCallStack::LogExceptionInfo(EXCEPTION_POINTERS* pex)
strftime(tempBuffer, sizeof(tempBuffer), "%d %b %Y (%H %M %S)", &creationTime);
timeStamp = tempBuffer;
string backupFileName = backupPath + timeStamp + " error.log";
AZStd::string backupFileName = backupPath + timeStamp + " error.log";
CopyFile(fileName.c_str(), backupFileName.c_str(), true);
}
}
@@ -414,8 +414,8 @@ void DebugCallStack::LogExceptionInfo(EXCEPTION_POINTERS* pex)
char versionbuf[1024];
azstrcpy(versionbuf, AZ_ARRAY_SIZE(versionbuf), "");
PutVersion(versionbuf, AZ_ARRAY_SIZE(versionbuf));
cry_strcat(errorString, versionbuf);
cry_strcat(errorString, "\n");
azstrcat(errorString, versionbuf);
azstrcat(errorString, "\n");
char excCode[MAX_WARNING_LENGTH];
char excAddr[80];
@@ -481,9 +481,9 @@ void DebugCallStack::LogExceptionInfo(EXCEPTION_POINTERS* pex)
excCode, excAddr, m_excModule, excName, desc);
cry_strcat(errs, "\nCall Stack Trace:\n");
azstrcat(errs, "\nCall Stack Trace:\n");
std::vector<string> funcs;
std::vector<AZStd::string> funcs;
{
AZ::Debug::StackFrame frames[25];
AZ::Debug::SymbolStorage::StackLine lines[AZ_ARRAY_SIZE(frames)];
@@ -504,15 +504,15 @@ void DebugCallStack::LogExceptionInfo(EXCEPTION_POINTERS* pex)
{
char temp[s_iCallStackSize];
sprintf_s(temp, "%2zd) %s", funcs.size() - i, (const char*)funcs[i].c_str());
cry_strcat(str, temp);
cry_strcat(str, "\r\n");
cry_strcat(errs, temp);
cry_strcat(errs, "\n");
azstrcat(str, temp);
azstrcat(str, "\r\n");
azstrcat(errs, temp);
azstrcat(errs, "\n");
}
azstrcpy(m_excCallstack, str);
}
cry_strcat(errorString, errs);
azstrcat(errorString, errs);
if (f)
{
@@ -593,7 +593,7 @@ void DebugCallStack::LogExceptionInfo(EXCEPTION_POINTERS* pex)
timeStamp = tempBuffer;
}
string backupFileName = backupPath + timeStamp + " error.dmp";
AZStd::string backupFileName = backupPath + timeStamp + " error.dmp";
CopyFile(fileName.c_str(), backupFileName.c_str(), true);
}
@@ -818,7 +818,7 @@ void DebugCallStack::ResetFPU(EXCEPTION_POINTERS* pex)
}
}
string DebugCallStack::GetModuleNameForAddr(void* addr)
AZStd::string DebugCallStack::GetModuleNameForAddr(void* addr)
{
if (m_modules.empty())
{
@@ -844,7 +844,7 @@ string DebugCallStack::GetModuleNameForAddr(void* addr)
return m_modules.rbegin()->second;
}
void DebugCallStack::GetProcNameForAddr(void* addr, string& procName, void*& baseAddr, string& filename, int& line)
void DebugCallStack::GetProcNameForAddr(void* addr, AZStd::string& procName, void*& baseAddr, AZStd::string& filename, int& line)
{
AZ::Debug::SymbolStorage::StackLine func, file, module;
AZ::Debug::SymbolStorage::FindFunctionFromIP(addr, &func, &file, &module, line, baseAddr);
@@ -852,7 +852,7 @@ void DebugCallStack::GetProcNameForAddr(void* addr, string& procName, void*& bas
filename = file;
}
string DebugCallStack::GetCurrentFilename()
AZStd::string DebugCallStack::GetCurrentFilename()
{
char fullpath[MAX_PATH_LENGTH + 1];
GetModuleFileName(NULL, fullpath, MAX_PATH_LENGTH);
+5 -5
View File
@@ -35,20 +35,20 @@ public:
ISystem* GetSystem() { return m_pSystem; };
virtual string GetModuleNameForAddr(void* addr);
virtual void GetProcNameForAddr(void* addr, string& procName, void*& baseAddr, string& filename, int& line);
virtual string GetCurrentFilename();
virtual AZStd::string GetModuleNameForAddr(void* addr);
virtual void GetProcNameForAddr(void* addr, AZStd::string& procName, void*& baseAddr, AZStd::string& filename, int& line);
virtual AZStd::string GetCurrentFilename();
void installErrorHandler(ISystem* pSystem);
virtual int handleException(EXCEPTION_POINTERS* exception_pointer);
virtual void ReportBug(const char*);
void dumpCallStack(std::vector<string>& functions);
void dumpCallStack(std::vector<AZStd::string>& functions);
void SetUserDialogEnable(const bool bUserDialogEnable);
typedef std::map<void*, string> TModules;
typedef std::map<void*, AZStd::string> TModules;
protected:
static void RemoveOldFiles();
static void RemoveFile(const char* szFileName);
+1 -1
View File
@@ -237,7 +237,7 @@ void IDebugCallStack::WriteLineToLog(const char* format, ...)
char szBuffer[MAX_WARNING_LENGTH];
va_start(ArgList, format);
vsnprintf_s(szBuffer, sizeof(szBuffer), sizeof(szBuffer) - 1, format, ArgList);
cry_strcat(szBuffer, "\n");
azstrcat(szBuffer, "\n");
szBuffer[sizeof(szBuffer) - 1] = '\0';
va_end(ArgList);
+5 -5
View File
@@ -33,23 +33,23 @@ public:
virtual int handleException([[maybe_unused]] EXCEPTION_POINTERS* exception_pointer){return 0; }
// returns the module name of a given address
virtual string GetModuleNameForAddr([[maybe_unused]] void* addr) { return "[unknown]"; }
virtual AZStd::string GetModuleNameForAddr([[maybe_unused]] void* addr) { return "[unknown]"; }
// returns the function name of a given address together with source file and line number (if available) of a given address
virtual void GetProcNameForAddr(void* addr, string& procName, void*& baseAddr, string& filename, int& line)
virtual void GetProcNameForAddr(void* addr, AZStd::string& procName, void*& baseAddr, AZStd::string& filename, int& line)
{
filename = "[unknown]";
line = 0;
baseAddr = addr;
#if defined(PLATFORM_64BIT)
procName.Format("[%016llX]", addr);
procName = AZStd::string::format("[%016llX]", addr);
#else
procName.Format("[%08X]", addr);
procName = AZStd::string::format("[%08X]", addr);
#endif
}
// returns current filename
virtual string GetCurrentFilename() { return "[unknown]"; }
virtual AZStd::string GetCurrentFilename() { return "[unknown]"; }
//! Dumps Current Call Stack to log.
virtual void LogCallstack();
@@ -480,7 +480,7 @@ CLevelInfo* CLevelSystem::GetLevelInfoInternal(const AZStd::string& levelName)
for (AZStd::vector<CLevelInfo>::iterator it = m_levelInfos.begin(); it != m_levelInfos.end(); ++it)
{
{
if (!azstricmp(PathUtil::GetFileName(it->GetName()), levelName.c_str()))
if (!azstricmp(PathUtil::GetFileName(it->GetName()).c_str(), levelName.c_str()))
{
return &(*it);
}
+119 -90
View File
@@ -20,7 +20,6 @@
#include "System.h" // to access InitLocalization()
#include <CryPath.h>
#include <IConsole.h>
#include <StringUtils.h>
#include <locale.h>
#include <time.h>
@@ -146,9 +145,9 @@ static void ReloadDialogData([[maybe_unused]] IConsoleCmdArgs* pArgs)
#if !defined(_RELEASE)
static void TestFormatMessage ([[maybe_unused]] IConsoleCmdArgs* pArgs)
{
string fmt1 ("abc %1 def % gh%2i %");
string fmt2 ("abc %[action:abc] %2 def % gh%1i %1");
string out1, out2;
AZStd::string fmt1 ("abc %1 def % gh%2i %");
AZStd::string fmt2 ("abc %[action:abc] %2 def % gh%1i %1");
AZStd::string out1, out2;
LocalizationManagerRequestBus::Broadcast(&LocalizationManagerRequestBus::Events::FormatStringMessage, out1, fmt1, "first", "second", "third", nullptr);
CryLogAlways("%s", out1.c_str());
LocalizationManagerRequestBus::Broadcast(&LocalizationManagerRequestBus::Events::FormatStringMessage, out2, fmt2, "second", nullptr, nullptr, nullptr);
@@ -206,18 +205,18 @@ CLocalizedStringsManager::CLocalizedStringsManager(ISystem* pSystem)
// Populate available languages by scanning the localization directory for paks
// Default to US English if language is not supported
string sPath;
const string sLocalizationFolder(PathUtil::GetLocalizationFolder());
AZStd::string sPath;
const AZStd::string sLocalizationFolder(PathUtil::GetLocalizationFolder());
ILocalizationManager::TLocalizationBitfield availableLanguages = 0;
AZ::IO::FileIOBase* fileIO = AZ::IO::FileIOBase::GetInstance();
// test language name against supported languages
for (int i = 0; i < ILocalizationManager::ePILID_MAX_OR_INVALID; i++)
{
string sCurrentLanguage = LangNameFromPILID((ILocalizationManager::EPlatformIndependentLanguageID)i);
AZStd::string sCurrentLanguage = LangNameFromPILID((ILocalizationManager::EPlatformIndependentLanguageID)i);
sPath = sLocalizationFolder.c_str() + sCurrentLanguage;
sPath.MakeLower();
if (fileIO && fileIO->IsDirectory(sPath))
AZStd::to_lower(sPath.begin(), sPath.end());
if (fileIO && fileIO->IsDirectory(sPath.c_str()))
{
availableLanguages |= ILocalizationManager::LocalizationBitfieldFromPILID((ILocalizationManager::EPlatformIndependentLanguageID)i);
if (m_cvarLocalizationDebug >= 2)
@@ -366,7 +365,7 @@ bool CLocalizedStringsManager::SetLanguage(const char* sLanguage)
// Check if already language loaded.
for (uint32 i = 0; i < m_languages.size(); i++)
{
if (_stricmp(sLanguage, m_languages[i]->sLanguage) == 0)
if (_stricmp(sLanguage, m_languages[i]->sLanguage.c_str()) == 0)
{
InternalSetCurrentLanguage(m_languages[i]);
return true;
@@ -441,9 +440,9 @@ void CLocalizedStringsManager::AddControl([[maybe_unused]] int nKey)
}
//////////////////////////////////////////////////////////////////////////
void CLocalizedStringsManager::ParseFirstLine(IXmlTableReader* pXmlTableReader, char* nCellIndexToType, std::map<int, string>& SoundMoodIndex, std::map<int, string>& EventParameterIndex)
void CLocalizedStringsManager::ParseFirstLine(IXmlTableReader* pXmlTableReader, char* nCellIndexToType, std::map<int, AZStd::string>& SoundMoodIndex, std::map<int, AZStd::string>& EventParameterIndex)
{
string sCellContent;
AZStd::string sCellContent;
for (;; )
{
@@ -466,7 +465,7 @@ void CLocalizedStringsManager::ParseFirstLine(IXmlTableReader* pXmlTableReader,
}
sCellContent.assign(pContent, contentSize);
sCellContent.MakeLower();
AZStd::to_lower(sCellContent.begin(), sCellContent.end());
for (int i = 0; i < sizeof(sLocalizedColumnNames) / sizeof(sLocalizedColumnNames[0]); ++i)
{
@@ -530,8 +529,8 @@ static void CopyLowercase(char* dst, size_t dstSize, const char* src, size_t src
//////////////////////////////////////////////////////////////////////////
static void ReplaceEndOfLine(AZStd::fixed_string<CLocalizedStringsManager::LOADING_FIXED_STRING_LENGTH>& s)
{
const string oldSubstr("\\n");
const string newSubstr(" \n");
const AZStd::string oldSubstr("\\n");
const AZStd::string newSubstr(" \n");
size_t pos = 0;
for (;; )
{
@@ -565,7 +564,7 @@ void CLocalizedStringsManager::OnSystemEvent(
for (TStringVec::iterator it = m_tagLoadRequests.begin(); it != m_tagLoadRequests.end(); ++it)
{
LoadLocalizationDataByTag(*it);
LoadLocalizationDataByTag(it->c_str());
}
}
@@ -577,7 +576,7 @@ void CLocalizedStringsManager::OnSystemEvent(
// Load all tags after the Editor has finished initialization.
for (TTagFileNames::iterator it = m_tagFileNames.begin(); it != m_tagFileNames.end(); ++it)
{
LoadLocalizationDataByTag(it->first);
LoadLocalizationDataByTag(it->first.c_str());
}
break;
@@ -600,7 +599,7 @@ bool CLocalizedStringsManager::InitLocalizationData(
for (int i = 0; i < root->getChildCount(); i++)
{
XmlNodeRef typeNode = root->getChild(i);
string sType = typeNode->getTag();
AZStd::string sType = typeNode->getTag();
// tags should be unique
if (m_tagFileNames.find(sType) != m_tagFileNames.end())
@@ -678,9 +677,9 @@ bool CLocalizedStringsManager::LoadLocalizationDataByTag(
for (TStringVec::iterator it2 = vEntries.begin(); it2 != vEntries.end(); ++it2)
{
//Only load files of the correct type for the configured format
if ((m_cvarLocalizationFormat == 0 && strstr(*it2, ".xml")) || (m_cvarLocalizationFormat == 1 && strstr(*it2, ".agsxml")))
if ((m_cvarLocalizationFormat == 0 && strstr(it2->c_str(), ".xml")) || (m_cvarLocalizationFormat == 1 && strstr(it2->c_str(), ".agsxml")))
{
bResult &= (this->*loadFunction)(*it2, it->second.id, bReload);
bResult &= (this->*loadFunction)(it2->c_str(), it->second.id, bReload);
}
}
@@ -824,7 +823,7 @@ bool CLocalizedStringsManager::LoadAllLocalizationData(bool bReload)
{
for (TTagFileNames::iterator it = m_tagFileNames.begin(); it != m_tagFileNames.end(); ++it)
{
if(!LoadLocalizationDataByTag(it->first, bReload))
if(!LoadLocalizationDataByTag(it->first.c_str(), bReload))
return false;
}
return true;
@@ -837,6 +836,37 @@ bool CLocalizedStringsManager::LoadExcelXmlSpreadsheet(const char* sFileName, bo
return (this->*loadFunction)(sFileName, 0, bReload);
}
enum class YesNoType
{
Yes,
No,
Invalid
};
// parse the yes/no string
/*!
\param szString any of the following strings: yes, enable, true, 1, no, disable, false, 0
\return YesNoType::Yes if szString is yes/enable/true/1, YesNoType::No if szString is no, disable, false, 0 and YesNoType::Invalid if the string is not one of the expected values.
*/
inline YesNoType ToYesNoType(const char* szString)
{
if (!_stricmp(szString, "yes")
|| !_stricmp(szString, "enable")
|| !_stricmp(szString, "true")
|| !_stricmp(szString, "1"))
{
return YesNoType::Yes;
}
if (!_stricmp(szString, "no")
|| !_stricmp(szString, "disable")
|| !_stricmp(szString, "false")
|| !_stricmp(szString, "0"))
{
return YesNoType::No;
}
return YesNoType::Invalid;
}
//////////////////////////////////////////////////////////////////////
// Loads a string-table from a Excel XML Spreadsheet file.
bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName, uint8 nTagID, bool bReload)
@@ -850,7 +880,7 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
//check if this table has already been loaded
if (!bReload)
{
if (m_loadedTables.find(CONST_TEMP_STRING(sFileName)) != m_loadedTables.end())
if (m_loadedTables.find(AZStd::string(sFileName)) != m_loadedTables.end())
{
return (true);
}
@@ -866,12 +896,12 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
}
XmlNodeRef root;
string sPath;
AZStd::string sPath;
{
const string sLocalizationFolder(PathUtil::GetLocalizationRoot());
const string& languageFolder = m_pLanguage->sLanguage;
const AZStd::string sLocalizationFolder(PathUtil::GetLocalizationRoot());
const AZStd::string& languageFolder = m_pLanguage->sLanguage;
sPath = sLocalizationFolder.c_str() + languageFolder + PathUtil::GetSlash() + sFileName;
root = m_pSystem->LoadXmlFromFile(sPath);
root = m_pSystem->LoadXmlFromFile(sPath.c_str());
if (!root)
{
CryLog("Loading Localization File %s failed!", sPath.c_str());
@@ -948,10 +978,10 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
memset(nCellIndexToType, 0, sizeof(nCellIndexToType));
// SoundMood Index
std::map<int, string> SoundMoodIndex;
std::map<int, AZStd::string> SoundMoodIndex;
// EventParameter Index
std::map<int, string> EventParameterIndex;
std::map<int, AZStd::string> EventParameterIndex;
bool bFirstRow = true;
@@ -1083,7 +1113,7 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
break;
case ELOCALIZED_COLUMN_USE_SUBTITLE:
sTmp.assign(cell.ptr, cell.count);
bUseSubtitle = CryStringUtils::ToYesNoType(sTmp.c_str()) == CryStringUtils::YesNoType::No ? false : true; // favor yes (yes and invalid -> yes)
bUseSubtitle = ToYesNoType(sTmp.c_str()) == YesNoType::No ? false : true; // favor yes (yes and invalid -> yes)
break;
case ELOCALIZED_COLUMN_VOLUME:
sTmp.assign(cell.ptr, cell.count);
@@ -1121,7 +1151,7 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
{
bIsIntercepted = true;
}
bIsDirectRadio = bIsIntercepted || (CryStringUtils::ToYesNoType(sTmp.c_str()) == CryStringUtils::YesNoType::Yes ? true : false); // favor no (no and invalid -> no)
bIsDirectRadio = bIsIntercepted || (ToYesNoType(sTmp.c_str()) == YesNoType::Yes ? true : false); // favor no (no and invalid -> no)
++nItems;
break;
// legacy names
@@ -1358,7 +1388,7 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
}
else
{
pEntry->TranslatedText.psUtf8Uncompressed = new string(sTmp.c_str(), sTmp.c_str() + sTmp.length());
pEntry->TranslatedText.psUtf8Uncompressed = new AZStd::string(sTmp.c_str(), sTmp.c_str() + sTmp.length());
}
}
@@ -1367,7 +1397,7 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
// the CryString makes sure, that only the ref-count is increment on assignment
if (*szLowerCaseEvent)
{
PrototypeSoundEvents::iterator it = m_prototypeEvents.find(CONST_TEMP_STRING(szLowerCaseEvent));
PrototypeSoundEvents::iterator it = m_prototypeEvents.find(AZStd::string(szLowerCaseEvent));
if (it != m_prototypeEvents.end())
{
pEntry->sPrototypeSoundEvent = *it;
@@ -1384,8 +1414,8 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
{
sTmp.assign(sWho.ptr, sWho.count);
ReplaceEndOfLine(sTmp);
sTmp.replace(" ", "_");
string tmp;
AZStd::replace(sTmp.begin(), sTmp.end(), ' ', '_');
AZStd::string tmp;
{
tmp = sTmp.c_str();
}
@@ -1531,19 +1561,19 @@ bool CLocalizedStringsManager::DoLoadAGSXmlDocument(const char* sFileName, uint8
}
if (!bReload)
{
if (m_loadedTables.find(CONST_TEMP_STRING(sFileName)) != m_loadedTables.end())
if (m_loadedTables.find(AZStd::string(sFileName)) != m_loadedTables.end())
{
return true;
}
}
ListAndClearProblemLabels();
XmlNodeRef root;
string sPath;
AZStd::string sPath;
{
const string sLocalizationFolder(PathUtil::GetLocalizationRoot());
const string& languageFolder = m_pLanguage->sLanguage;
const AZStd::string sLocalizationFolder(PathUtil::GetLocalizationRoot());
const AZStd::string& languageFolder = m_pLanguage->sLanguage;
sPath = sLocalizationFolder.c_str() + languageFolder + PathUtil::GetSlash() + sFileName;
root = m_pSystem->LoadXmlFromFile(sPath);
root = m_pSystem->LoadXmlFromFile(sPath.c_str());
if (!root)
{
AZ_TracePrintf(LOC_WINDOW, "Loading Localization File %s failed!", sPath.c_str());
@@ -1654,7 +1684,7 @@ bool CLocalizedStringsManager::DoLoadAGSXmlDocument(const char* sFileName, uint8
}
else
{
pEntry->TranslatedText.psUtf8Uncompressed = new string(textString, textString + textLength);
pEntry->TranslatedText.psUtf8Uncompressed = new AZStd::string(textString, textString + textLength);
}
}
{
@@ -1714,7 +1744,7 @@ void CLocalizedStringsManager::ReloadData()
FreeLocalizationData();
for (tmapFilenames::iterator it = temp.begin(); it != temp.end(); it++)
{
(this->*loadFunction)((*it).first, (*it).second.nTagID, true);
(this->*loadFunction)((*it).first.c_str(), (*it).second.nTagID, true);
}
}
@@ -1732,19 +1762,19 @@ void CLocalizedStringsManager::AddLocalizedString(SLanguage* pLanguage, SLocaliz
}
//////////////////////////////////////////////////////////////////////////
bool CLocalizedStringsManager::LocalizeString_ch(const char* sString, string& outLocalizedString, bool bEnglish)
bool CLocalizedStringsManager::LocalizeString_ch(const char* sString, AZStd::string& outLocalizedString, bool bEnglish)
{
return LocalizeStringInternal(sString, strlen(sString), outLocalizedString, bEnglish);
}
//////////////////////////////////////////////////////////////////////////
bool CLocalizedStringsManager::LocalizeString_s(const string& sString, string& outLocalizedString, bool bEnglish)
bool CLocalizedStringsManager::LocalizeString_s(const AZStd::string& sString, AZStd::string& outLocalizedString, bool bEnglish)
{
return LocalizeStringInternal(sString.c_str(), sString.length(), outLocalizedString, bEnglish);
}
//////////////////////////////////////////////////////////////////////////
bool CLocalizedStringsManager::LocalizeStringInternal(const char* pStr, size_t len, string& outLocalizedString, bool bEnglish)
bool CLocalizedStringsManager::LocalizeStringInternal(const char* pStr, size_t len, AZStd::string& outLocalizedString, bool bEnglish)
{
assert (m_pLanguage);
if (m_pLanguage == 0)
@@ -1755,7 +1785,7 @@ bool CLocalizedStringsManager::LocalizeStringInternal(const char* pStr, size_t l
}
// note: we don't write directly to outLocalizedString, in case it aliases pStr
string out;
AZStd::string out;
// scan the string
const char* pPos = pStr;
@@ -1783,8 +1813,8 @@ bool CLocalizedStringsManager::LocalizeStringInternal(const char* pStr, size_t l
}
// localize token
string token(pLabel, pLabelEnd);
string sLocalizedToken;
AZStd::string token(pLabel, pLabelEnd);
AZStd::string sLocalizedToken;
if (bEnglish)
{
GetEnglishString(token.c_str(), sLocalizedToken);
@@ -1803,7 +1833,7 @@ bool CLocalizedStringsManager::LocalizeStringInternal(const char* pStr, size_t l
void CLocalizedStringsManager::LocalizeAndSubstituteInternal(AZStd::string& locString, const AZStd::vector<AZStd::string>& keys, const AZStd::vector<AZStd::string>& values)
{
string outString;
AZStd::string outString;
LocalizeString_ch(locString.c_str(), outString);
locString = outString .c_str();
if (values.size() != keys.size())
@@ -1866,7 +1896,7 @@ static void LogDecompTimer(__int64 nTotalTicks, __int64 nDecompTicks, __int64 nA
}
#endif
string CLocalizedStringsManager::SLocalizedStringEntry::GetTranslatedText(const SLanguage* pLanguage) const
AZStd::string CLocalizedStringsManager::SLocalizedStringEntry::GetTranslatedText(const SLanguage* pLanguage) const
{
FUNCTION_PROFILER_FAST(GetISystem(), PROFILE_SYSTEM, g_bProfilerEnabled);
if ((flags & IS_COMPRESSED) != 0)
@@ -1876,7 +1906,7 @@ string CLocalizedStringsManager::SLocalizedStringEntry::GetTranslatedText(const
nTotalTicks = CryGetTicks();
#endif //LOG_DECOMP_TIMES
string outputString;
AZStd::string outputString;
if (TranslatedText.szCompressed != NULL)
{
uint8 decompressionBuffer[COMPRESSION_FIXED_BUFFER_LENGTH];
@@ -1923,7 +1953,7 @@ string CLocalizedStringsManager::SLocalizedStringEntry::GetTranslatedText(const
}
else
{
string emptyOutputString;
AZStd::string emptyOutputString;
return emptyOutputString;
}
}
@@ -1949,7 +1979,7 @@ void CLocalizedStringsManager::ListAndClearProblemLabels()
CryLog ("These labels caused localization problems:");
INDENT_LOG_DURING_SCOPE();
for (std::map<string, bool>::iterator iter = m_warnedAboutLabels.begin(); iter != m_warnedAboutLabels.end(); iter++)
for (std::map<AZStd::string, bool>::iterator iter = m_warnedAboutLabels.begin(); iter != m_warnedAboutLabels.end(); iter++)
{
CryLog ("%s", iter->first.c_str());
}
@@ -1961,7 +1991,7 @@ void CLocalizedStringsManager::ListAndClearProblemLabels()
#endif
//////////////////////////////////////////////////////////////////////////
bool CLocalizedStringsManager::LocalizeLabel(const char* sLabel, string& outLocalString, bool bEnglish)
bool CLocalizedStringsManager::LocalizeLabel(const char* sLabel, AZStd::string& outLocalString, bool bEnglish)
{
assert(sLabel);
if (!m_pLanguage || !sLabel)
@@ -1979,8 +2009,7 @@ bool CLocalizedStringsManager::LocalizeLabel(const char* sLabel, string& outLoca
if (entry != NULL)
{
string translatedText = entry->GetTranslatedText(m_pLanguage);
AZStd::string translatedText = entry->GetTranslatedText(m_pLanguage);
if ((bEnglish || translatedText.empty()) && entry->pEditorExtension != NULL)
{
//assert(!"No Localization Text available!");
@@ -2011,7 +2040,7 @@ bool CLocalizedStringsManager::LocalizeLabel(const char* sLabel, string& outLoca
//////////////////////////////////////////////////////////////////////////
bool CLocalizedStringsManager::GetEnglishString(const char* sKey, string& sLocalizedString)
bool CLocalizedStringsManager::GetEnglishString(const char* sKey, AZStd::string& sLocalizedString)
{
assert(sKey);
if (!m_pLanguage || !sKey)
@@ -2086,7 +2115,7 @@ bool CLocalizedStringsManager::GetLocalizedInfoByKey(const char* sKey, SLocalize
const SLocalizedStringEntry* entry = stl::find_in_map(m_pLanguage->m_keysMap, keyCRC32, NULL);
if (entry != NULL)
{
outGameInfo.szCharacterName = entry->sCharacterName;
outGameInfo.szCharacterName = entry->sCharacterName.c_str();
outGameInfo.sUtf8TranslatedText = entry->GetTranslatedText(m_pLanguage);
outGameInfo.bUseSubtitle = (entry->flags & SLocalizedStringEntry::USE_SUBTITLE);
@@ -2119,7 +2148,7 @@ bool CLocalizedStringsManager::GetLocalizedInfoByKey(const char* sKey, SLocalize
{
bResult = true;
pOutSoundInfo->szCharacterName = pEntry->sCharacterName;
pOutSoundInfo->szCharacterName = pEntry->sCharacterName.c_str();
pOutSoundInfo->sUtf8TranslatedText = pEntry->GetTranslatedText(m_pLanguage);
//pOutSoundInfo->sOriginalActorLine = pEntry->sOriginalActorLine.c_str();
@@ -2213,7 +2242,7 @@ bool CLocalizedStringsManager::GetLocalizedInfoByIndex(int nIndex, SLocalizedInf
}
const SLocalizedStringEntry* pEntry = entryVec[nIndex];
outGameInfo.szCharacterName = pEntry->sCharacterName;
outGameInfo.szCharacterName = pEntry->sCharacterName.c_str();
outGameInfo.sUtf8TranslatedText = pEntry->GetTranslatedText(m_pLanguage);
outGameInfo.bUseSubtitle = (pEntry->flags & SLocalizedStringEntry::USE_SUBTITLE);
@@ -2233,18 +2262,18 @@ bool CLocalizedStringsManager::GetLocalizedInfoByIndex(int nIndex, SLocalizedInf
return false;
}
const SLocalizedStringEntry* pEntry = entryVec[nIndex];
outEditorInfo.szCharacterName = pEntry->sCharacterName;
outEditorInfo.szCharacterName = pEntry->sCharacterName.c_str();
outEditorInfo.sUtf8TranslatedText = pEntry->GetTranslatedText(m_pLanguage);
assert(pEntry->pEditorExtension != NULL);
outEditorInfo.sKey = pEntry->pEditorExtension->sKey;
outEditorInfo.sKey = pEntry->pEditorExtension->sKey.c_str();
outEditorInfo.sOriginalActorLine = pEntry->pEditorExtension->sOriginalActorLine;
outEditorInfo.sUtf8TranslatedActorLine = pEntry->pEditorExtension->sUtf8TranslatedActorLine;
outEditorInfo.sOriginalActorLine = pEntry->pEditorExtension->sOriginalActorLine.c_str();
outEditorInfo.sUtf8TranslatedActorLine = pEntry->pEditorExtension->sUtf8TranslatedActorLine.c_str();
//outEditorInfo.sOriginalText = pEntry->sOriginalText;
outEditorInfo.sOriginalCharacterName = pEntry->pEditorExtension->sOriginalCharacterName;
outEditorInfo.sOriginalCharacterName = pEntry->pEditorExtension->sOriginalCharacterName.c_str();
outEditorInfo.nRow = pEntry->pEditorExtension->nRow;
outEditorInfo.bUseSubtitle = (pEntry->flags & SLocalizedStringEntry::USE_SUBTITLE);
@@ -2252,7 +2281,7 @@ bool CLocalizedStringsManager::GetLocalizedInfoByIndex(int nIndex, SLocalizedInf
}
//////////////////////////////////////////////////////////////////////////
bool CLocalizedStringsManager::GetSubtitle(const char* sKeyOrLabel, string& outSubtitle, bool bForceSubtitle)
bool CLocalizedStringsManager::GetSubtitle(const char* sKeyOrLabel, AZStd::string& outSubtitle, bool bForceSubtitle)
{
assert(sKeyOrLabel);
if (!m_pLanguage || !sKeyOrLabel || !*sKeyOrLabel)
@@ -2376,13 +2405,13 @@ void InternalFormatStringMessage(StringClass& outString, const StringClass& sStr
}
//////////////////////////////////////////////////////////////////////////
void CLocalizedStringsManager::FormatStringMessage_List(string& outString, const string& sString, const char** sParams, int nParams)
void CLocalizedStringsManager::FormatStringMessage_List(AZStd::string& outString, const AZStd::string& sString, const char** sParams, int nParams)
{
InternalFormatStringMessage(outString, sString, sParams, nParams);
}
//////////////////////////////////////////////////////////////////////////
void CLocalizedStringsManager::FormatStringMessage(string& outString, const string& sString, const char* param1, const char* param2, const char* param3, const char* param4)
void CLocalizedStringsManager::FormatStringMessage(AZStd::string& outString, const AZStd::string& sString, const char* param1, const char* param2, const char* param3, const char* param4)
{
InternalFormatStringMessage(outString, sString, param1, param2, param3, param4);
}
@@ -2462,7 +2491,7 @@ void CLocalizedStringsManager::InternalSetCurrentLanguage(CLocalizedStringsManag
#if defined (WIN32) || defined(WIN64)
if (m_pLanguage != 0)
{
g_currentLanguageID = GetLanguageID(m_pLanguage->sLanguage);
g_currentLanguageID = GetLanguageID(m_pLanguage->sLanguage.c_str());
}
else
{
@@ -2494,7 +2523,7 @@ void CLocalizedStringsManager::InternalSetCurrentLanguage(CLocalizedStringsManag
}
}
void CLocalizedStringsManager::LocalizeDuration(int seconds, string& outDurationString)
void CLocalizedStringsManager::LocalizeDuration(int seconds, AZStd::string& outDurationString)
{
int s = seconds;
int d, h, m;
@@ -2504,27 +2533,27 @@ void CLocalizedStringsManager::LocalizeDuration(int seconds, string& outDuration
s -= h * 3600;
m = s / 60;
s = s - m * 60;
string str;
AZStd::string str;
if (d > 1)
{
str.Format("%d @ui_days %02d:%02d:%02d", d, h, m, s);
str = AZStd::string::format("%d @ui_days %02d:%02d:%02d", d, h, m, s);
}
else if (d > 0)
{
str.Format("%d @ui_day %02d:%02d:%02d", d, h, m, s);
str = AZStd::string::format("%d @ui_day %02d:%02d:%02d", d, h, m, s);
}
else if (h > 0)
{
str.Format("%02d:%02d:%02d", h, m, s);
str = AZStd::string::format("%02d:%02d:%02d", h, m, s);
}
else
{
str.Format("%02d:%02d", m, s);
str = AZStd::string::format("%02d:%02d", m, s);
}
LocalizeString_s(str, outDurationString);
}
void CLocalizedStringsManager::LocalizeNumber(int number, string& outNumberString)
void CLocalizedStringsManager::LocalizeNumber(int number, AZStd::string& outNumberString)
{
if (number == 0)
{
@@ -2535,7 +2564,7 @@ void CLocalizedStringsManager::LocalizeNumber(int number, string& outNumberStrin
outNumberString.assign("");
int n = abs(number);
string separator;
AZStd::string separator;
AZStd::fixed_string<64> tmp;
LocalizeString_ch("@ui_thousand_separator", separator);
while (n > 0)
@@ -2544,41 +2573,41 @@ void CLocalizedStringsManager::LocalizeNumber(int number, string& outNumberStrin
int b = n - (a * 1000);
if (a > 0)
{
tmp.Format("%s%03d%s", separator.c_str(), b, tmp.c_str());
tmp = AZStd::string::format("%s%03d%s", separator.c_str(), b, tmp.c_str());
}
else
{
tmp.Format("%d%s", b, tmp.c_str());
tmp = AZStd::string::format("%d%s", b, tmp.c_str());
}
n = a;
}
if (number < 0)
{
tmp.Format("-%s", tmp.c_str());
tmp = AZStd::string::format("-%s", tmp.c_str());
}
outNumberString.assign(tmp.c_str());
}
void CLocalizedStringsManager::LocalizeNumber_Decimal(float number, int decimals, string& outNumberString)
void CLocalizedStringsManager::LocalizeNumber_Decimal(float number, int decimals, AZStd::string& outNumberString)
{
if (number == 0.0f)
{
AZStd::fixed_string<64> tmp;
tmp.Format("%.*f", decimals, number);
tmp = AZStd::fixed_string<64>::format("%.*f", decimals, number);
outNumberString.assign(tmp.c_str());
return;
}
outNumberString.assign("");
string commaSeparator;
AZStd::string commaSeparator;
LocalizeString_ch("@ui_decimal_separator", commaSeparator);
float f = number > 0.0f ? number : -number;
int d = (int)f;
string intPart;
AZStd::string intPart;
LocalizeNumber(d, intPart);
float decimalsOnly = f - (float)d;
@@ -2586,7 +2615,7 @@ void CLocalizedStringsManager::LocalizeNumber_Decimal(float number, int decimals
int decimalsAsInt = aznumeric_cast<int>(int_round(decimalsOnly * pow(10.0f, decimals)));
AZStd::fixed_string<64> tmp;
tmp.Format("%s%s%0*d", intPart.c_str(), commaSeparator.c_str(), decimals, decimalsAsInt);
tmp = AZStd::fixed_string<64>::format("%s%s%0*d", intPart.c_str(), commaSeparator.c_str(), decimals, decimalsAsInt);
outNumberString.assign(tmp.c_str());
}
@@ -2640,7 +2669,7 @@ namespace
}
};
void CLocalizedStringsManager::LocalizeTime(time_t t, bool bMakeLocalTime, bool bShowSeconds, string& outTimeString)
void CLocalizedStringsManager::LocalizeTime(time_t t, bool bMakeLocalTime, bool bShowSeconds, AZStd::string& outTimeString)
{
if (bMakeLocalTime)
{
@@ -2664,7 +2693,7 @@ void CLocalizedStringsManager::LocalizeTime(time_t t, bool bMakeLocalTime, bool
}
}
void CLocalizedStringsManager::LocalizeDate(time_t t, bool bMakeLocalTime, bool bShort, bool bIncludeWeekday, string& outDateString)
void CLocalizedStringsManager::LocalizeDate(time_t t, bool bMakeLocalTime, bool bShort, bool bIncludeWeekday, AZStd::string& outDateString)
{
if (bMakeLocalTime)
{
@@ -2689,7 +2718,7 @@ void CLocalizedStringsManager::LocalizeDate(time_t t, bool bMakeLocalTime, bool
// len includes terminating null!
tmpString.resize(len);
::GetDateFormatW(lcID, 0, &systemTime, L"ddd", (wchar_t*) tmpString.c_str(), len);
string utf8;
AZStd::string utf8;
Unicode::Convert(utf8, tmpString);
outDateString.append(utf8);
outDateString.append(" ");
@@ -2702,7 +2731,7 @@ void CLocalizedStringsManager::LocalizeDate(time_t t, bool bMakeLocalTime, bool
// len includes terminating null!
tmpString.resize(len);
::GetDateFormatW(lcID, flags, &systemTime, 0, (wchar_t*) tmpString.c_str(), len);
string utf8;
AZStd::string utf8;
Unicode::Convert(utf8, tmpString);
outDateString.append(utf8);
}
@@ -2710,7 +2739,7 @@ void CLocalizedStringsManager::LocalizeDate(time_t t, bool bMakeLocalTime, bool
#else // #if defined (WIN32) || defined(WIN64)
void CLocalizedStringsManager::LocalizeTime(time_t t, bool bMakeLocalTime, bool bShowSeconds, string& outTimeString)
void CLocalizedStringsManager::LocalizeTime(time_t t, bool bMakeLocalTime, bool bShowSeconds, AZStd::string& outTimeString)
{
struct tm theTime;
if (bMakeLocalTime)
@@ -2737,7 +2766,7 @@ void CLocalizedStringsManager::LocalizeTime(time_t t, bool bMakeLocalTime, bool
Unicode::Convert(outTimeString, buf);
}
void CLocalizedStringsManager::LocalizeDate(time_t t, bool bMakeLocalTime, bool bShort, bool bIncludeWeekday, string& outDateString)
void CLocalizedStringsManager::LocalizeDate(time_t t, bool bMakeLocalTime, bool bShort, bool bIncludeWeekday, AZStd::string& outDateString)
{
struct tm theTime;
if (bMakeLocalTime)
+33 -33
View File
@@ -25,7 +25,7 @@ class CLocalizedStringsManager
, public ISystemEventListener
{
public:
typedef std::vector<string> TLocalizationTagVec;
typedef std::vector<AZStd::string> TLocalizationTagVec;
constexpr const static size_t LOADING_FIXED_STRING_LENGTH = 2048;
constexpr const static size_t COMPRESSION_FIXED_BUFFER_LENGTH = 6144;
@@ -56,11 +56,11 @@ public:
void ReloadData() override;
void FreeData();
bool LocalizeString_s(const string& sString, string& outLocalizedString, bool bEnglish = false) override;
bool LocalizeString_ch(const char* sString, string& outLocalizedString, bool bEnglish = false) override;
bool LocalizeString_s(const AZStd::string& sString, AZStd::string& outLocalizedString, bool bEnglish = false) override;
bool LocalizeString_ch(const char* sString, AZStd::string& outLocalizedString, bool bEnglish = false) override;
void LocalizeAndSubstituteInternal(AZStd::string& locString, const AZStd::vector<AZStd::string>& keys, const AZStd::vector<AZStd::string>& values) override;
bool LocalizeLabel(const char* sLabel, string& outLocalizedString, bool bEnglish = false) override;
bool LocalizeLabel(const char* sLabel, AZStd::string& outLocalizedString, bool bEnglish = false) override;
bool IsLocalizedInfoFound(const char* sKey);
bool GetLocalizedInfoByKey(const char* sKey, SLocalizedInfoGame& outGameInfo);
bool GetLocalizedInfoByKey(const char* sKey, SLocalizedSoundInfoGame* pOutSoundInfoGame);
@@ -68,17 +68,17 @@ public:
bool GetLocalizedInfoByIndex(int nIndex, SLocalizedInfoGame& outGameInfo);
bool GetLocalizedInfoByIndex(int nIndex, SLocalizedInfoEditor& outEditorInfo);
bool GetEnglishString(const char* sKey, string& sLocalizedString) override;
bool GetSubtitle(const char* sKeyOrLabel, string& outSubtitle, bool bForceSubtitle = false) override;
bool GetEnglishString(const char* sKey, AZStd::string& sLocalizedString) override;
bool GetSubtitle(const char* sKeyOrLabel, AZStd::string& outSubtitle, bool bForceSubtitle = false) override;
void FormatStringMessage_List(string& outString, const string& sString, const char** sParams, int nParams) override;
void FormatStringMessage(string& outString, const string& sString, const char* param1, const char* param2 = 0, const char* param3 = 0, const char* param4 = 0) override;
void FormatStringMessage_List(AZStd::string& outString, const AZStd::string& sString, const char** sParams, int nParams) override;
void FormatStringMessage(AZStd::string& outString, const AZStd::string& sString, const char* param1, const char* param2 = 0, const char* param3 = 0, const char* param4 = 0) override;
void LocalizeTime(time_t t, bool bMakeLocalTime, bool bShowSeconds, string& outTimeString) override;
void LocalizeDate(time_t t, bool bMakeLocalTime, bool bShort, bool bIncludeWeekday, string& outDateString) override;
void LocalizeDuration(int seconds, string& outDurationString) override;
void LocalizeNumber(int number, string& outNumberString) override;
void LocalizeNumber_Decimal(float number, int decimals, string& outNumberString) override;
void LocalizeTime(time_t t, bool bMakeLocalTime, bool bShowSeconds, AZStd::string& outTimeString) override;
void LocalizeDate(time_t t, bool bMakeLocalTime, bool bShort, bool bIncludeWeekday, AZStd::string& outDateString) override;
void LocalizeDuration(int seconds, AZStd::string& outDurationString) override;
void LocalizeNumber(int number, AZStd::string& outNumberString) override;
void LocalizeNumber_Decimal(float number, int decimals, AZStd::string& outNumberString) override;
bool ProjectUsesLocalization() const override;
// ~ILocalizationManager
@@ -95,7 +95,7 @@ public:
private:
void SetAvailableLocalizationsBitfield(const ILocalizationManager::TLocalizationBitfield availableLocalizations);
bool LocalizeStringInternal(const char* pStr, size_t len, string& outLocalizedString, bool bEnglish);
bool LocalizeStringInternal(const char* pStr, size_t len, AZStd::string& outLocalizedString, bool bEnglish);
bool DoLoadExcelXmlSpreadsheet(const char* sFileName, uint8 tagID, bool bReload);
typedef bool(CLocalizedStringsManager::*LoadFunc)(const char*, uint8, bool);
@@ -104,11 +104,11 @@ private:
struct SLocalizedStringEntryEditorExtension
{
string sKey; // Map key text equivalent (without @)
string sOriginalActorLine; // english text
string sUtf8TranslatedActorLine; // localized text
string sOriginalText; // subtitle. if empty, uses English text
string sOriginalCharacterName; // english character name speaking via XML asset
AZStd::string sKey; // Map key text equivalent (without @)
AZStd::string sOriginalActorLine; // english text
AZStd::string sUtf8TranslatedActorLine; // localized text
AZStd::string sOriginalText; // subtitle. if empty, uses English text
AZStd::string sOriginalCharacterName; // english character name speaking via XML asset
unsigned int nRow; // Number of row in XML file
@@ -141,15 +141,15 @@ private:
union trans_text
{
string* psUtf8Uncompressed;
AZStd::string* psUtf8Uncompressed;
uint8* szCompressed; // Note that no size information is stored. This is for struct size optimization and unfortunately renders the size info inaccurate.
};
string sCharacterName; // character name speaking via XML asset
AZStd::string sCharacterName; // character name speaking via XML asset
trans_text TranslatedText; // Subtitle of this line
// audio specific part
string sPrototypeSoundEvent; // associated sound event prototype (radio, ...)
AZStd::string sPrototypeSoundEvent; // associated sound event prototype (radio, ...)
CryHalf fVolume;
CryHalf fRadioRatio;
// SoundMoods
@@ -191,7 +191,7 @@ private:
}
};
string GetTranslatedText(const SLanguage* pLanguage) const;
AZStd::string GetTranslatedText(const SLanguage* pLanguage) const;
void GetMemoryUsage(ICrySizer* pSizer) const
{
@@ -224,7 +224,7 @@ private:
typedef std::vector<SLocalizedStringEntry*> TLocalizedStringEntries;
typedef std::vector<HuffmanCoder*> THuffmanCoders;
string sLanguage;
AZStd::string sLanguage;
StringsKeyMap m_keysMap;
TLocalizedStringEntries m_vLocalizedStrings;
THuffmanCoders m_vEncoders;
@@ -246,7 +246,7 @@ private:
};
#ifndef _RELEASE
std::map<string, bool> m_warnedAboutLabels;
std::map<AZStd::string, bool> m_warnedAboutLabels;
bool m_haveWarnedAboutAtLeastOneLabel;
void LocalizedStringsManagerWarning(const char* label, const char* message);
@@ -259,45 +259,45 @@ private:
void AddLocalizedString(SLanguage* pLanguage, SLocalizedStringEntry* pEntry, const uint32 keyCRC32);
void AddControl(int nKey);
//////////////////////////////////////////////////////////////////////////
void ParseFirstLine(IXmlTableReader* pXmlTableReader, char* nCellIndexToType, std::map<int, string>& SoundMoodIndex, std::map<int, string>& EventParameterIndex);
void ParseFirstLine(IXmlTableReader* pXmlTableReader, char* nCellIndexToType, std::map<int, AZStd::string>& SoundMoodIndex, std::map<int, AZStd::string>& EventParameterIndex);
void InternalSetCurrentLanguage(SLanguage* pLanguage);
ISystem* m_pSystem;
// Pointer to the current language.
SLanguage* m_pLanguage;
// all loaded Localization Files
typedef std::pair<string, SFileInfo> pairFileName;
typedef std::map<string, SFileInfo> tmapFilenames;
typedef std::pair<AZStd::string, SFileInfo> pairFileName;
typedef std::map<AZStd::string, SFileInfo> tmapFilenames;
tmapFilenames m_loadedTables;
// filenames per tag
typedef std::vector<string> TStringVec;
typedef std::vector<AZStd::string> TStringVec;
struct STag
{
TStringVec filenames;
uint8 id;
bool loaded;
};
typedef std::map<string, STag> TTagFileNames;
typedef std::map<AZStd::string, STag> TTagFileNames;
TTagFileNames m_tagFileNames;
TStringVec m_tagLoadRequests;
// Array of loaded languages.
std::vector<SLanguage*> m_languages;
typedef std::set<string> PrototypeSoundEvents;
typedef std::set<AZStd::string> PrototypeSoundEvents;
PrototypeSoundEvents m_prototypeEvents; // this set is purely used for clever string/string assigning to save memory
struct less_strcmp
{
bool operator()(const string& left, const string& right) const
bool operator()(const AZStd::string& left, const AZStd::string& right) const
{
return strcmp(left.c_str(), right.c_str()) < 0;
}
};
typedef std::set<string, less_strcmp> CharacterNameSet;
typedef std::set<AZStd::string, less_strcmp> CharacterNameSet;
CharacterNameSet m_characterNameSet; // this set is purely used for clever string/string assigning to save memory
// CVARs
+14 -14
View File
@@ -466,7 +466,7 @@ void CLog::LogV(const ELogType type, [[maybe_unused]]int flags, const char* szFo
{
case eWarning:
case eWarningAlways:
cry_strcpy(szString, MAX_WARNING_LENGTH, "$6[Warning] ");
azstrcpy(szString, MAX_WARNING_LENGTH, "$6[Warning] ");
szString += 12; // strlen("$6[Warning] ");
szAfterColour += 2;
prefixSize = 12;
@@ -474,7 +474,7 @@ void CLog::LogV(const ELogType type, [[maybe_unused]]int flags, const char* szFo
case eError:
case eErrorAlways:
cry_strcpy(szString, MAX_WARNING_LENGTH, "$4[Error] ");
azstrcpy(szString, MAX_WARNING_LENGTH, "$4[Error] ");
szString += 10; // strlen("$4[Error] ");
szAfterColour += 2;
prefixSize = 10;
@@ -532,7 +532,7 @@ void CLog::LogV(const ELogType type, [[maybe_unused]]int flags, const char* szFo
}
}
i = m_iLastHistoryItem = m_iLastHistoryItem + 1 & sz - 1;
cry_strcpy(m_history[i].str, m_history[i].ptr = szSpamCheck);
azstrcpy(m_history[i].str, m_history[i].ptr = szSpamCheck);
m_history[i].type = type;
m_history[i].time = time;
}
@@ -956,7 +956,7 @@ void CLog::LogStringToFile(const char* szString, ELogType logType, bool bAdd, [[
{
timeStr.clear();
uint32 dwMs = (uint32)((currenttime - lasttime).GetMilliSeconds());
timeStr.Format("<%3d.%.3d>: ", dwMs / 1000, dwMs % 1000);
timeStr = AZStd::string::format("<%3d.%.3d>: ", dwMs / 1000, dwMs % 1000);
tempString = timeStr + tempString;
}
lasttime = currenttime;
@@ -983,7 +983,7 @@ void CLog::LogStringToFile(const char* szString, ELogType logType, bool bAdd, [[
{
timeStr.clear();
uint32 dwMs = (uint32)((currenttime - lasttime).GetMilliSeconds());
timeStr.Format("<%3d.%.3d>: ", dwMs / 1000, dwMs % 1000);
timeStr = AZStd::string::format("<%3d.%.3d>: ", dwMs / 1000, dwMs % 1000);
tempString = timeStr + tempString;
}
lasttime = currenttime;
@@ -1000,7 +1000,7 @@ void CLog::LogStringToFile(const char* szString, ELogType logType, bool bAdd, [[
{
timeStr.clear();
uint32 dwMs = (uint32)((currenttime - lasttime).GetMilliSeconds());
timeStr.Format("<%3d.%.3d>: ", dwMs / 1000, dwMs % 1000);
timeStr = AZStd::string::format("<%3d.%.3d>: ", dwMs / 1000, dwMs % 1000);
tempString = timeStr + tempString;
}
if (bFirst)
@@ -1218,10 +1218,10 @@ void CLog::CreateBackupFile() const
// boswej: only create a backup if logging to the engine root, otherwise the
// log output has been overridden and the user is responsible
string logDir = PathUtil::RemoveSlash(PathUtil::ToUnixPath(PathUtil::GetParentDirectory(m_szFilename)));
AZStd::string logDir = PathUtil::RemoveSlash(PathUtil::ToUnixPath(PathUtil::GetParentDirectory(m_szFilename)));
string sExt = PathUtil::GetExt(m_szFilename);
string sFileWithoutExt = PathUtil::GetFileName(m_szFilename);
AZStd::string sExt = PathUtil::GetExt(m_szFilename);
AZStd::string sFileWithoutExt = PathUtil::GetFileName(m_szFilename);
{
assert(::strstr(sFileWithoutExt, ":") == 0);
@@ -1234,14 +1234,14 @@ void CLog::CreateBackupFile() const
AZ::IO::HandleType inFileHandle = AZ::IO::InvalidHandle;
fileSystem->Open(m_szFilename, AZ::IO::OpenMode::ModeRead | AZ::IO::OpenMode::ModeBinary, inFileHandle);
string sBackupNameAttachment;
AZStd::string sBackupNameAttachment;
// parse backup name attachment
// e.g. BackupNameAttachment="attachment name"
if (inFileHandle != AZ::IO::InvalidHandle)
{
bool bKeyFound = false;
string sName;
AZStd::string sName;
while (!fileSystem->Eof(inFileHandle))
{
@@ -1253,7 +1253,7 @@ void CLog::CreateBackupFile() const
{
bKeyFound = true;
if (sName.find("BackupNameAttachment=") == string::npos)
if (sName.find("BackupNameAttachment=") == AZStd::string::npos)
{
#ifdef WIN32
OutputDebugString("Log::CreateBackupFile ERROR '");
@@ -1284,12 +1284,12 @@ void CLog::CreateBackupFile() const
fileSystem->Close(inFileHandle);
}
string bakdest = PathUtil::Make(LOG_BACKUP_PATH, sFileWithoutExt + sBackupNameAttachment + "." + sExt);
AZStd::string bakdest = PathUtil::Make(LOG_BACKUP_PATH, sFileWithoutExt + sBackupNameAttachment + "." + sExt);
fileSystem->CreatePath(LOG_BACKUP_PATH);
azstrcpy(m_sBackupFilename, bakdest.c_str());
// Remove any existing backup file with the same name first since the copy will fail otherwise.
fileSystem->Remove(m_sBackupFilename);
fileSystem->Copy(m_szFilename, bakdest);
fileSystem->Copy(m_szFilename, bakdest.c_str());
#endif // AZ_LEGACY_CRYSYSTEM_TRAIT_ALLOW_CREATE_BACKUP_LOG_FILE
}
+12 -18
View File
@@ -88,14 +88,7 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
}
// Handle with the default procedure
#if defined(UNICODE) || defined(_UNICODE)
assert(IsWindowUnicode(hWnd) && "Window should be Unicode when compiling with UNICODE");
#else
if (!IsWindowUnicode(hWnd))
{
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
}
#endif
return DefWindowProcW(hWnd, uMsg, wParam, lParam);
}
#endif
@@ -138,7 +131,6 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
#include "RemoteConsole/RemoteConsole.h"
#include <PNoise3.h>
#include <StringUtils.h>
#include <LyShine/Bus/UiCursorBus.h>
#include <AzFramework/Asset/AssetSystemBus.h>
@@ -1209,10 +1201,11 @@ void CSystem::WarningV(EValidatorModule module, EValidatorSeverity severity, int
}
//////////////////////////////////////////////////////////////////////////
void CSystem::GetLocalizedPath(const char* sLanguage, string& sLocalizedPath)
void CSystem::GetLocalizedPath(const char* sLanguage, AZStd::string& sLocalizedPath)
{
// Omit the trailing slash!
string sLocalizationFolder(string().assign(PathUtil::GetLocalizationFolder(), 0, PathUtil::GetLocalizationFolder().size() - 1));
AZStd::string sLocalizationFolder(PathUtil::GetLocalizationFolder());
sLocalizationFolder.pop_back();
int locFormat = 0;
LocalizationManagerRequestBus::BroadcastResult(locFormat, &LocalizationManagerRequestBus::Events::GetLocalizationFormat);
@@ -1228,16 +1221,17 @@ void CSystem::GetLocalizedPath(const char* sLanguage, string& sLocalizedPath)
}
else
{
sLocalizedPath = string("Localized/") + sLanguage + "_xml.pak";
sLocalizedPath = AZStd::string("Localized/") + sLanguage + "_xml.pak";
}
}
}
//////////////////////////////////////////////////////////////////////////
void CSystem::GetLocalizedAudioPath(const char* sLanguage, string& sLocalizedPath)
void CSystem::GetLocalizedAudioPath(const char* sLanguage, AZStd::string& sLocalizedPath)
{
// Omit the trailing slash!
string sLocalizationFolder(string().assign(PathUtil::GetLocalizationFolder(), 0, PathUtil::GetLocalizationFolder().size() - 1));
AZStd::string sLocalizationFolder(PathUtil::GetLocalizationFolder());
sLocalizationFolder.pop_back();
if (sLocalizationFolder.compareNoCase("Languages") != 0)
{
@@ -1245,14 +1239,14 @@ void CSystem::GetLocalizedAudioPath(const char* sLanguage, string& sLocalizedPat
}
else
{
sLocalizedPath = string("Localized/") + sLanguage + ".pak";
sLocalizedPath = AZStd::string("Localized/") + sLanguage + ".pak";
}
}
//////////////////////////////////////////////////////////////////////////
void CSystem::CloseLanguagePak(const char* sLanguage)
{
string sLocalizedPath;
AZStd::string sLocalizedPath;
GetLocalizedPath(sLanguage, sLocalizedPath);
m_env.pCryPak->ClosePacks({ sLocalizedPath.c_str(), sLocalizedPath.size() });
}
@@ -1260,7 +1254,7 @@ void CSystem::CloseLanguagePak(const char* sLanguage)
//////////////////////////////////////////////////////////////////////////
void CSystem::CloseLanguageAudioPak(const char* sLanguage)
{
string sLocalizedPath;
AZStd::string sLocalizedPath;
GetLocalizedAudioPath(sLanguage, sLocalizedPath);
m_env.pCryPak->ClosePacks({ sLocalizedPath.c_str(), sLocalizedPath.size() });
}
@@ -1334,11 +1328,11 @@ void CSystem::ExecuteCommandLine(bool deferred)
if (pCmd->GetType() == eCLAT_Post)
{
string sLine = pCmd->GetName();
AZStd::string sLine = pCmd->GetName();
{
if (pCmd->GetValue())
{
sLine += string(" ") + pCmd->GetValue();
sLine += AZStd::string(" ") + pCmd->GetValue();
}
GetILog()->Log("Executing command from command line: \n%s\n", sLine.c_str()); // - the actual command might be executed much later (e.g. level load pause)
+7 -7
View File
@@ -453,7 +453,7 @@ private:
bool ReLaunchMediaCenter();
void UpdateAudioSystems();
void AddCVarGroupDirectory(const string& sPath);
void AddCVarGroupDirectory(const AZStd::string& sPath);
AZStd::unique_ptr<AZ::DynamicModuleHandle> LoadDynamiclibrary(const char* dllName) const;
@@ -623,7 +623,7 @@ private: // ------------------------------------------------------
// ICVar *m_sys_filecache;
ICVar* m_gpu_particle_physics;
string m_sSavedRDriver; //!< to restore the driver when quitting the dedicated server
AZStd::string m_sSavedRDriver; //!< to restore the driver when quitting the dedicated server
//////////////////////////////////////////////////////////////////////////
//! User define callback for system events.
@@ -672,8 +672,8 @@ public:
void OpenBasicPaks();
void OpenLanguagePak(const char* sLanguage);
void OpenLanguageAudioPak(const char* sLanguage);
void GetLocalizedPath(const char* sLanguage, string& sLocalizedPath);
void GetLocalizedAudioPath(const char* sLanguage, string& sLocalizedPath);
void GetLocalizedPath(const char* sLanguage, AZStd::string& sLocalizedPath);
void GetLocalizedAudioPath(const char* sLanguage, AZStd::string& sLocalizedPath);
void CloseLanguagePak(const char* sLanguage);
void CloseLanguageAudioPak(const char* sLanguage);
void UpdateMovieSystem(const int updateFlags, const float fFrameTime, const bool bPreUpdate);
@@ -718,14 +718,14 @@ protected: // -------------------------------------------------------------
CCmdLine* m_pCmdLine;
string m_currentLanguageAudio;
string m_systemConfigName; // computed from system_(hardwareplatform)_(assetsPlatform) - eg, system_android_android.cfg or system_windows_pc.cfg
AZStd::string m_currentLanguageAudio;
AZStd::string m_systemConfigName; // computed from system_(hardwareplatform)_(assetsPlatform) - eg, system_android_android.cfg or system_windows_pc.cfg
std::vector< std::pair<CTimeValue, float> > m_updateTimes;
struct SErrorMessage
{
string m_Message;
AZStd::string m_Message;
float m_fTimeToShow;
float m_Color[4];
bool m_HardFailure;
+31 -31
View File
@@ -279,7 +279,7 @@ public:
int nFlags = pCVar->GetFlags();
if (((nFlags & VF_DUMPTODISK) && (nFlags & VF_MODIFIED)) || (nFlags & VF_WASINCONFIG))
{
string szValue = pCVar->GetString();
AZStd::string szValue = pCVar->GetString();
int pos;
pos = 1;
@@ -287,7 +287,7 @@ public:
{
pos = szValue.find_first_of("\\", pos);
if (pos == string::npos)
if (pos == AZStd::string::npos)
{
break;
}
@@ -302,7 +302,7 @@ public:
{
pos = szValue.find_first_of("\"", pos);
if (pos == string::npos)
if (pos == AZStd::string::npos)
{
break;
}
@@ -311,7 +311,7 @@ public:
pos += 2;
}
string szLine = pCVar->GetName();
AZStd::string szLine = pCVar->GetName();
if (pCVar->GetType() == CVAR_STRING)
{
@@ -344,7 +344,7 @@ void CSystem::SaveConfiguration()
//////////////////////////////////////////////////////////////////////////
// system cfg
//////////////////////////////////////////////////////////////////////////
CSystemConfiguration::CSystemConfiguration(const string& strSysConfigFilePath, CSystem* pSystem, ILoadConfigurationEntrySink* pSink, bool warnIfMissing)
CSystemConfiguration::CSystemConfiguration(const AZStd::string& strSysConfigFilePath, CSystem* pSystem, ILoadConfigurationEntrySink* pSink, bool warnIfMissing)
: m_strSysConfigFilePath(strSysConfigFilePath)
, m_bError(false)
, m_pSink(pSink)
@@ -364,14 +364,14 @@ CSystemConfiguration::~CSystemConfiguration()
//////////////////////////////////////////////////////////////////////////
bool CSystemConfiguration::ParseSystemConfig()
{
string filename = m_strSysConfigFilePath;
if (strlen(PathUtil::GetExt(filename)) == 0)
AZStd::string filename = m_strSysConfigFilePath;
if (strlen(PathUtil::GetExt(filename.c_str())) == 0)
{
filename = PathUtil::ReplaceExtension(filename, "cfg");
}
CCryFile file;
string filenameLog;
AZStd::string filenameLog;
{
int flags = AZ::IO::IArchive::FOPEN_HINT_QUIET | AZ::IO::IArchive::FOPEN_ONDISK;
@@ -380,7 +380,7 @@ bool CSystemConfiguration::ParseSystemConfig()
// this is used when theres a very specific file to read, like @user@/game.cfg which is read
// IN ADDITION to the one in the game folder, and afterwards to override values in it.
// if the file is missing and its already prefixed with an alias, there is no need to look any further.
if (!(file.Open(filename, "rb", flags)))
if (!(file.Open(filename.c_str(), "rb", flags)))
{
if (m_warnIfMissing)
{
@@ -394,11 +394,11 @@ bool CSystemConfiguration::ParseSystemConfig()
// otherwise, if the file isn't prefixed with an alias, then its likely one of the convenience mappings
// to either root or assets/config. this is done so that code can just request a simple file name and get its data
if (
!(file.Open(filename, "rb", flags)) &&
!(file.Open(string("@root@/") + filename, "rb", flags)) &&
!(file.Open(string("@assets@/") + filename, "rb", flags)) &&
!(file.Open(string("@assets@/config/") + filename, "rb", flags)) &&
!(file.Open(string("@assets@/config/spec/") + filename, "rb", flags))
!(file.Open(filename.c_str(), "rb", flags)) &&
!(file.Open((AZStd::string("@root@/") + filename).c_str(), "rb", flags)) &&
!(file.Open((AZStd::string("@assets@/") + filename).c_str(), "rb", flags)) &&
!(file.Open((AZStd::string("@assets@/config/") + filename).c_str(), "rb", flags)) &&
!(file.Open((AZStd::string("@assets@/config/spec/") + filename).c_str(), "rb", flags))
)
{
if (m_warnIfMissing)
@@ -429,7 +429,7 @@ bool CSystemConfiguration::ParseSystemConfig()
sAllText[nLen] = '\0';
sAllText[nLen + 1] = '\0';
string strGroup; // current group e.g. "[General]"
AZStd::string strGroup; // current group e.g. "[General]"
char* strLast = sAllText + nLen;
char* str = sAllText;
@@ -447,11 +447,11 @@ bool CSystemConfiguration::ParseSystemConfig()
str++;
}
string strLine = s;
AZStd::string strLine = s;
// detect groups e.g. "[General]" should set strGroup="General"
{
string strTrimmedLine(RemoveWhiteSpaces(strLine));
AZStd::string strTrimmedLine(RemoveWhiteSpaces(strLine));
size_t size = strTrimmedLine.size();
if (size >= 3)
@@ -466,7 +466,7 @@ bool CSystemConfiguration::ParseSystemConfig()
}
//trim all whitespace characters at the beginning and the end of the current line and store its size
strLine.Trim();
AZ::StringFunc::TrimWhiteSpace(strLine, true, true);
size_t strLineSize = strLine.size();
//skip comments, comments start with ";" or "--" but may have preceding whitespace characters
@@ -488,35 +488,35 @@ bool CSystemConfiguration::ParseSystemConfig()
}
//if line contains a '=' try to read and assign console variable
string::size_type posEq(strLine.find("=", 0));
if (string::npos != posEq)
AZStd::string::size_type posEq(strLine.find("=", 0));
if (AZStd::string::npos != posEq)
{
string stemp(strLine, 0, posEq);
string strKey(RemoveWhiteSpaces(stemp));
AZStd::string stemp(strLine, 0, posEq);
AZStd::string strKey(RemoveWhiteSpaces(stemp));
{
// extract value
string::size_type posValueStart(strLine.find("\"", posEq + 1) + 1);
string::size_type posValueEnd(strLine.rfind('\"'));
AZStd::string::size_type posValueStart(strLine.find("\"", posEq + 1) + 1);
AZStd::string::size_type posValueEnd(strLine.rfind('\"'));
string strValue;
AZStd::string strValue;
if (string::npos != posValueStart && string::npos != posValueEnd)
if (AZStd::string::npos != posValueStart && AZStd::string::npos != posValueEnd)
{
strValue = string(strLine, posValueStart, posValueEnd - posValueStart);
strValue = AZStd::string(strLine, posValueStart, posValueEnd - posValueStart);
}
else
{
string strTmp(strLine, posEq + 1, strLine.size() - (posEq + 1));
AZStd::string strTmp(strLine, posEq + 1, strLine.size() - (posEq + 1));
strValue = RemoveWhiteSpaces(strTmp);
}
{
// replace '\\\\' with '\\' and '\\\"' with '\"'
strValue.replace("\\\\", "\\");
strValue.replace("\\\"", "\"");
AZ::StringFunc::Replace(strValue, "\\\\", "\\");
AZ::StringFunc::Replace(strValue, "\\\"", "\"");
m_pSink->OnLoadConfigurationEntry(strKey, strValue, strGroup);
m_pSink->OnLoadConfigurationEntry(strKey.c_str(), strValue.c_str(), strGroup.c_str());
}
}
}
+8 -8
View File
@@ -15,17 +15,17 @@
#include <math.h>
#include <map>
typedef string SysConfigKey;
typedef string SysConfigValue;
typedef AZStd::string SysConfigKey;
typedef AZStd::string SysConfigValue;
//////////////////////////////////////////////////////////////////////////
class CSystemConfiguration
{
public:
CSystemConfiguration(const string& strSysConfigFilePath, CSystem* pSystem, ILoadConfigurationEntrySink* pSink, bool warnIfMissing = true);
CSystemConfiguration(const AZStd::string& strSysConfigFilePath, CSystem* pSystem, ILoadConfigurationEntrySink* pSink, bool warnIfMissing = true);
~CSystemConfiguration();
string RemoveWhiteSpaces(string& s)
AZStd::string RemoveWhiteSpaces(AZStd::string& s)
{
s.Trim();
return s;
@@ -39,10 +39,10 @@ private: // ----------------------------------------
// success
bool ParseSystemConfig();
CSystem* m_pSystem;
string m_strSysConfigFilePath;
bool m_bError;
ILoadConfigurationEntrySink* m_pSink; // never 0
CSystem* m_pSystem;
AZStd::string m_strSysConfigFilePath;
bool m_bError;
ILoadConfigurationEntrySink* m_pSink; // never 0
bool m_warnIfMissing;
};
-1
View File
@@ -33,7 +33,6 @@
#include "CryLibrary.h"
#include "CryPath.h"
#include <StringUtils.h>
#include <AzFramework/Input/Devices/Mouse/InputDeviceMouse.h>
#include <AzFramework/IO/LocalFileIO.h>
+2 -6
View File
@@ -505,9 +505,7 @@ bool CSystem::GetWinGameFolder(char* szMyDocumentsPath, int maxPathSize)
if (bSucceeded)
{
// Convert from UNICODE to UTF-8
AZStd::string str;
AZStd::to_string(str, AZStd::wstring(wMyDocumentsPath));
azstrcpy(szMyDocumentsPath, maxPathSize, str.c_str());
azstrcpy(szMyDocumentsPath, maxPathSize, CryStringUtils::WStrToUTF8(wMyDocumentsPath));
CoTaskMemFree(wMyDocumentsPath);
}
}
@@ -521,9 +519,7 @@ bool CSystem::GetWinGameFolder(char* szMyDocumentsPath, int maxPathSize)
bSucceeded = SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_PERSONAL | CSIDL_FLAG_CREATE, NULL, 0, wMyDocumentsPath));
if (bSucceeded)
{
AZStd::string str;
AZStd::to_string(str, AZStd::wstring(wMyDocumentsPath));
azstrcpy(szMyDocumentsPath, maxPathSize, str.c_str());
azstrcpy(szMyDocumentsPath, maxPathSize, CryStringUtils::WStrToUTF8(wMyDocumentsPath));
}
}
+1 -1
View File
@@ -36,7 +36,7 @@ public:
ELSE_LOAD_PROPERTY(Vec3); \
ELSE_LOAD_PROPERTY(int); \
ELSE_LOAD_PROPERTY(float); \
ELSE_LOAD_PROPERTY(string); \
ELSE_LOAD_PROPERTY(AZStd::string); \
ELSE_LOAD_PROPERTY(bool);
+5 -4
View File
@@ -13,7 +13,7 @@
#include <ISystem.h>
#include <stack>
typedef std::map<string, XmlNodeRef> IdTable;
typedef std::map<AZStd::string, XmlNodeRef> IdTable;
struct SParseParams
{
IdTable idTable;
@@ -98,7 +98,7 @@ struct ReadPropertyTyped
};
template <>
struct ReadPropertyTyped<string>
struct ReadPropertyTyped<AZStd::string>
{
static bool Load(const SParseParams& parseParams, const char* name, XmlNodeRef& definition, XmlNodeRef& data, IReadXMLSink* pSink)
{
@@ -235,8 +235,9 @@ bool LoadProperty(const SParseParams& parseParams, XmlNodeRef& definition, XmlNo
dataToRead = GetISystem()->CreateXmlNode(data->getTag());
string content = childRef->getContent();
dataToRead->setAttr(name, content.Trim().c_str());
AZStd::string content = childRef->getContent();
AZ::StringFunc::TrimWhiteSpace(content, true, true);
dataToRead->setAttr(name, content.c_str());
}
if (!dataToRead->haveAttr(name))
@@ -114,7 +114,7 @@ void CSerializeXMLWriterImpl::GetMemoryUsage(ICrySizer* pSizer) const
//////////////////////////////////////////////////////////////////////////
const char* CSerializeXMLWriterImpl::GetStackInfo() const
{
static string str;
static AZStd::string str;
str.assign("");
for (int i = 0; i < (int)m_nodeStack.size(); i++)
{
@@ -138,7 +138,7 @@ const char* CSerializeXMLWriterImpl::GetStackInfo() const
//////////////////////////////////////////////////////////////////////////
const char* CSerializeXMLWriterImpl::GetLuaStackInfo() const
{
static string str;
static AZStd::string str;
str.assign("");
for (int i = 0; i < (int)m_luaSaveStack.size(); i++)
{
@@ -138,7 +138,7 @@ private:
bool IsDefaultValue(const Quat& v) const { return v.w == 1.0f && v.v.x == 0 && v.v.y == 0 && v.v.z == 0; };
bool IsDefaultValue(const CTimeValue& v) const { return v.GetValue() == 0; };
bool IsDefaultValue(const char* str) const { return !str || !*str; };
bool IsDefaultValue(const string& str) const { return str.empty(); };
bool IsDefaultValue(const AZStd::string& str) const { return str.empty(); };
bool IsDefaultValue(const SSerializeString& str) const { return str.empty(); };
//////////////////////////////////////////////////////////////////////////
+2 -2
View File
@@ -12,7 +12,7 @@
#include <stack>
typedef std::map<string, XmlNodeRef> IdTable;
typedef std::map<AZStd::string, XmlNodeRef> IdTable;
static bool IsOptionalWriteXML(XmlNodeRef& definition);
@@ -66,7 +66,7 @@ struct WritePropertyTyped
};
template <>
struct WritePropertyTyped<string>
struct WritePropertyTyped<AZStd::string>
: public WritePropertyTyped<const char*>
{
};
+6 -6
View File
@@ -25,25 +25,25 @@ namespace XMLBinary
{
public:
CXMLBinaryWriter();
bool WriteNode(IDataWriter* pFile, XmlNodeRef node, bool bNeedSwapEndian, XMLBinary::IFilter* pFilter, string& error);
bool WriteNode(IDataWriter* pFile, XmlNodeRef node, bool bNeedSwapEndian, XMLBinary::IFilter* pFilter, AZStd::string & error);
private:
bool CompileTables(XmlNodeRef node, XMLBinary::IFilter* pFilter, string& error);
bool CompileTables(XmlNodeRef node, XMLBinary::IFilter* pFilter, AZStd::string& error);
bool CompileTablesForNode(XmlNodeRef node, int nParentIndex, XMLBinary::IFilter* pFilter, string& error);
bool CompileChildTable(XmlNodeRef node, XMLBinary::IFilter* pFilter, string& error);
bool CompileTablesForNode(XmlNodeRef node, int nParentIndex, XMLBinary::IFilter* pFilter, AZStd::string& error);
bool CompileChildTable(XmlNodeRef node, XMLBinary::IFilter* pFilter, AZStd::string& error);
int AddString(const XmlString& sString);
private:
// tables.
typedef std::map<IXmlNode*, int> NodesMap;
typedef std::map<string, uint> StringMap;
typedef std::map<AZStd::string, uint> StringMap;
std::vector<Node> m_nodes;
NodesMap m_nodesMap;
std::vector<Attribute> m_attributes;
std::vector<NodeIndex> m_childs;
std::vector<string> m_strings;
std::vector<AZStd::string> m_strings;
StringMap m_stringMap;
uint m_nStringDataSize;
+8 -9
View File
@@ -9,7 +9,6 @@
#include "CrySystem_precompiled.h"
#include "XMLPatcher.h"
#include "StringUtils.h"
CXMLPatcher::CXMLPatcher(XmlNodeRef& patchXML)
{
@@ -84,7 +83,7 @@ XmlNodeRef CXMLPatcher::FindPatchForFile(
{
const char* pForFile = child->getAttr("forfile");
if (pForFile && CryStringUtils::stristr(pForFile, pInFileToPatch) != 0)
if (pForFile && AZ::StringFunc::Find(pForFile, pInFileToPatch) != AZStd::string::npos)
{
result = child;
break;
@@ -353,7 +352,7 @@ void CXMLPatcher::DumpXMLNodes(
INDENT();
ioTempString->Format("<%s ", inNode->getTag());
*ioTempString = AZStd::fixed_string<512>::format("<%s ", inNode->getTag());
pPak->FWrite(ioTempString->c_str(), ioTempString->length(), inFileHandle);
@@ -361,7 +360,7 @@ void CXMLPatcher::DumpXMLNodes(
{
const char* pKey, * pVal;
inNode->getAttributeByIndex(i, &pKey, &pVal);
ioTempString->Format("%s=\"%s\" ", pKey, pVal);
*ioTempString = AZStd::fixed_string<512>::format("%s=\"%s\" ", pKey, pVal);
pPak->FWrite(ioTempString->c_str(), ioTempString->length(), inFileHandle);
}
pPak->FWrite(">\n", 2, inFileHandle);
@@ -372,7 +371,7 @@ void CXMLPatcher::DumpXMLNodes(
}
INDENT();
ioTempString->Format("</%s>\n", inNode->getTag());
*ioTempString = AZStd::fixed_string<512>::format("</%s>\n", inNode->getTag());
pPak->FWrite(ioTempString->c_str(), ioTempString->length(), inFileHandle);
}
@@ -391,12 +390,12 @@ void CXMLPatcher::DumpFiles(
{
pOrigFileName++;
DumpXMLFile(string().Format("PATCH_%s", pOrigFileName), inBefore);
DumpXMLFile(AZStd::string::format("PATCH_%s", pOrigFileName).c_str(), inBefore);
AZStd::fixed_string<128> newFileName(pOrigFileName);
newFileName.replace(".xml", "_patched.xml");
AZStd::string newFileName(pOrigFileName);
AZ::StringFunc::Replace(newFileName, ".xml", "_patched.xml");
DumpXMLFile(string().Format("PATCH_%s", newFileName.c_str()), inAfter);
DumpXMLFile(AZStd::string::format("PATCH_%s", newFileName.c_str()).c_str(), inAfter);
}
else
{
+1 -1
View File
@@ -313,7 +313,7 @@ bool CXmlUtils::SaveBinaryXmlFile(const char* filename, XmlNodeRef root)
return false;
}
XMLBinary::CXMLBinaryWriter writer;
string error;
AZStd::string error;
return writer.WriteNode(&fileSink, root, false, 0, error);
}
+9 -9
View File
@@ -984,13 +984,13 @@ XmlString CXmlNode::MakeValidXmlString(const XmlString& instr) const
XmlString str = instr;
// check if str contains any invalid characters
str.replace("&", "&amp;");
str.replace("\"", "&quot;");
str.replace("\'", "&apos;");
str.replace("<", "&lt;");
str.replace(">", "&gt;");
str.replace("...", "&gt;");
str.replace("\n", "&#10;");
AZ::StringFunc::Replace(str, "&", "&amp;");
AZ::StringFunc::Replace(str, "\"", "&quot;");
AZ::StringFunc::Replace(str, "\'", "&apos;");
AZ::StringFunc::Replace(str, "<", "&lt;");
AZ::StringFunc::Replace(str, ">", "&gt;");
AZ::StringFunc::Replace(str, "...", "&gt;");
AZ::StringFunc::Replace(str, "\n", "&#10;");
return str;
}
@@ -1732,9 +1732,9 @@ XmlNodeRef XmlParserImp::ParseFile(const char* filename, XmlString& errorString,
return 0;
}
adjustedFilename = xmlFile.GetAdjustedFilename();
adjustedFilename.replace('\\', '/');
AZStd::replace(adjustedFilename.begin(), adjustedFilename.end(), '\\', '/');
pakPath = xmlFile.GetPakPath();
pakPath.replace('\\', '/');
AZStd::replace(pakPath.begin(), pakPath.end(), '\\', '/');
}
if (g_bEnableBinaryXmlLoading)
-4
View File
@@ -362,13 +362,9 @@ GridHubComponent::GridHubComponent()
DWORD dwCompNameLen = AZ_ARRAY_SIZE(name);
if ( GetComputerName(name, &dwCompNameLen) != 0 )
{
#ifdef _UNICODE
char c[MAX_COMPUTERNAME_LENGTH + 1];
wcstombs(c, name, AZ_ARRAY_SIZE(c));
m_hubName = c;
#else
m_hubName = name;
#endif
}
else
#endif
-2
View File
@@ -36,7 +36,6 @@ ly_add_target(
${additional_dependencies}
COMPILE_DEFINITIONS
PRIVATE
UNICODE
STANDALONETOOLS_ENABLE_LUA_IDE
)
@@ -68,6 +67,5 @@ ly_add_target(
${additional_dependencies}
COMPILE_DEFINITIONS
PRIVATE
UNICODE
STANDALONETOOLS_ENABLE_PROFILER
)
@@ -8,6 +8,8 @@
#include <FFontXML_Internal.h>
#include <AzCore/IO/Path/Path.h>
#include <shlobj_core.h>
namespace AtomFontInternal
@@ -17,13 +19,11 @@ namespace AtomFontInternal
TCHAR sysFontPath[MAX_PATH];
if (SUCCEEDED(SHGetFolderPath(0, CSIDL_FONTS, 0, SHGFP_TYPE_DEFAULT, sysFontPath)))
{
const char* fontPath = m_strFontPath.c_str();
const char* fontName = AZ::IO::PathView(fontPath).Filename();
const AZ::IO::PathView fontName = AZ::IO::PathView(m_strFontPath.c_str()).Filename();
string newFontPath(sysFontPath);
newFontPath += "/";
newFontPath += fontName;
m_font->Load(newFontPath, m_FontTexSize.x, m_FontTexSize.y, m_slotSizes.x, m_slotSizes.y, CreateTTFFontFlag(m_FontSmoothMethod, m_FontSmoothAmount), m_SizeRatio);
AZ::IO::Path newFontPath(sysFontPath);
newFontPath /= fontName;
m_font->Load(newFontPath.c_str(), m_FontTexSize.x, m_FontTexSize.y, m_slotSizes.x, m_slotSizes.y, CreateTTFFontFlag(m_FontSmoothMethod, m_FontSmoothAmount), m_SizeRatio);
}
}
}
@@ -11,7 +11,7 @@
#include <AtomLyIntegration/AtomFont/FontTexture.h>
//-------------------------------------------------------------------------------------------------
int AZ::FontTexture::WriteToFile(const string& fileName)
int AZ::FontTexture::WriteToFile(const AZStd::string& fileName)
{
AZ::IO::FileIOStream outputFile(fileName.c_str(), AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeBinary);
@@ -46,7 +46,7 @@ static void DumfontTexture(IConsoleCmdArgs* cmdArgs)
if (fontName && *fontName && *fontName != '0')
{
string fontFilePath("@devroot@/");
AZStd::string fontFilePath("@devroot@/");
fontFilePath += fontName;
fontFilePath += ".bmp";
@@ -61,7 +61,7 @@ static void DumfontTexture(IConsoleCmdArgs* cmdArgs)
static void DumfontNames([[maybe_unused]] IConsoleCmdArgs* cmdArgs)
{
string names = gEnv->pCryFont->GetLoadedFontNames();
AZStd::string names = gEnv->pCryFont->GetLoadedFontNames();
gEnv->pLog->LogWithType(IMiniLog::eInputResponse, "Currently loaded fonts: %s", names.c_str());
}
@@ -97,15 +97,15 @@ namespace
&& !m_boldItalicFontFilename.empty();
}
string m_lang; //!< Stores a comma-separated list of languages this collection of fonts applies to.
AZStd::string m_lang; //!< Stores a comma-separated list of languages this collection of fonts applies to.
//!< If this is an empty string, it implies that these set of fonts will be applied
//!< by default (when a language is being used but no fonts in the font family are
//!< mapped to that language).
string m_fontFilename; //!< Font used when no styling is applied.
string m_boldFontFilename; //!< Bold-styled font
string m_italicFontFilename; //!< Italic-styled font
string m_boldItalicFontFilename; //!< Bold-italic-styled font
AZStd::string m_fontFilename; //!< Font used when no styling is applied.
AZStd::string m_boldFontFilename; //!< Bold-styled font
AZStd::string m_italicFontFilename; //!< Italic-styled font
AZStd::string m_boldItalicFontFilename; //!< Bold-italic-styled font
};
//! Stores parsed font family XML data.
@@ -152,7 +152,7 @@ namespace
return !m_fontFamilyName.empty();
}
string m_fontFamilyName; //!< Value of the "name" font-family tag attribute
AZStd::string m_fontFamilyName; //!< Value of the "name" font-family tag attribute
AZStd::list<FontTagXml> m_fontTagsXml; //!< List of child <font> tag data.
};
@@ -179,7 +179,7 @@ namespace
return false;
}
string name;
AZStd::string name;
for (int i = 0, count = node->getNumAttributes(); i < count; ++i)
{
@@ -187,7 +187,7 @@ namespace
const char* value = "";
if (node->getAttributeByIndex(i, &key, &value))
{
if (string(key) == "name")
if (AZStd::string(key) == "name")
{
name = value;
}
@@ -199,7 +199,7 @@ namespace
}
}
name.Trim();
AZ::StringFunc::TrimWhiteSpace(name, true, true);
if (!name.empty())
{
xmlData.m_fontFamilyName = name;
@@ -216,14 +216,14 @@ namespace
{
xmlData.m_fontTagsXml.push_back(FontTagXml());
string lang;
AZStd::string lang;
for (int i = 0, count = node->getNumAttributes(); i < count; ++i)
{
const char* key = "";
const char* value = "";
if (node->getAttributeByIndex(i, &key, &value))
{
if (string(key) == "lang")
if (AZStd::string(key) == "lang")
{
lang = value;
}
@@ -235,7 +235,7 @@ namespace
}
}
lang.Trim();
AZ::StringFunc::TrimWhiteSpace(lang, true, true);
if (!lang.empty())
{
xmlData.m_fontTagsXml.back().m_lang = lang;
@@ -253,8 +253,8 @@ namespace
return false;
}
string path;
string tags;
AZStd::string path;
AZStd::string tags;
for (int i = 0, count = node->getNumAttributes(); i < count; ++i)
{
@@ -262,11 +262,11 @@ namespace
const char* value = "";
if (node->getAttributeByIndex(i, &key, &value))
{
if (string(key) == "path")
if (AZStd::string(key) == "path")
{
path = value;
}
else if (string(key) == "tags")
else if (AZStd::string(key) == "tags")
{
tags = value;
}
@@ -278,7 +278,7 @@ namespace
}
}
tags.Trim();
AZ::StringFunc::TrimWhiteSpace(tags, true, true);
if (tags.empty())
{
xmlData.m_fontTagsXml.back().m_fontFilename = path;
@@ -315,7 +315,7 @@ namespace
//! when referencing font family names from font family XML files), and
//! attempting to load the XML files directly via ISystem() methods can
//! produce a lot of warning noise.
XmlNodeRef SafeLoadXmlFromFile(const string& xmlPath)
XmlNodeRef SafeLoadXmlFromFile(const AZStd::string& xmlPath)
{
if (gEnv->pCryPak->IsFileExist(xmlPath.c_str()))
{
@@ -383,8 +383,8 @@ void AZ::AtomFont::Release()
IFFont* AZ::AtomFont::NewFont(const char* fontName)
{
string name = fontName;
name.MakeLower();
AZStd::string name = fontName;
AZStd::to_lower(name.begin(), name.end());
AzFramework::FontId fontId = GetFontId(name.c_str());
FontMapItor it = m_fonts.find(fontId);
@@ -404,7 +404,9 @@ IFFont* AZ::AtomFont::NewFont(const char* fontName)
IFFont* AZ::AtomFont::GetFont(const char* fontName) const
{
AzFramework::FontId fontId = GetFontId(string(fontName).MakeLower().c_str());
AZStd::string name = fontName;
AZStd::to_lower(name.begin(), name.end());
AzFramework::FontId fontId = GetFontId(name.c_str());
FontMapConstItor it = m_fonts.find(fontId);
return it != m_fonts.end() ? it->second : 0;
}
@@ -423,8 +425,8 @@ AzFramework::FontDrawInterface* AZ::AtomFont::GetDefaultFontDrawInterface() cons
FontFamilyPtr AZ::AtomFont::LoadFontFamily(const char* fontFamilyName)
{
FontFamilyPtr fontFamily(nullptr);
string fontFamilyPath;
string fontFamilyFullPath;
AZStd::string fontFamilyPath;
AZStd::string fontFamilyFullPath;
XmlNodeRef root = LoadFontFamilyXml(fontFamilyName, fontFamilyPath, fontFamilyFullPath);
@@ -450,13 +452,13 @@ FontFamilyPtr AZ::AtomFont::LoadFontFamily(const char* fontFamilyName)
}
else
{
int searchPos = 0;
string langToken;
// "lang" font-tag attribute could be comma-separated
while (!(langToken = fontTagXml.m_lang.Tokenize(",", searchPos)).empty())
AZStd::vector<AZStd::string> tokens;
AZ::StringFunc::Tokenize(fontTagXml.m_lang, tokens, ',');
for(AZStd::string& langToken : tokens)
{
if (langToken.Trim() == currentLanguage)
AZ::StringFunc::TrimWhiteSpace(langToken, true, true);
if (langToken == currentLanguage)
{
langSpecificFont = &fontTagXml;
break;
@@ -494,7 +496,7 @@ FontFamilyPtr AZ::AtomFont::LoadFontFamily(const char* fontFamilyName)
// Map the font family name both by path and by name defined
// within the Font Family XML itself. This allows font
// families to also be referenced simply by name.
if (!AddFontFamilyToMaps(fontFamilyFullPath, xmlData.m_fontFamilyName, fontFamily))
if (!AddFontFamilyToMaps(fontFamilyFullPath.c_str(), xmlData.m_fontFamilyName.c_str(), fontFamily))
{
SAFE_RELEASE(normal);
SAFE_RELEASE(bold);
@@ -540,7 +542,7 @@ FontFamilyPtr AZ::AtomFont::LoadFontFamily(const char* fontFamilyName)
// Use filepath as familyName so font loading/unloading doesn't break with duplicate file names
fontFamily->familyName = fontFamilyName;
if (!AddFontFamilyToMaps(fontFamilyName, fontFamily->familyName, fontFamily))
if (!AddFontFamilyToMaps(fontFamilyName, fontFamily->familyName.c_str(), fontFamily))
{
SAFE_RELEASE(font);
@@ -581,7 +583,9 @@ FontFamilyPtr AZ::AtomFont::GetFontFamily(const char* fontFamilyName)
// or just the filename of a font itself. Fonts are mapped by font family
// name or by filepath, so attempt lookup using the map first since it's
// the fastest.
string loweredName = string(fontFamilyName).Trim().MakeLower();
AZStd::string loweredName = AZStd::string(fontFamilyName);
AZ::StringFunc::TrimWhiteSpace(loweredName, true, true);
AZStd::to_lower(loweredName.begin(), loweredName.end());
auto it = m_fontFamilies.find(PathUtil::MakeGamePath(loweredName).c_str());
if (it != m_fontFamilies.end())
{
@@ -596,9 +600,9 @@ FontFamilyPtr AZ::AtomFont::GetFontFamily(const char* fontFamilyName)
for (const auto& fontFamilyIter : m_fontFamilies)
{
const AZStd::string& mappedFontFamilyName = fontFamilyIter.first;
string mappedFilenameNoExtension = PathUtil::GetFileName(mappedFontFamilyName.c_str());
AZStd::string mappedFilenameNoExtension = PathUtil::GetFileName(mappedFontFamilyName.c_str());
string searchStringFilenameNoExtension = PathUtil::GetFileName(loweredName);
AZStd::string searchStringFilenameNoExtension = PathUtil::GetFileName(loweredName);
if (mappedFilenameNoExtension == searchStringFilenameNoExtension)
{
@@ -619,9 +623,9 @@ void AZ::AtomFont::AddCharsToFontTextures(FontFamilyPtr fontFamily, const char*
fontFamily->boldItalic->AddCharsToFontTexture(chars, glyphSizeX, glyphSizeY);
}
string AZ::AtomFont::GetLoadedFontNames() const
AZStd::string AZ::AtomFont::GetLoadedFontNames() const
{
string ret;
AZStd::string ret;
for (FontMapConstItor it = m_fonts.begin(), itEnd = m_fonts.end(); it != itEnd; ++it)
{
FFont* font = it->second;
@@ -678,7 +682,9 @@ void AZ::AtomFont::ReloadAllFonts()
void AZ::AtomFont::UnregisterFont(const char* fontName)
{
AzFramework::FontId fontId = GetFontId(string(fontName).MakeLower().c_str());
AZStd::string name(fontName);
AZStd::to_lower(name.begin(), name.end());
AzFramework::FontId fontId = GetFontId(name.c_str());
FontMapItor it = m_fonts.find(fontId);
#if defined(AZ_ENABLE_TRACING)
@@ -715,10 +721,10 @@ void AZ::AtomFont::UnregisterFont(const char* fontName)
IFFont* AZ::AtomFont::LoadFont(const char* fontName)
{
string fontNameLower = fontName;
fontNameLower.MakeLower();
AZStd::string fontNameLower = fontName;
AZStd::to_lower(fontNameLower.begin(), fontNameLower.end());
IFFont* font = GetFont(fontNameLower);
IFFont* font = GetFont(fontNameLower.c_str());
if (font)
{
font->AddRef(); // use existing loaded font
@@ -726,10 +732,10 @@ IFFont* AZ::AtomFont::LoadFont(const char* fontName)
else
{
// attempt to create and load a new font, use the font pathname as the font name
font = NewFont(fontNameLower);
font = NewFont(fontNameLower.c_str());
if (!font)
{
string errorMsg = "Error creating a new font named ";
AZStd::string errorMsg = "Error creating a new font named ";
errorMsg += fontNameLower;
errorMsg += ".";
CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_ERROR, errorMsg.c_str());
@@ -737,12 +743,12 @@ IFFont* AZ::AtomFont::LoadFont(const char* fontName)
else
{
// creating font adds one to its refcount so no need for AddRef here
if (!font->Load(fontNameLower))
if (!font->Load(fontNameLower.c_str()))
{
string errorMsg = "Error loading a font from ";
AZStd::string errorMsg = "Error loading a font from ";
errorMsg += fontNameLower;
errorMsg += ".";
CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_ERROR, errorMsg);
CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_ERROR, errorMsg.c_str());
font->Release();
font = nullptr;
}
@@ -764,8 +770,9 @@ void AZ::AtomFont::ReleaseFontFamily(FontFamily* fontFamily)
// Note that the FontFamily is mapped both by filename and by "family name"
auto it = m_fontFamilyReverseLookup[fontFamily];
m_fontFamilies.erase(it);
string familyName(fontFamily->familyName);
m_fontFamilies.erase(familyName.MakeLower().c_str());
AZStd::string familyName(fontFamily->familyName);
AZStd::to_lower(familyName.begin(), familyName.end());
m_fontFamilies.erase(familyName.c_str());
// Reverse lookup is used to avoid needing to store filename path with
// the font family, so we need to remove that entry also.
@@ -785,12 +792,11 @@ bool AZ::AtomFont::AddFontFamilyToMaps(const char* fontFamilyFilename, const cha
}
// We don't support "updating" mapped values.
AZStd::string loweredFilename(PathUtil::MakeGamePath(string(fontFamilyFilename)).c_str());
AZStd::string loweredFilename(PathUtil::MakeGamePath(AZStd::string(fontFamilyFilename)).c_str());
AZStd::to_lower<AZStd::string::iterator>(loweredFilename.begin(), loweredFilename.end());
if (m_fontFamilies.find(loweredFilename) != m_fontFamilies.end())
{
string warnMsg;
warnMsg.Format("Couldn't load Font Family '%s': already loaded", fontFamilyFilename);
AZStd::string warnMsg = AZStd::string::format("Couldn't load Font Family '%s': already loaded", fontFamilyFilename);
CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, warnMsg.c_str());
return false;
}
@@ -801,8 +807,7 @@ bool AZ::AtomFont::AddFontFamilyToMaps(const char* fontFamilyFilename, const cha
AZStd::to_lower<AZStd::string::iterator>(loweredFontFamilyName.begin(), loweredFontFamilyName.end());
if (m_fontFamilies.find(loweredFontFamilyName) != m_fontFamilies.end())
{
string warnMsg;
warnMsg.Format("Couldn't load Font Family '%s': already loaded", fontFamilyName);
AZStd::string warnMsg = AZStd::string::format("Couldn't load Font Family '%s': already loaded", fontFamilyName);
CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, warnMsg.c_str());
return false;
}
@@ -819,7 +824,7 @@ bool AZ::AtomFont::AddFontFamilyToMaps(const char* fontFamilyFilename, const cha
return true;
}
XmlNodeRef AZ::AtomFont::LoadFontFamilyXml(const char* fontFamilyName, string& outputDirectory, string& outputFullPath)
XmlNodeRef AZ::AtomFont::LoadFontFamilyXml(const char* fontFamilyName, AZStd::string& outputDirectory, AZStd::string& outputFullPath)
{
outputFullPath = fontFamilyName;
outputDirectory = PathUtil::GetPath(fontFamilyName);
@@ -829,8 +834,8 @@ XmlNodeRef AZ::AtomFont::LoadFontFamilyXml(const char* fontFamilyName, string& o
// not a path, so we try to build a "best guess" path from the name.
if (!root)
{
string fileNoExtension(PathUtil::GetFileName(fontFamilyName));
string fileExtension(PathUtil::GetExt(fontFamilyName));
AZStd::string fileNoExtension(PathUtil::GetFileName(fontFamilyName));
AZStd::string fileExtension(PathUtil::GetExt(fontFamilyName));
if (fileExtension.empty())
{
@@ -838,14 +843,14 @@ XmlNodeRef AZ::AtomFont::LoadFontFamilyXml(const char* fontFamilyName, string& o
}
// Try: "fonts/fontName.fontfamily"
outputDirectory = string("fonts/");
outputDirectory = AZStd::string("fonts/");
outputFullPath = outputDirectory + fileNoExtension + fileExtension;
root = SafeLoadXmlFromFile(outputFullPath);
// Finally, try: "fonts/fontName/fontName.fontfamily"
if (!root)
{
outputDirectory = string("fonts/") + fileNoExtension + "/";
outputDirectory = AZStd::string("fonts/") + fileNoExtension + "/";
outputFullPath = outputDirectory + fileNoExtension + fileExtension;
root = SafeLoadXmlFromFile(outputFullPath);
}
@@ -126,7 +126,7 @@ bool AZ::FFont::Load(const char* fontFilePath, unsigned int width, unsigned int
auto pPak = gEnv->pCryPak;
string fullFile;
AZStd::string fullFile;
if (pPak->IsAbsPath(fontFilePath))
{
fullFile = fontFilePath;
@@ -1166,7 +1166,7 @@ size_t AZ::FFont::GetTextLength(const char* str, const bool asciiMultiLine) cons
return len;
}
void AZ::FFont::WrapText(string& result, float maxWidth, const char* str, const TextDrawContext& ctx)
void AZ::FFont::WrapText(AZStd::string& result, float maxWidth, const char* str, const TextDrawContext& ctx)
{
result = str;
@@ -47,8 +47,7 @@ bool PropertyHandlerChar::ReadValuesIntoGUI(size_t index, AzToolsFramework::Prop
// NOTE: this assumes the uint32_t can be interpreted as a wchar_t, it seems to
// work for cases tested but may not in general.
wchar_t wcharString[2] = { static_cast<wchar_t>(instance), 0 };
AZStd::string val;
AZStd::to_string(val, AZStd::wstring(wcharString));
AZStd::string val(CryStringUtils::WStrToUTF8(wcharString));
GUI->setValue(val);
}
GUI->blockSignals(false);
@@ -9,7 +9,6 @@
#include "UiClipboard.h"
#include <AzCore/PlatformIncl.h>
#include <StringUtils.h>
bool UiClipboard::SetText(const AZStd::string& text)
{
@@ -20,8 +19,7 @@ bool UiClipboard::SetText(const AZStd::string& text)
{
if (text.length() > 0)
{
AZStd::wstring wstr;
AZStd::to_wstring(wstr, text);
auto wstr = CryStringUtils::UTF8ToWStr(text.c_str());
const SIZE_T buffSize = (wstr.size() + 1) * sizeof(WCHAR);
if (HGLOBAL hBuffer = GlobalAlloc(GMEM_MOVEABLE, buffSize))
{
@@ -47,7 +45,7 @@ AZStd::string UiClipboard::GetText()
if (HANDLE hText = GetClipboardData(CF_UNICODETEXT))
{
const WCHAR* text = static_cast<const WCHAR*>(GlobalLock(hText));
AZStd::to_string(outText, AZStd::wstring(text));
outText = CryStringUtils::WStrToUTF8(text);
GlobalUnlock(hText);
}
CloseClipboard();
+1 -2
View File
@@ -36,8 +36,7 @@ namespace LyShine
// In the long run it would be better to eliminate
// this function and use Unicode::CIterator<>::Position instead.
wchar_t wcharString[2] = { static_cast<wchar_t>(multiByteChar), 0 };
AZStd::string utf8String;
AZStd::to_string(utf8String, AZStd::wstring(wcharString));
AZStd::string utf8String(CryStringUtils::WStrToUTF8(wcharString));
int utf8Length = utf8String.length();
return utf8Length;
}
@@ -222,7 +222,7 @@ bool UiButtonComponent::VersionConverter(AZ::SerializeContext& context,
// - Need to convert Color to Color and Alpha
// conversion from version 2 to 3:
// - Need to convert CryString ActionName elements to AZStd::string
AZ_Assert(classElement.GetVersion() < 3, "Unsupported UiButtonComponent version: %d", classElement.GetVersion());
AZ_Assert(classElement.GetVersion() >= 3, "Unsupported UiButtonComponent version: %d", classElement.GetVersion());
// conversion from version 3 to 4:
// - Need to convert AZStd::string sprites to AzFramework::SimpleAssetReference<LmbrCentral::TextureAsset>
@@ -2663,7 +2663,7 @@ bool UiImageComponent::VersionConverter(AZ::SerializeContext& context,
// conversion from version 1:
// - Need to convert CryString elements to AZStd::string
// - Need to convert Color to Color and Alpha
AZ_Assert(classElement.GetVersion() <= 1, "Unsupported UiImageComponent version: %d", classElement.GetVersion());
AZ_Assert(classElement.GetVersion() > 1, "Unsupported UiImageComponent version: %d", classElement.GetVersion());
// conversion from version 1 or 2 to current:
// - Need to convert AZStd::string sprites to AzFramework::SimpleAssetReference<LmbrCentral::TextureAsset>
+1 -1
View File
@@ -4996,7 +4996,7 @@ bool UiTextComponent::VersionConverter(AZ::SerializeContext& context,
{
// conversion from version 1: Need to convert Color to Color and Alpha
// conversion from version 1 or 2: Need to convert Text from CryString to AzString
AZ_Assert(classElement.GetVersion() <= 2, "Unsupported UiTextComponent version: %d", classElement.GetVersion());
AZ_Assert(classElement.GetVersion() > 2, "Unsupported UiTextComponent version: %d", classElement.GetVersion());
// Versions prior to v4: Change default font
if (classElement.GetVersion() <= 3)
@@ -1185,8 +1185,7 @@ void UiTextInputComponent::UpdateDisplayedTextFunction()
// NOTE: this assumes the uint32_t can be interpreted as a wchar_t, it seems to
// work for cases tested but may not in general.
wchar_t wcharString[2] = { static_cast<wchar_t>(this->GetReplacementCharacter()), 0 };
AZStd::string replacementCharString;
AZStd::to_string(replacementCharString, AZStd::wstring(wcharString));
AZStd::string replacementCharString(CryStringUtils::WStrToUTF8(wcharString));
int numReplacementChars = LyShine::GetUtf8StringLength(originalText);
@@ -1478,7 +1477,7 @@ bool UiTextInputComponent::VersionConverter(AZ::SerializeContext& context,
// - Need to convert Color to Color and Alpha
// conversion from version 1 or 2 to current:
// - Need to convert CryString ActionName elements to AZStd::string
AZ_Assert(classElement.GetVersion() <= 2, "Unsupported UiTextInputComponent version: %d", classElement.GetVersion());
AZ_Assert(classElement.GetVersion() > 2, "Unsupported UiTextInputComponent version: %d", classElement.GetVersion());
// conversion from version 1, 2 or 3 to current:
// - Need to convert AZStd::string sprites to AzFramework::SimpleAssetReference<LmbrCentral::TextureAsset>