diff --git a/Gems/LyShine/Code/Editor/Animation/Controls/UiSplineCtrlEx.cpp b/Gems/LyShine/Code/Editor/Animation/Controls/UiSplineCtrlEx.cpp index 39e5bd0f5f..746ea04559 100644 --- a/Gems/LyShine/Code/Editor/Animation/Controls/UiSplineCtrlEx.cpp +++ b/Gems/LyShine/Code/Editor/Animation/Controls/UiSplineCtrlEx.cpp @@ -135,7 +135,7 @@ private: std::vector keySelectionFlags; _smart_ptr undo; _smart_ptr redo; - string id; + AZStd::string id; ISplineInterpolator* pSpline; }; diff --git a/Gems/LyShine/Code/Editor/Animation/Controls/UiSplineCtrlEx.h b/Gems/LyShine/Code/Editor/Animation/Controls/UiSplineCtrlEx.h index 18ee7e173c..2a7b0c3d1f 100644 --- a/Gems/LyShine/Code/Editor/Animation/Controls/UiSplineCtrlEx.h +++ b/Gems/LyShine/Code/Editor/Animation/Controls/UiSplineCtrlEx.h @@ -45,8 +45,8 @@ class QRubberBand; class ISplineSet { public: - virtual ISplineInterpolator* GetSplineFromID(const string& id) = 0; - virtual string GetIDFromSpline(ISplineInterpolator* pSpline) = 0; + virtual ISplineInterpolator* GetSplineFromID(const AZStd::string& id) = 0; + virtual AZStd::string GetIDFromSpline(ISplineInterpolator* pSpline) = 0; virtual int GetSplineCount() const = 0; virtual int GetKeyCountAtTime(float time, float threshold) const = 0; }; diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.cpp index f860725276..8880795466 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.cpp @@ -1100,7 +1100,7 @@ bool CUiAnimViewAnimNode::SetName(const char* pName) } } - string oldName = GetName(); + AZStd::string oldName = GetName(); m_pAnimNode->SetName(pName); if (UiAnimUndo::IsRecording()) @@ -1108,7 +1108,7 @@ bool CUiAnimViewAnimNode::SetName(const char* pName) UiAnimUndo::Record(new CUndoAnimNodeRename(this, oldName)); } - GetSequence()->OnNodeRenamed(this, oldName); + GetSequence()->OnNodeRenamed(this, oldName.c_str()); return true; } diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp index 61d6b66b29..ac210ba2f2 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp @@ -992,7 +992,7 @@ void CUiAnimViewDialog::ReloadSequencesComboBox() for (int k = 0; k < numSequences; ++k) { CUiAnimViewSequence* pSequence = pSequenceManager->GetSequenceByIndex(k); - QString fullname = QtUtil::ToQString(pSequence->GetName()); + QString fullname = pSequence->GetName(); m_sequencesComboBox->addItem(fullname); } } @@ -1132,7 +1132,7 @@ void CUiAnimViewDialog::OnSequenceChanged(CUiAnimViewSequence* pSequence) if (pSequence) { - m_currentSequenceName = QtUtil::ToQString(pSequence->GetName()); + m_currentSequenceName = pSequence->GetName(); pSequence->Reset(true); SaveZoomScrollSettings(); @@ -1733,7 +1733,7 @@ void CUiAnimViewDialog::OnNodeRenamed(CUiAnimViewNode* pNode, const char* pOldNa { if (m_currentSequenceName == QString(pOldName)) { - m_currentSequenceName = QtUtil::ToQString(pNode->GetName()); + m_currentSequenceName = pNode->GetName(); } ReloadSequencesComboBox(); diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewFindDlg.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewFindDlg.cpp index 86f1f786d0..511866db43 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewFindDlg.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewFindDlg.cpp @@ -13,7 +13,6 @@ #include "UiAnimViewSequenceManager.h" #include -#include #include #include @@ -64,7 +63,7 @@ void CUiAnimViewFindDlg::FillData() ObjName obj; obj.m_objName = pNode->GetName(); obj.m_directorName = pNode->HasDirectorAsParent() ? pNode->HasDirectorAsParent()->GetName() : ""; - string fullname = seq->GetName(); + AZStd::string fullname = seq->GetName(); obj.m_seqName = fullname.c_str(); m_objs.push_back(obj); } diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNewSequenceDialog.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNewSequenceDialog.cpp index 7c4882e7f0..ac824bfc4d 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNewSequenceDialog.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNewSequenceDialog.cpp @@ -46,7 +46,7 @@ void CUiAVNewSequenceDialog::OnOK() for (int k = 0; k < CUiAnimViewSequenceManager::GetSequenceManager()->GetCount(); ++k) { CUiAnimViewSequence* pSequence = CUiAnimViewSequenceManager::GetSequenceManager()->GetSequenceByIndex(k); - QString fullname = QtUtil::ToQString(pSequence->GetName()); + QString fullname = pSequence->GetName(); if (fullname.compare(m_sequenceName, Qt::CaseInsensitive) == 0) { diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp index 9cca6cdf8d..67fd542c3f 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp @@ -486,7 +486,7 @@ CUiAnimViewNodesCtrl::CRecord* CUiAnimViewNodesCtrl::AddAnimNodeRecord(CRecord* { CRecord* pNewRecord = new CRecord(pAnimNode); - pNewRecord->setText(0, QtUtil::ToQString(pAnimNode->GetName())); + pNewRecord->setText(0, pAnimNode->GetName()); UpdateUiAnimNodeRecord(pNewRecord, pAnimNode); pParentRecord->insertChild(GetInsertPosition(pParentRecord, pAnimNode), pNewRecord); FillNodesRec(pNewRecord, pAnimNode); @@ -499,7 +499,7 @@ CUiAnimViewNodesCtrl::CRecord* CUiAnimViewNodesCtrl::AddTrackRecord(CRecord* pPa { CRecord* pNewTrackRecord = new CRecord(pTrack); pNewTrackRecord->setSizeHint(0, QSize(30, 18)); - pNewTrackRecord->setText(0, QtUtil::ToQString(pTrack->GetName())); + pNewTrackRecord->setText(0, pTrack->GetName()); UpdateTrackRecord(pNewTrackRecord, pTrack); pParentRecord->insertChild(GetInsertPosition(pParentRecord, pTrack), pNewTrackRecord); FillNodesRec(pNewTrackRecord, pTrack); @@ -708,7 +708,7 @@ void CUiAnimViewNodesCtrl::OnFillItems() m_nodeToRecordMap.clear(); CRecord* pRootGroupRec = new CRecord(pSequence); - pRootGroupRec->setText(0, QtUtil::ToQString(pSequence->GetName())); + pRootGroupRec->setText(0, pSequence->GetName()); QFont f = font(); f.setBold(true); pRootGroupRec->setData(0, Qt::FontRole, f); @@ -1323,7 +1323,7 @@ int CUiAnimViewNodesCtrl::ShowPopupMenuSingleSelection(UiAnimContextMenu& contex continue; } - QAction* a = contextMenu.main.addAction(QString(" %1").arg(QtUtil::ToQString(pTrack2->GetName()))); + QAction* a = contextMenu.main.addAction(QString(" %1").arg(pTrack2->GetName())); a->setData(eMI_ShowHideBase + childIndex); a->setCheckable(true); a->setChecked(!pTrack2->IsHidden()); @@ -1459,7 +1459,7 @@ void CUiAnimViewNodesCtrl::FillAutoCompletionListForFilter() for (unsigned int i = 0; i < animNodeCount; ++i) { - strings << QtUtil::ToQString(animNodes.GetNode(i)->GetName()); + strings << QString(animNodes.GetNode(i)->GetName()); } } else @@ -1512,7 +1512,7 @@ int CUiAnimViewNodesCtrl::GetMatNameAndSubMtlIndexFromName(QString& matName, con if (const char* pCh = strstr(nodeName, ".[")) { char matPath[MAX_PATH]; - azstrcpy(matPath, nodeName, (size_t)(pCh - nodeName)); + azstrncpy(matPath, nodeName, (size_t)(pCh - nodeName)); matName = matPath; pCh += 2; if ((*pCh) != 0) @@ -1763,7 +1763,7 @@ void CUiAnimViewNodesCtrl::OnNodeRenamed(CUiAnimViewNode* pNode, [[maybe_unused] if (!m_bIgnoreNotifications) { CRecord* pNodeRecord = GetNodeRecord(pNode); - pNodeRecord->setText(0, QtUtil::ToQString(pNode->GetName())); + pNodeRecord->setText(0, pNode->GetName()); update(); } diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequence.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequence.cpp index 7f7f8f7aaf..cdafd8a4ce 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequence.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequence.cpp @@ -683,7 +683,7 @@ bool CUiAnimViewSequence::SetName(const char* pName) return false; } - string oldName = GetName(); + AZStd::string oldName = GetName(); m_pAnimSequence->SetName(pName); if (UiAnimUndo::IsRecording()) @@ -691,7 +691,7 @@ bool CUiAnimViewSequence::SetName(const char* pName) UiAnimUndo::Record(new CUndoAnimNodeRename(this, oldName)); } - GetSequence()->OnNodeRenamed(this, oldName); + GetSequence()->OnNodeRenamed(this, oldName.c_str()); return true; } @@ -893,7 +893,7 @@ std::deque CUiAnimViewSequence::GetMatchingTracks(CUiAnimView { std::deque matchingTracks; - const string trackName = trackNode->getAttr("name"); + const AZStd::string trackName = trackNode->getAttr("name"); IUiAnimationSystem* animationSystem = nullptr; EBUS_EVENT_RESULT(animationSystem, UiEditorAnimationBus, GetAnimationSystem); @@ -956,11 +956,11 @@ void CUiAnimViewSequence::GetMatchedPasteLocationsRec(std::vectorgetChild(nodeIndex); - const string tagName = xmlChildNode->getTag(); + const AZStd::string tagName = xmlChildNode->getTag(); if (tagName == "Node") { - const string nodeName = xmlChildNode->getAttr("name"); + const AZStd::string nodeName = xmlChildNode->getAttr("name"); int nodeType = eUiAnimNodeType_Invalid; xmlChildNode->getAttr("type", nodeType); @@ -982,7 +982,7 @@ void CUiAnimViewSequence::GetMatchedPasteLocationsRec(std::vectorgetAttr("name"); + const AZStd::string trackName = xmlChildNode->getAttr("name"); IUiAnimationSystem* animationSystem = nullptr; EBUS_EVENT_RESULT(animationSystem, UiEditorAnimationBus, GetAnimationSystem); diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewUndo.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewUndo.cpp index 8ab6f2e58c..cd4bf5b1ac 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewUndo.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewUndo.cpp @@ -546,7 +546,7 @@ void CUndoAnimNodeReparent::AddParentsInChildren(CUiAnimViewAnimNode* pCurrentNo } ////////////////////////////////////////////////////////////////////////// -CUndoAnimNodeRename::CUndoAnimNodeRename(CUiAnimViewAnimNode* pNode, const string& oldName) +CUndoAnimNodeRename::CUndoAnimNodeRename(CUiAnimViewAnimNode* pNode, const AZStd::string& oldName) : m_pNode(pNode) , m_newName(pNode->GetName()) , m_oldName(oldName) @@ -556,13 +556,13 @@ CUndoAnimNodeRename::CUndoAnimNodeRename(CUiAnimViewAnimNode* pNode, const strin ////////////////////////////////////////////////////////////////////////// void CUndoAnimNodeRename::Undo([[maybe_unused]] bool bUndo) { - m_pNode->SetName(m_oldName); + m_pNode->SetName(m_oldName.c_str()); } ////////////////////////////////////////////////////////////////////////// void CUndoAnimNodeRename::Redo() { - m_pNode->SetName(m_newName); + m_pNode->SetName(m_newName.c_str()); } ////////////////////////////////////////////////////////////////////////// diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewUndo.h b/Gems/LyShine/Code/Editor/Animation/UiAnimViewUndo.h index d79336cedd..923420c653 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewUndo.h +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewUndo.h @@ -304,7 +304,7 @@ class CUndoAnimNodeRename : public UiAnimUndoObject { public: - CUndoAnimNodeRename(CUiAnimViewAnimNode* pNode, const string& oldName); + CUndoAnimNodeRename(CUiAnimViewAnimNode* pNode, const AZStd::string& oldName); protected: virtual int GetSize() override { return sizeof(*this); }; @@ -315,8 +315,8 @@ protected: private: CUiAnimViewAnimNode* m_pNode; - string m_newName; - string m_oldName; + AZStd::string m_newName; + AZStd::string m_oldName; }; /** Base class for track event transactions diff --git a/Gems/LyShine/Code/Editor/AssetTreeEntry.cpp b/Gems/LyShine/Code/Editor/AssetTreeEntry.cpp index caff5d2da0..206da8cb3a 100644 --- a/Gems/LyShine/Code/Editor/AssetTreeEntry.cpp +++ b/Gems/LyShine/Code/Editor/AssetTreeEntry.cpp @@ -75,7 +75,7 @@ void AssetTreeEntry::Insert(const AZStd::string& path, const AZStd::string& menu AZStd::string folderName; AZStd::string remainderPath; size_t separator = path.find('/'); - if (separator == string::npos) + if (separator == AZStd::string::npos) { folderName = path; } diff --git a/Gems/LyShine/Code/Editor/EditorMenu.cpp b/Gems/LyShine/Code/Editor/EditorMenu.cpp index 97db065a4d..840bd206ab 100644 --- a/Gems/LyShine/Code/Editor/EditorMenu.cpp +++ b/Gems/LyShine/Code/Editor/EditorMenu.cpp @@ -724,7 +724,7 @@ void EditorWindow::AddMenu_View_LanguageSetting(QMenu* viewMenu) // Iterate through the subdirectories of the localization folder. Each // directory corresponds to a different language containing localization // translations for that language. - string fullLocPath(string(gEnv->pFileIO->GetAlias("@assets@")) + "/" + string(m_startupLocFolderName.toUtf8().constData())); + AZStd::string fullLocPath(AZStd::string(gEnv->pFileIO->GetAlias("@assets@")) + "/" + AZStd::string(m_startupLocFolderName.toUtf8().constData())); QDir locDir(fullLocPath.c_str()); locDir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot); locDir.setSorting(QDir::Name); diff --git a/Gems/LyShine/Code/Editor/PropertiesContainer.cpp b/Gems/LyShine/Code/Editor/PropertiesContainer.cpp index 36a78fe684..21b3b99b02 100644 --- a/Gems/LyShine/Code/Editor/PropertiesContainer.cpp +++ b/Gems/LyShine/Code/Editor/PropertiesContainer.cpp @@ -788,7 +788,7 @@ void PropertiesContainer::Update() } else // more than one entity selected { - displayName = ToString(selectedEntitiesAmount) + " elements selected"; + displayName = (ToString(selectedEntitiesAmount) + " elements selected").c_str(); } // Update the selected element display name diff --git a/Gems/LyShine/Code/Editor/PropertyHandlerChar.cpp b/Gems/LyShine/Code/Editor/PropertyHandlerChar.cpp index ac55cd38e9..b3cacec065 100644 --- a/Gems/LyShine/Code/Editor/PropertyHandlerChar.cpp +++ b/Gems/LyShine/Code/Editor/PropertyHandlerChar.cpp @@ -9,6 +9,8 @@ #include "PropertyHandlerChar.h" +#include + QWidget* PropertyHandlerChar::CreateGUI(QWidget* pParent) { AzToolsFramework::PropertyStringLineEditCtrl* ctrl = aznew AzToolsFramework::PropertyStringLineEditCtrl(pParent); @@ -29,12 +31,8 @@ void PropertyHandlerChar::WriteGUIValuesIntoProperty(size_t index, AzToolsFramew { (int)index; AZStd::string str = GUI->value(); - uint32_t character = '\0'; - if (!str.empty()) - { - Unicode::CIterator pChar(str.c_str()); - character = *pChar; - } + wchar_t character = '\0'; + AZStd::to_wstring(&character, 1, str.c_str()); instance = character; } @@ -47,7 +45,8 @@ 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(instance), 0 }; - AZStd::string val(CryStringUtils::WStrToUTF8(wcharString)); + AZStd::string val; + AZStd::to_string(val, wcharString); GUI->setValue(val); } GUI->blockSignals(false); diff --git a/Gems/LyShine/Code/Editor/PropertyHandlerDirectory.cpp b/Gems/LyShine/Code/Editor/PropertyHandlerDirectory.cpp index ab51c3a29d..1f3e28b077 100644 --- a/Gems/LyShine/Code/Editor/PropertyHandlerDirectory.cpp +++ b/Gems/LyShine/Code/Editor/PropertyHandlerDirectory.cpp @@ -93,7 +93,7 @@ AzToolsFramework::AssetBrowser::AssetSelectionModel PropertyAssetDirectorySelect void PropertyAssetDirectorySelectionCtrl::SetFolderSelection(const AZStd::string& folderPath) { - string strFolderPath = folderPath.c_str(); + AZStd::string strFolderPath = folderPath.c_str(); if (strFolderPath.empty()) { m_folderPath.clear(); @@ -106,12 +106,14 @@ void PropertyAssetDirectorySelectionCtrl::SetFolderSelection(const AZStd::string // the project folder, which we need to omit since file IO routines // seem to assume this anyways. strFolderPath = strFolderPath.substr(strFolderPath.find('/') + 1); - m_folderPath = PathUtil::MakeGamePath(strFolderPath).MakeLower(); + m_folderPath = PathUtil::MakeGamePath(strFolderPath); + AZStd::to_lower(m_folderPath.begin(), m_folderPath.end()); } // For paths in gems, absolute paths are returned else { - m_folderPath = Path::FullPathToGamePath(strFolderPath.c_str()).MakeLower(); + m_folderPath = Path::FullPathToGamePath(strFolderPath.c_str()); + AZStd::to_lower(m_folderPath.begin(), m_folderPath.end()); } } diff --git a/Gems/LyShine/Code/Editor/SpriteBorderEditor.cpp b/Gems/LyShine/Code/Editor/SpriteBorderEditor.cpp index 2bb1686a93..d833c93af8 100644 --- a/Gems/LyShine/Code/Editor/SpriteBorderEditor.cpp +++ b/Gems/LyShine/Code/Editor/SpriteBorderEditor.cpp @@ -921,7 +921,7 @@ void SpriteBorderEditor::AddButtonsSection(QGridLayout* gridLayout, int& rowNum) // The texture is guaranteed to exist so use that to get the full path. QString fullTexturePath = Path::GamePathToFullPath(m_sprite->GetTexturePathname().c_str()); const char* const spriteExtension = "sprite"; - string fullSpritePath = PathUtil::ReplaceExtension(fullTexturePath.toUtf8().data(), spriteExtension); + AZStd::string fullSpritePath = PathUtil::ReplaceExtension(fullTexturePath.toUtf8().data(), spriteExtension); FileHelpers::SourceControlAddOrEdit(fullSpritePath.c_str(), QApplication::activeWindow()); diff --git a/Gems/LyShine/Code/Source/Animation/AnimSequence.cpp b/Gems/LyShine/Code/Source/Animation/AnimSequence.cpp index f1ecb4af9e..43a80d5002 100644 --- a/Gems/LyShine/Code/Source/Animation/AnimSequence.cpp +++ b/Gems/LyShine/Code/Source/Animation/AnimSequence.cpp @@ -80,10 +80,10 @@ void CUiAnimSequence::SetName(const char* name) return; // should never happen, null pointer guard } - string originalName = GetName(); + AZStd::string originalName = GetName(); m_name = name; - m_pUiAnimationSystem->OnSequenceRenamed(originalName, m_name.c_str()); + m_pUiAnimationSystem->OnSequenceRenamed(originalName.c_str(), m_name.c_str()); if (GetOwner()) { diff --git a/Gems/LyShine/Code/Source/Animation/AnimSequence.h b/Gems/LyShine/Code/Source/Animation/AnimSequence.h index efbe886ce2..e4026ce250 100644 --- a/Gems/LyShine/Code/Source/Animation/AnimSequence.h +++ b/Gems/LyShine/Code/Source/Animation/AnimSequence.h @@ -146,7 +146,7 @@ private: uint32 m_id; AZStd::string m_name; - mutable string m_fullNameHolder; + mutable AZStd::string m_fullNameHolder; Range m_timeRange; UiTrackEvents m_events; diff --git a/Gems/LyShine/Code/Source/Animation/AzEntityNode.cpp b/Gems/LyShine/Code/Source/Animation/AzEntityNode.cpp index ca435dadf9..32dfb97a58 100644 --- a/Gems/LyShine/Code/Source/Animation/AzEntityNode.cpp +++ b/Gems/LyShine/Code/Source/Animation/AzEntityNode.cpp @@ -278,8 +278,8 @@ const AZ::SerializeContext::ClassElement* CUiAnimAzEntityNode::ComputeOffsetFrom if (mismatch) { - string warnMsg = "Data mismatch reading animation data for type "; - warnMsg += classData->m_typeId.ToString(); + AZStd::string warnMsg = "Data mismatch reading animation data for type "; + warnMsg += classData->m_typeId.ToString(); warnMsg += ". The field \""; warnMsg += paramData.GetName(); if (!element) diff --git a/Gems/LyShine/Code/Source/Animation/AzEntityNode.h b/Gems/LyShine/Code/Source/Animation/AzEntityNode.h index 6ca26ef84a..56680f1094 100644 --- a/Gems/LyShine/Code/Source/Animation/AzEntityNode.h +++ b/Gems/LyShine/Code/Source/Animation/AzEntityNode.h @@ -170,14 +170,14 @@ private: struct SScriptPropertyParamInfo { - string variableName; - string displayName; + AZStd::string variableName; + AZStd::string displayName; bool isVectorTable; SParamInfo animNodeParamInfo; }; std::vector< SScriptPropertyParamInfo > m_entityScriptPropertiesParamInfos; - typedef AZStd::unordered_map< string, size_t, stl::hash_string_caseless, stl::equality_string_caseless > TScriptPropertyParamInfoMap; + typedef AZStd::unordered_map, stl::equality_string_caseless > TScriptPropertyParamInfoMap; TScriptPropertyParamInfoMap m_nameToScriptPropertyParamInfo; #ifdef CHECK_FOR_TOO_MANY_ONPROPERTY_SCRIPT_CALLS uint32 m_OnPropertyCalls; diff --git a/Gems/LyShine/Code/Source/Animation/CompoundSplineTrack.h b/Gems/LyShine/Code/Source/Animation/CompoundSplineTrack.h index b707d0bc77..3ae230d4e4 100644 --- a/Gems/LyShine/Code/Source/Animation/CompoundSplineTrack.h +++ b/Gems/LyShine/Code/Source/Animation/CompoundSplineTrack.h @@ -112,7 +112,7 @@ public: virtual int NextKeyByTime(int key) const; - void SetSubTrackName(const int i, const string& name) { assert (i < MAX_SUBTRACKS); m_subTrackNames[i] = name; } + void SetSubTrackName(const int i, const AZStd::string& name) { assert (i < MAX_SUBTRACKS); m_subTrackNames[i] = name; } #ifdef UI_ANIMATION_SYSTEM_SUPPORT_EDITING virtual ColorB GetCustomColor() const diff --git a/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp b/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp index 5c897620c7..1ea35006e2 100644 --- a/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp +++ b/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp @@ -27,19 +27,19 @@ // Serialization for anim nodes & param types #define REGISTER_NODE_TYPE(name) assert(g_animNodeEnumToStringMap.find(eUiAnimNodeType_ ## name) == g_animNodeEnumToStringMap.end()); \ g_animNodeEnumToStringMap[eUiAnimNodeType_ ## name] = STRINGIFY(name); \ - g_animNodeStringToEnumMap[string(STRINGIFY(name))] = eUiAnimNodeType_ ## name; + g_animNodeStringToEnumMap[AZStd::string(STRINGIFY(name))] = eUiAnimNodeType_ ## name; #define REGISTER_PARAM_TYPE(name) assert(g_animParamEnumToStringMap.find(eUiAnimParamType_ ## name) == g_animParamEnumToStringMap.end()); \ g_animParamEnumToStringMap[eUiAnimParamType_ ## name] = STRINGIFY(name); \ - g_animParamStringToEnumMap[string(STRINGIFY(name))] = eUiAnimParamType_ ## name; + g_animParamStringToEnumMap[AZStd::string(STRINGIFY(name))] = eUiAnimParamType_ ## name; namespace { - AZStd::unordered_map g_animNodeEnumToStringMap; - StaticInstance >> g_animNodeStringToEnumMap; + AZStd::unordered_map g_animNodeEnumToStringMap; + StaticInstance >> g_animNodeStringToEnumMap; - AZStd::unordered_map g_animParamEnumToStringMap; - StaticInstance >> g_animParamStringToEnumMap; + AZStd::unordered_map g_animParamEnumToStringMap; + StaticInstance >> g_animParamStringToEnumMap; // If you get an assert in this function, it means two node types have the same enum value. void RegisterNodeTypes() @@ -1189,7 +1189,7 @@ void UiAnimationSystem::SerializeNodeType(EUiAnimNodeType& animNodeType, XmlNode { const char* pTypeString = "Invalid"; assert(g_animNodeEnumToStringMap.find(animNodeType) != g_animNodeEnumToStringMap.end()); - pTypeString = g_animNodeEnumToStringMap[animNodeType]; + pTypeString = g_animNodeEnumToStringMap[animNodeType].c_str(); xmlNode->setAttr(kType, pTypeString); } } @@ -1273,7 +1273,7 @@ void UiAnimationSystem::SerializeParamType(CUiAnimParamType& animParamType, XmlN else { assert(g_animParamEnumToStringMap.find(animParamType.m_type) != g_animParamEnumToStringMap.end()); - pTypeString = g_animParamEnumToStringMap[animParamType.m_type]; + pTypeString = g_animParamEnumToStringMap[animParamType.m_type].c_str(); } xmlNode->setAttr(kParamType, pTypeString); @@ -1341,7 +1341,7 @@ const char* UiAnimationSystem::GetParamTypeName(const CUiAnimParamType& animPara { if (g_animParamEnumToStringMap.find(animParamType.m_type) != g_animParamEnumToStringMap.end()) { - return g_animParamEnumToStringMap[animParamType.m_type]; + return g_animParamEnumToStringMap[animParamType.m_type].c_str(); } } diff --git a/Gems/LyShine/Code/Source/LyShine.cpp b/Gems/LyShine/Code/Source/LyShine.cpp index f5edc4d7f1..4e265bd973 100644 --- a/Gems/LyShine/Code/Source/LyShine.cpp +++ b/Gems/LyShine/Code/Source/LyShine.cpp @@ -287,7 +287,7 @@ AZ::EntityId CLyShine::CreateCanvas() } //////////////////////////////////////////////////////////////////////////////////////////////////// -AZ::EntityId CLyShine::LoadCanvas(const string& assetIdPathname) +AZ::EntityId CLyShine::LoadCanvas(const AZStd::string& assetIdPathname) { return m_uiCanvasManager->LoadCanvas(assetIdPathname.c_str()); } @@ -299,7 +299,7 @@ AZ::EntityId CLyShine::CreateCanvasInEditor(UiEntityContext* entityContext) } //////////////////////////////////////////////////////////////////////////////////////////////////// -AZ::EntityId CLyShine::LoadCanvasInEditor(const string& assetIdPathname, const string& sourceAssetPathname, UiEntityContext* entityContext) +AZ::EntityId CLyShine::LoadCanvasInEditor(const AZStd::string& assetIdPathname, const AZStd::string& sourceAssetPathname, UiEntityContext* entityContext) { return m_uiCanvasManager->LoadCanvasInEditor(assetIdPathname, sourceAssetPathname, entityContext); } @@ -317,7 +317,7 @@ AZ::EntityId CLyShine::FindCanvasById(LyShine::CanvasId id) } //////////////////////////////////////////////////////////////////////////////////////////////////// -AZ::EntityId CLyShine::FindLoadedCanvasByPathName(const string& assetIdPathname) +AZ::EntityId CLyShine::FindLoadedCanvasByPathName(const AZStd::string& assetIdPathname) { return m_uiCanvasManager->FindLoadedCanvasByPathName(assetIdPathname.c_str()); } @@ -335,13 +335,13 @@ void CLyShine::ReleaseCanvasDeferred(AZ::EntityId canvas) } //////////////////////////////////////////////////////////////////////////////////////////////////// -ISprite* CLyShine::LoadSprite(const string& pathname) +ISprite* CLyShine::LoadSprite(const AZStd::string& pathname) { return CSprite::LoadSprite(pathname); } //////////////////////////////////////////////////////////////////////////////////////////////////// -ISprite* CLyShine::CreateSprite(const string& renderTargetName) +ISprite* CLyShine::CreateSprite(const AZStd::string& renderTargetName) { return CSprite::CreateSprite(renderTargetName); } diff --git a/Gems/LyShine/Code/Source/LyShine.h b/Gems/LyShine/Code/Source/LyShine.h index a7a8cab700..cb5b77a861 100644 --- a/Gems/LyShine/Code/Source/LyShine.h +++ b/Gems/LyShine/Code/Source/LyShine.h @@ -56,18 +56,18 @@ public: IDraw2d* GetDraw2d() override; AZ::EntityId CreateCanvas() override; - AZ::EntityId LoadCanvas(const string& assetIdPathname) override; + AZ::EntityId LoadCanvas(const AZStd::string& assetIdPathname) override; AZ::EntityId CreateCanvasInEditor(UiEntityContext* entityContext) override; - AZ::EntityId LoadCanvasInEditor(const string& assetIdPathname, const string& sourceAssetPathname, UiEntityContext* entityContext) override; + AZ::EntityId LoadCanvasInEditor(const AZStd::string& assetIdPathname, const AZStd::string& sourceAssetPathname, UiEntityContext* entityContext) override; AZ::EntityId ReloadCanvasFromXml(const AZStd::string& xmlString, UiEntityContext* entityContext) override; AZ::EntityId FindCanvasById(LyShine::CanvasId id) override; - AZ::EntityId FindLoadedCanvasByPathName(const string& assetIdPathname) override; + AZ::EntityId FindLoadedCanvasByPathName(const AZStd::string& assetIdPathname) override; void ReleaseCanvas(AZ::EntityId canvas, bool forEditor) override; void ReleaseCanvasDeferred(AZ::EntityId canvas) override; - ISprite* LoadSprite(const string& pathname) override; - ISprite* CreateSprite(const string& renderTargetName) override; + ISprite* LoadSprite(const AZStd::string& pathname) override; + ISprite* CreateSprite(const AZStd::string& renderTargetName) override; bool DoesSpriteTextureAssetExist(const AZStd::string& pathname) override; void PostInit() override; diff --git a/Gems/LyShine/Code/Source/LyShineDebug.cpp b/Gems/LyShine/Code/Source/LyShineDebug.cpp index c7ffea1aec..c7dccc162f 100644 --- a/Gems/LyShine/Code/Source/LyShineDebug.cpp +++ b/Gems/LyShine/Code/Source/LyShineDebug.cpp @@ -995,7 +995,7 @@ static AZ::Entity* CreateButton(const char* name, bool atRoot, AZ::EntityId pare EBUS_EVENT_ID(buttonId, UiInteractableStatesBus, SetStateColor, UiInteractableStatesInterface::StatePressed, buttonId, pressedColor); EBUS_EVENT_ID(buttonId, UiInteractableStatesBus, SetStateAlpha, UiInteractableStatesInterface::StatePressed, buttonId, pressedColor.GetA()); - string pathname = "Textures/Basic/Button_Sliced_Normal.sprite"; + AZStd::string pathname = "Textures/Basic/Button_Sliced_Normal.sprite"; ISprite* sprite = gEnv->pLyShine->LoadSprite(pathname); EBUS_EVENT_ID(buttonId, UiImageBus, SetSprite, sprite); @@ -1094,7 +1094,7 @@ static AZ::Entity* CreateTextInput(const char* name, bool atRoot, AZ::EntityId p EBUS_EVENT_ID(textInputId, UiInteractableStatesBus, SetStateColor, UiInteractableStatesInterface::StatePressed, textInputId, pressedColor); EBUS_EVENT_ID(textInputId, UiInteractableStatesBus, SetStateAlpha, UiInteractableStatesInterface::StatePressed, textInputId, pressedColor.GetA()); - string pathname = "Textures/Basic/Button_Sliced_Normal.sprite"; + AZStd::string pathname = "Textures/Basic/Button_Sliced_Normal.sprite"; ISprite* sprite = gEnv->pLyShine->LoadSprite(pathname); EBUS_EVENT_ID(textInputId, UiImageBus, SetSprite, sprite); diff --git a/Gems/LyShine/Code/Source/LyShineLoadScreen.cpp b/Gems/LyShine/Code/Source/LyShineLoadScreen.cpp index 9d4f0bcc3c..64a577efa2 100644 --- a/Gems/LyShine/Code/Source/LyShineLoadScreen.cpp +++ b/Gems/LyShine/Code/Source/LyShineLoadScreen.cpp @@ -215,7 +215,7 @@ namespace LyShine AZ::EntityId LyShineLoadScreenComponent::loadFromCfg(const char* pathVarName, const char* autoPlayVarName) { ICVar* pathVar = gEnv->pConsole->GetCVar(pathVarName); - string path = pathVar ? pathVar->GetString() : ""; + AZStd::string path = pathVar ? pathVar->GetString() : ""; if (path.empty()) { // No canvas specified. @@ -238,7 +238,7 @@ namespace LyShine EBUS_EVENT_ID(canvasId, UiCanvasBus, SetDrawOrder, std::numeric_limits::max()); ICVar* autoPlayVar = gEnv->pConsole->GetCVar(autoPlayVarName); - string sequence = autoPlayVar ? autoPlayVar->GetString() : ""; + AZStd::string sequence = autoPlayVar ? autoPlayVar->GetString() : ""; if (sequence.empty()) { // Nothing to auto-play. @@ -253,7 +253,7 @@ namespace LyShine return canvasId; } - animSystem->PlaySequence(sequence, nullptr, false, false); + animSystem->PlaySequence(sequence.c_str(), nullptr, false, false); return canvasId; } diff --git a/Gems/LyShine/Code/Source/Platform/Windows/UiClipboard_Windows.cpp b/Gems/LyShine/Code/Source/Platform/Windows/UiClipboard_Windows.cpp index 7bcdc26712..ae118aee00 100644 --- a/Gems/LyShine/Code/Source/Platform/Windows/UiClipboard_Windows.cpp +++ b/Gems/LyShine/Code/Source/Platform/Windows/UiClipboard_Windows.cpp @@ -9,6 +9,7 @@ #include "UiClipboard.h" #include +#include bool UiClipboard::SetText(const AZStd::string& text) { @@ -19,7 +20,8 @@ bool UiClipboard::SetText(const AZStd::string& text) { if (text.length() > 0) { - auto wstr = CryStringUtils::UTF8ToWStr(text.c_str()); + AZStd::wstring wstr; + AZStd::to_wstring(wstr, text.c_str()); const SIZE_T buffSize = (wstr.size() + 1) * sizeof(WCHAR); if (HGLOBAL hBuffer = GlobalAlloc(GMEM_MOVEABLE, buffSize)) { @@ -45,7 +47,7 @@ AZStd::string UiClipboard::GetText() if (HANDLE hText = GetClipboardData(CF_UNICODETEXT)) { const WCHAR* text = static_cast(GlobalLock(hText)); - outText = CryStringUtils::WStrToUTF8(text); + AZStd::to_string(outText, text); GlobalUnlock(hText); } CloseClipboard(); diff --git a/Gems/LyShine/Code/Source/Sprite.cpp b/Gems/LyShine/Code/Source/Sprite.cpp index 134768f814..0e0edb8e34 100644 --- a/Gems/LyShine/Code/Source/Sprite.cpp +++ b/Gems/LyShine/Code/Source/Sprite.cpp @@ -146,9 +146,9 @@ namespace { if (ser.IsReading()) { - string stringVal; + AZStd::string stringVal; ser.Value(attributeName, stringVal); - stringVal.replace(',', ' '); + AZ::StringFunc::Replace(stringVal, ',', ' '); char* pEnd = nullptr; float uVal = strtof(stringVal.c_str(), &pEnd); float vVal = strtof(pEnd, nullptr); @@ -202,13 +202,13 @@ CSprite::~CSprite() } //////////////////////////////////////////////////////////////////////////////////////////////////// -const string& CSprite::GetPathname() const +const AZStd::string& CSprite::GetPathname() const { return m_pathname; } //////////////////////////////////////////////////////////////////////////////////////////////////// -const string& CSprite::GetTexturePathname() const +const AZStd::string& CSprite::GetTexturePathname() const { return m_texturePathname; } @@ -283,7 +283,7 @@ void CSprite::Serialize(TSerialize ser) m_spriteSheetCells.push_back(SpriteSheetCell()); } - string aliasTemp; + AZStd::string aliasTemp; if (ser.IsReading()) { ser.Value("alias", aliasTemp); @@ -318,7 +318,7 @@ void CSprite::Serialize(TSerialize ser) } //////////////////////////////////////////////////////////////////////////////////////////////////// -bool CSprite::SaveToXml(const string& pathname) +bool CSprite::SaveToXml(const AZStd::string& pathname) { // NOTE: The input pathname has to be a path that can used to save - so not an Asset ID // because of this we do not store the pathname @@ -331,7 +331,7 @@ bool CSprite::SaveToXml(const string& pathname) ser.Value(spriteVersionNumberTag, spriteFileVersionNumber); Serialize(ser); - return root->saveToFile(pathname); + return root->saveToFile(pathname.c_str()); } //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -629,7 +629,7 @@ void CSprite::Shutdown() } //////////////////////////////////////////////////////////////////////////////////////////////////// -CSprite* CSprite::LoadSprite(const string& pathname) +CSprite* CSprite::LoadSprite(const AZStd::string& pathname) { AZStd::string spritePath; AZStd::string texturePath; @@ -691,7 +691,7 @@ CSprite* CSprite::LoadSprite(const string& pathname) } //////////////////////////////////////////////////////////////////////////////////////////////////// -CSprite* CSprite::CreateSprite(const string& renderTargetName) +CSprite* CSprite::CreateSprite(const AZStd::string& renderTargetName) { // test if the sprite is already loaded, if so return loaded sprite auto result = s_loadedSprites->find(renderTargetName); diff --git a/Gems/LyShine/Code/Source/Sprite.h b/Gems/LyShine/Code/Source/Sprite.h index e7e353a77b..8a645b78b1 100644 --- a/Gems/LyShine/Code/Source/Sprite.h +++ b/Gems/LyShine/Code/Source/Sprite.h @@ -32,13 +32,13 @@ public: // member functions ~CSprite() override; - const string& GetPathname() const override; - const string& GetTexturePathname() const override; + const AZStd::string& GetPathname() const override; + const AZStd::string& GetTexturePathname() const override; Borders GetBorders() const override; void SetBorders(Borders borders) override; void SetCellBorders(int cellIndex, Borders borders) override; void Serialize(TSerialize ser) override; - bool SaveToXml(const string& pathname) override; + bool SaveToXml(const AZStd::string& pathname) override; bool AreBordersZeroWidth() const override; bool AreCellBordersZeroWidth(int index) const override; AZ::Vector2 GetSize() override; @@ -72,8 +72,8 @@ public: // static member functions static void Initialize(); static void Shutdown(); - static CSprite* LoadSprite(const string& pathname); - static CSprite* CreateSprite(const string& renderTargetName); + static CSprite* LoadSprite(const AZStd::string& pathname); + static CSprite* CreateSprite(const AZStd::string& renderTargetName); static bool DoesSpriteTextureAssetExist(const AZStd::string& pathname); //! Replaces baseSprite with newSprite with proper ref-count handling and null-checks. @@ -96,7 +96,7 @@ protected: // member functions bool CellIndexWithinRange(int cellIndex) const; private: // types - typedef AZStd::unordered_map, stl::equality_string_caseless > CSpriteHashMap; + typedef AZStd::unordered_map, stl::equality_string_caseless > CSpriteHashMap; private: // member functions bool LoadFromXmlFile(); @@ -109,8 +109,8 @@ private: // data SpriteSheetCellContainer m_spriteSheetCells; //!< Stores information for each cell defined within the sprite-sheet. - string m_pathname; - string m_texturePathname; + AZStd::string m_pathname; + AZStd::string m_texturePathname; Borders m_borders; AZ::Data::Instance m_image; int m_numSpriteSheetCellTags; //!< Number of Cell child-tags in sprite XML; unfortunately needed to help with serialization. diff --git a/Gems/LyShine/Code/Source/StringUtfUtils.h b/Gems/LyShine/Code/Source/StringUtfUtils.h index 74a27afe9f..40dd22dd33 100644 --- a/Gems/LyShine/Code/Source/StringUtfUtils.h +++ b/Gems/LyShine/Code/Source/StringUtfUtils.h @@ -7,6 +7,8 @@ */ #pragma once +#include + namespace LyShine { //! \brief Returns the number of UTF8 characters in a string. @@ -16,15 +18,9 @@ namespace LyShine //! character in the string. inline int GetUtf8StringLength(const AZStd::string& utf8String) { - int utf8StrLen = 0; - Unicode::CIterator pChar(utf8String.c_str()); - while (uint32_t ch = *pChar) - { - ++pChar; - ++utf8StrLen; - } - - return utf8StrLen; + AZStd::wstring utf8StringW; + AZStd::to_wstring(utf8StringW, utf8String.c_str()); + return static_cast(utf8StringW.size()); } //! \brief Returns the number of bytes of the size of the given multi-byte char. @@ -34,17 +30,16 @@ namespace LyShine // 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. // In the long run it would be better to eliminate - // this function and use Unicode::CIterator<>::Position instead. - wchar_t wcharString[2] = { static_cast(multiByteChar), 0 }; - AZStd::string utf8String(CryStringUtils::WStrToUTF8(wcharString)); - int utf8Length = utf8String.length(); - return utf8Length; + // this function and use some sequence_lenght function that is not internal. + return Utf8::Internal::sequence_length(&multiByteChar); } inline int GetByteLengthOfUtf8Chars(const char* utf8String, int numUtf8Chars) { + AZStd::wstring utf8StringW; + AZStd::to_wstring(utf8StringW, utf8String); + AZStd::wstring::const_iterator pChar = utf8StringW.begin(); int byteStrlen = 0; - Unicode::CIterator pChar(utf8String); for (int i = 0; i < numUtf8Chars; i++) { uint32_t ch = *pChar; diff --git a/Gems/LyShine/Code/Source/Tests/internal/test_UiTextComponent.cpp b/Gems/LyShine/Code/Source/Tests/internal/test_UiTextComponent.cpp index 3cd137b25f..8cf2cd2edb 100644 --- a/Gems/LyShine/Code/Source/Tests/internal/test_UiTextComponent.cpp +++ b/Gems/LyShine/Code/Source/Tests/internal/test_UiTextComponent.cpp @@ -3508,7 +3508,7 @@ void UiTextComponent::UnitTestLocalization(CLyShine* lyshine, IConsoleCmdArgs* / { ILocalizationManager* pLocMan = GetISystem()->GetLocalizationManager(); - string localizationXml("libs/localization/localization.xml"); + AZStd::string localizationXml("libs/localization/localization.xml"); bool initLocSuccess = false; diff --git a/Gems/LyShine/Code/Source/TextMarkup.cpp b/Gems/LyShine/Code/Source/TextMarkup.cpp index 864d7a2cfc..8c1a6e0b62 100644 --- a/Gems/LyShine/Code/Source/TextMarkup.cpp +++ b/Gems/LyShine/Code/Source/TextMarkup.cpp @@ -162,7 +162,8 @@ namespace } else if (AZStd::string(key) == "color") { - AZStd::string colorValue(string(value).Trim()); + AZStd::string colorValue(value); + AZ::StringFunc::TrimWhiteSpace(colorValue, true, true); AZStd::string::size_type ExpectedNumChars = 7; if (ExpectedNumChars == colorValue.size() && '#' == colorValue.at(0)) { diff --git a/Gems/LyShine/Code/Source/UiCanvasComponent.cpp b/Gems/LyShine/Code/Source/UiCanvasComponent.cpp index 72d9f92d1f..b665f039b0 100644 --- a/Gems/LyShine/Code/Source/UiCanvasComponent.cpp +++ b/Gems/LyShine/Code/Source/UiCanvasComponent.cpp @@ -177,11 +177,11 @@ namespace //////////////////////////////////////////////////////////////////////////////////////////////// // test if the given text file starts with the given text string - bool TestFileStartString(const string& pathname, const char* expectedStart) + bool TestFileStartString(const AZStd::string& pathname, const char* expectedStart) { // Open the file using CCryFile, this supports it being in the pak file or a standalone file CCryFile file; - if (!file.Open(pathname, "r")) + if (!file.Open(pathname.c_str(), "r")) { return false; } @@ -208,7 +208,7 @@ namespace //////////////////////////////////////////////////////////////////////////////////////////////// // Check if the given file was saved using AZ serialization - bool IsValidAzSerializedFile(const string& pathname) + bool IsValidAzSerializedFile(const AZStd::string& pathname) { return TestFileStartString(pathname, " dstData; @@ -3884,7 +3884,7 @@ UiCanvasComponent* UiCanvasComponent::CreateCanvasInternal(UiEntityContext* enti } //////////////////////////////////////////////////////////////////////////////////////////////////// -UiCanvasComponent* UiCanvasComponent::LoadCanvasInternal(const string& pathnameToOpen, bool forEditor, const string& assetIdPathname, UiEntityContext* entityContext, +UiCanvasComponent* UiCanvasComponent::LoadCanvasInternal(const AZStd::string& pathnameToOpen, bool forEditor, const AZStd::string& assetIdPathname, UiEntityContext* entityContext, const AZ::SliceComponent::EntityIdToEntityIdMap* previousRemapTable, AZ::EntityId previousCanvasId) { UiCanvasComponent* canvasComponent = nullptr; diff --git a/Gems/LyShine/Code/Source/UiCanvasComponent.h b/Gems/LyShine/Code/Source/UiCanvasComponent.h index 852bb482d0..097f23cbda 100644 --- a/Gems/LyShine/Code/Source/UiCanvasComponent.h +++ b/Gems/LyShine/Code/Source/UiCanvasComponent.h @@ -99,7 +99,7 @@ public: // member functions LyShine::EntityArray PickElements(const AZ::Vector2& bound0, const AZ::Vector2& bound1) override; AZ::EntityId FindInteractableToHandleEvent(AZ::Vector2 point) override; - bool SaveToXml(const string& assetIdPathname, const string& sourceAssetPathname) override; + bool SaveToXml(const AZStd::string& assetIdPathname, const AZStd::string& sourceAssetPathname) override; void FixupCreatedEntities(LyShine::EntityArray topLevelEntities, bool makeUniqueNamesAndIds, AZ::Entity* optionalInsertionPoint) override; void AddElement(AZ::Entity* element, AZ::Entity* parent, AZ::Entity* insertBefore) override; void ReinitializeElements() override; @@ -307,7 +307,7 @@ public: // static member functions static void Shutdown(); static UiCanvasComponent* CreateCanvasInternal(UiEntityContext* entityContext, bool forEditor); - static UiCanvasComponent* LoadCanvasInternal(const string& pathToOpen, bool forEditor, const string& assetIdPathname, UiEntityContext* entityContext, + static UiCanvasComponent* LoadCanvasInternal(const AZStd::string& pathToOpen, bool forEditor, const AZStd::string& assetIdPathname, UiEntityContext* entityContext, const AZ::SliceComponent::EntityIdToEntityIdMap* previousRemapTable = nullptr, AZ::EntityId previousCanvasId = AZ::EntityId()); static UiCanvasComponent* FixupReloadedCanvasForEditorInternal(AZ::Entity* newCanvasEntity, AZ::Entity* rootSliceEntity, UiEntityContext* entityContext, @@ -403,7 +403,7 @@ private: // member functions void DestroyRenderTarget(); void RenderCanvasToTexture(); - bool SaveCanvasToFile(const string& pathname, AZ::DataStream::StreamType streamType); + bool SaveCanvasToFile(const AZStd::string& pathname, AZ::DataStream::StreamType streamType); bool SaveCanvasToStream(AZ::IO::GenericStream& stream, AZ::DataStream::StreamType streamType); //! Notify elements that their canvas space rect has changed since the last update, and recompute invalid layouts diff --git a/Gems/LyShine/Code/Source/UiCanvasManager.cpp b/Gems/LyShine/Code/Source/UiCanvasManager.cpp index cb27f09672..bed3bcf433 100644 --- a/Gems/LyShine/Code/Source/UiCanvasManager.cpp +++ b/Gems/LyShine/Code/Source/UiCanvasManager.cpp @@ -342,7 +342,7 @@ void UiCanvasManager::OnCatalogAssetChanged(const AZ::Data::AssetId& assetId) // reload canvas with the same entity IDs (except for new entities, deleted entities etc) UiGameEntityContext* entityContext = new UiGameEntityContext(); - string pathname(assetPath.c_str()); + AZStd::string pathname(assetPath.c_str()); UiCanvasComponent* newCanvasComponent = UiCanvasComponent::LoadCanvasInternal(pathname, false, "", entityContext, &existingRemapTable, existingCanvasEntityId); if (!newCanvasComponent) @@ -393,7 +393,7 @@ AZ::EntityId UiCanvasManager::CreateCanvasInEditor(UiEntityContext* entityContex } //////////////////////////////////////////////////////////////////////////////////////////////////// -AZ::EntityId UiCanvasManager::LoadCanvasInEditor(const string& assetIdPathname, const string& sourceAssetPathname, UiEntityContext* entityContext) +AZ::EntityId UiCanvasManager::LoadCanvasInEditor(const AZStd::string& assetIdPathname, const AZStd::string& sourceAssetPathname, UiEntityContext* entityContext) { return LoadCanvasInternal(assetIdPathname.c_str(), true, sourceAssetPathname.c_str(), entityContext); } @@ -1064,10 +1064,10 @@ void UiCanvasManager::DebugDisplayCanvasData(int setting) const for (auto canvas : m_loadedCanvases) { // Name - const string pathname = canvas->GetPathname().c_str(); + const AZStd::string pathname = canvas->GetPathname().c_str(); size_t lastDot = pathname.find_last_of("."); size_t lastSlash = pathname.find_last_of("/"); - string leafName = pathname; + AZStd::string leafName = pathname; if (lastDot > lastSlash) { leafName = pathname.substr(lastSlash+1, lastDot-lastSlash-1); @@ -1209,10 +1209,10 @@ void UiCanvasManager::DebugDisplayDrawCallData() const for (auto canvas : m_loadedCanvases) { // Name - const string pathname = canvas->GetPathname().c_str(); + const AZStd::string pathname = canvas->GetPathname().c_str(); size_t lastDot = pathname.find_last_of("."); size_t lastSlash = pathname.find_last_of("/"); - string leafName = pathname; + AZStd::string leafName = pathname; if (lastDot > lastSlash) { leafName = pathname.substr(lastSlash+1, lastDot-lastSlash-1); @@ -1373,7 +1373,7 @@ void UiCanvasManager::DebugReportDrawCalls(const AZStd::string& name) const } // Name of canvas - const string pathname = canvas->GetPathname().c_str(); + const AZStd::string pathname = canvas->GetPathname().c_str(); logLine = "\r\n=====================================================================================\r\n"; AZ::IO::LocalFileIO::GetInstance()->Write(logHandle, logLine.c_str(), logLine.size()); logLine = AZStd::string::format("Canvas: %s\r\n", pathname.c_str()); @@ -1461,7 +1461,7 @@ void UiCanvasManager::DebugReportDrawCalls(const AZStd::string& name) const { if (!loggedCanvasHeader) { - const string pathname = canvas->GetPathname().c_str(); + const AZStd::string pathname = canvas->GetPathname().c_str(); logLine = AZStd::string::format("\r\nCanvas: %s\r\n\r\n", pathname.c_str()); AZ::IO::LocalFileIO::GetInstance()->Write(logHandle, logLine.c_str(), logLine.size()); loggedCanvasHeader = true; diff --git a/Gems/LyShine/Code/Source/UiCanvasManager.h b/Gems/LyShine/Code/Source/UiCanvasManager.h index 85783fab84..ebcee200e4 100644 --- a/Gems/LyShine/Code/Source/UiCanvasManager.h +++ b/Gems/LyShine/Code/Source/UiCanvasManager.h @@ -68,7 +68,7 @@ public: // member functions // ~AssetCatalogEventBus::Handler AZ::EntityId CreateCanvasInEditor(UiEntityContext* entityContext); - AZ::EntityId LoadCanvasInEditor(const string& assetIdPathname, const string& sourceAssetPathname, UiEntityContext* entityContext); + AZ::EntityId LoadCanvasInEditor(const AZStd::string& assetIdPathname, const AZStd::string& sourceAssetPathname, UiEntityContext* entityContext); AZ::EntityId ReloadCanvasFromXml(const AZStd::string& xmlString, UiEntityContext* entityContext); void ReleaseCanvas(AZ::EntityId canvas, bool forEditor); diff --git a/Gems/LyShine/Code/Source/UiDropdownComponent.cpp b/Gems/LyShine/Code/Source/UiDropdownComponent.cpp index 1940d57cbb..448c208c5e 100644 --- a/Gems/LyShine/Code/Source/UiDropdownComponent.cpp +++ b/Gems/LyShine/Code/Source/UiDropdownComponent.cpp @@ -826,7 +826,8 @@ AZ::Outcome UiDropdownComponent::ValidatePotentialExpandedP } //////////////////////////////////////////////////////////////////////////////////////////////////// -AZ::FailureValue FailureMessage(string message) { +AZ::FailureValue FailureMessage(AZStd::string message) +{ return AZ::Failure(AZStd::string(message)); } diff --git a/Gems/LyShine/Code/Source/UiInteractableState.cpp b/Gems/LyShine/Code/Source/UiInteractableState.cpp index d3440a9354..98abae4484 100644 --- a/Gems/LyShine/Code/Source/UiInteractableState.cpp +++ b/Gems/LyShine/Code/Source/UiInteractableState.cpp @@ -575,7 +575,7 @@ void UiInteractableStateFont::SetFontPathname(const AZStd::string& pathname) fontFamily = gEnv->pCryFont->LoadFontFamily(fileName.c_str()); if (!fontFamily) { - string errorMsg = "Error loading a font from "; + AZStd::string errorMsg = "Error loading a font from "; errorMsg += fileName.c_str(); errorMsg += "."; CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_ERROR, errorMsg.c_str()); diff --git a/Gems/LyShine/Code/Source/UiTextComponent.cpp b/Gems/LyShine/Code/Source/UiTextComponent.cpp index fadf09571f..be26a5a618 100644 --- a/Gems/LyShine/Code/Source/UiTextComponent.cpp +++ b/Gems/LyShine/Code/Source/UiTextComponent.cpp @@ -623,12 +623,14 @@ namespace int batchCurChar = 0; - Unicode::CIterator pChar(drawBatch.text.c_str()); + Utf8::Unchecked::octet_iterator pChar(drawBatch.text.data()); uint32_t prevCh = 0; while (uint32_t ch = *pChar) { - char codepoint[5]; - Unicode::Convert(codepoint, ch); + size_t maxSize = 5; + char codepoint[5] = { 0 }; + char* codepointPtr = codepoint; + Utf8::Unchecked::octet_iterator::to_utf8_sequence(ch, codepointPtr, maxSize); float curCharWidth = drawBatch.font->GetTextSize(codepoint, true, ctx).x; @@ -652,15 +654,15 @@ namespace lastSpaceIndexInBatch = batchCurChar; lastSpaceBatch = &drawBatch; lastSpaceWidth = curLineWidth + curCharWidth; - pLastSpace = pChar.GetPosition(); + pLastSpace = pChar.base(); assert(*pLastSpace == ' '); } bool prevCharWasNewline = false; - const bool isFirstChar = pChar.GetPosition() == drawBatch.text.c_str(); + const bool isFirstChar = pChar.base() == drawBatch.text.c_str(); if (ch && !isFirstChar) { - const char* pPrevCharStr = pChar.GetPosition() - 1; + const char* pPrevCharStr = pChar.base() - 1; prevCharWasNewline = pPrevCharStr[0] == '\n'; } else if (isFirstChar) @@ -705,12 +707,12 @@ namespace } else { - const char* pBuf = pChar.GetPosition(); + char* pBuf = pChar.base(); AZStd::string::size_type bytesProcessed = pBuf - drawBatch.text.c_str(); drawBatch.text.insert(bytesProcessed, "\n"); // Insert the newline, this invalidates the iterator - pBuf = drawBatch.text.c_str() + bytesProcessed; // In case reallocation occurs, we ensure we are inside the new buffer + pBuf = drawBatch.text.data() + bytesProcessed; // In case reallocation occurs, we ensure we are inside the new buffer assert(*pBuf == '\n'); - pChar.SetPosition(pBuf); // pChar once again points inside the target string, at the current character + pChar = Utf8::Unchecked::octet_iterator(pBuf); // pChar once again points inside the target string, at the current character assert(*pChar == ch); ++pChar; ++curChar; @@ -1189,7 +1191,7 @@ void UiTextComponent::DrawBatch::CalculateSize(const STextDrawContext& ctx, bool if (displayString.length() > 0) { AZStd::string::size_type endpos = displayString.find_last_not_of(" \t\n\v\f\r"); - if ((endpos != string::npos) && (endpos != displayString.length() - 1)) + if ((endpos != AZStd::string::npos) && (endpos != displayString.length() - 1)) { displayString.erase(endpos + 1); } @@ -1295,12 +1297,14 @@ bool UiTextComponent::DrawBatch::GetOverflowInfo(const STextDrawContext& ctx, float maxEffectOffsetX = font->GetMaxEffectOffset(ctx.m_fxIdx).x; - Unicode::CIterator pChar(text.c_str()); + Utf8::Unchecked::octet_iterator pChar(text.data()); uint32_t prevCh = 0; while (uint32_t ch = *pChar) { - char codepoint[5]; - Unicode::Convert(codepoint, ch); + size_t maxSize = 5; + char codepoint[5] = { 0 }; + char* codepointPtr = codepoint; + Utf8::Unchecked::octet_iterator::to_utf8_sequence(ch, codepointPtr, maxSize); float curCharWidth = font->GetTextSize(codepoint, true, ctx).x; if (prevCh) @@ -2274,7 +2278,7 @@ int UiTextComponent::GetCharIndexFromCanvasSpacePoint(AZ::Vector2 point, bool mu // Iterate across the line for (const DrawBatch& drawBatch : batchLine.drawBatchList) { - Unicode::CIterator pChar(drawBatch.text.c_str()); + Utf8::Unchecked::octet_iterator pChar(drawBatch.text.data()); while (uint32_t ch = *pChar) { ++pChar; @@ -4827,14 +4831,16 @@ int UiTextComponent::GetStartEllipseIndexInDrawBatch(const DrawBatch* drawBatchT { float overflowStringSize = 0.0f; int ellipsisCharPos = 0; - Unicode::CIterator pChar(drawBatchToEllipse->text.c_str()); + Utf8::Unchecked::octet_iterator pChar(drawBatchToEllipse->text.data()); uint32_t stringBufferIndex = 0; uint32_t prevCh = 0; while (uint32_t ch = *pChar) { ++pChar; - char codepoint[5]; - Unicode::Convert(codepoint, ch); + size_t maxSize = 5; + char codepoint[5] = { 0 }; + char* codepointPtr = codepoint; + Utf8::Unchecked::octet_iterator::to_utf8_sequence(ch, codepointPtr, maxSize); overflowStringSize += drawBatchToEllipse->font->GetTextSize(codepoint, true, ctx).x; @@ -4925,7 +4931,7 @@ AZ::Vector2 UiTextComponent::GetTextSizeFromDrawBatchLines(const UiTextComponent //////////////////////////////////////////////////////////////////////////////////////////////////// AZStd::string UiTextComponent::GetLocalizedText([[maybe_unused]] const AZStd::string& text) { - string locText; + AZStd::string locText; LocalizationManagerRequestBus::Broadcast(&LocalizationManagerRequestBus::Events::LocalizeString_ch, m_text.c_str(), locText, false); return locText.c_str(); } @@ -5110,7 +5116,7 @@ int UiTextComponent::GetLineNumberFromCharIndex(const DrawBatchLines& drawBatchL for (const DrawBatch& drawBatch : batchLine.drawBatchList) { - Unicode::CIterator pChar(drawBatch.text.c_str()); + Utf8::Unchecked::octet_iterator pChar(drawBatch.text.data()); while (uint32_t ch = *pChar) { ++pChar; diff --git a/Gems/LyShine/Code/Source/UiTextComponentOffsetsSelector.cpp b/Gems/LyShine/Code/Source/UiTextComponentOffsetsSelector.cpp index b4e8a8d63e..b472f79bd6 100644 --- a/Gems/LyShine/Code/Source/UiTextComponentOffsetsSelector.cpp +++ b/Gems/LyShine/Code/Source/UiTextComponentOffsetsSelector.cpp @@ -30,7 +30,7 @@ void UiTextComponentOffsetsSelector::ParseBatchLine(const UiTextComponent::DrawB { // Iterate character by character over DrawBatch string contents, // looking for m_firstIndex and m_lastIndex. - Unicode::CIterator pChar(drawBatch.text.c_str()); + Utf8::Unchecked::octet_iterator pChar(drawBatch.text.data()); while (uint32_t ch = *pChar) { ++pChar; diff --git a/Gems/LyShine/Code/Source/UiTextInputComponent.cpp b/Gems/LyShine/Code/Source/UiTextInputComponent.cpp index c149c5a4d4..8cc0efcaaf 100644 --- a/Gems/LyShine/Code/Source/UiTextInputComponent.cpp +++ b/Gems/LyShine/Code/Source/UiTextInputComponent.cpp @@ -70,7 +70,7 @@ namespace if (stringLength > 0 && stringLength >= utf8Index) { // Iterate over the string until the given index is found. - Unicode::CIterator pChar(utf8String.c_str()); + Utf8::Unchecked::octet_iterator pChar(utf8String.data()); while (uint32_t ch = *pChar) { if (utf8Index == utfIndexIter) @@ -1185,7 +1185,8 @@ 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(this->GetReplacementCharacter()), 0 }; - AZStd::string replacementCharString(CryStringUtils::WStrToUTF8(wcharString)); + AZStd::string replacementCharString; + AZStd::to_string(replacementCharString, wcharString, 1); int numReplacementChars = LyShine::GetUtf8StringLength(originalText);