X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fcommon%2Ftextprocessing.cpp;h=e2f0428c18ede3aeb90ef4163b3f3f94662febf4;hb=26c542881613813bd6a671a56e78f129944f68e6;hp=d4aee6b05666c539e1cab2e7193b6d68404553af;hpb=87b1ab30b0f67dfa0457f9e946757d83cfb25106;p=xestiaab%2F.git diff --git a/source/common/textprocessing.cpp b/source/common/textprocessing.cpp index d4aee6b..e2f0428 100644 --- a/source/common/textprocessing.cpp +++ b/source/common/textprocessing.cpp @@ -26,6 +26,8 @@ void EscapeString(wxString *ReceivedString, bool StripQuotes) { + // Escape a string that contains escapable characters. + ReceivedString->Replace(wxT("\\"), wxT("\\\\"), TRUE); ReceivedString->Replace(wxT(","), wxT("\\,"), TRUE); ReceivedString->Replace(wxT(";"), wxT("\\;"), TRUE); @@ -43,6 +45,8 @@ void EscapeString(wxString *ReceivedString, bool StripQuotes) void GetEscapeString(wxTextCtrl *TextCtrl, wxString *ProcessString, bool StripQuotes) { + // Get an escaped string from a wxTextCtrl. + *ProcessString = TextCtrl->GetValue(); EscapeString(ProcessString, StripQuotes); @@ -51,6 +55,8 @@ void GetEscapeString(wxTextCtrl *TextCtrl, wxString *ProcessString, bool StripQu void GetEscapeString(wxComboBox *ComboCtrl, wxString *ProcessString, bool StripQuotes) { + // Get an escaped string from a wxComboBox. + *ProcessString = ComboCtrl->GetValue(); EscapeString(ProcessString, StripQuotes); @@ -59,6 +65,8 @@ void GetEscapeString(wxComboBox *ComboCtrl, wxString *ProcessString, bool StripQ void GetEscapeString(wxChoice *ChoiceCtrl, wxString *ProcessString, bool StripQuotes) { + // Get an escaped string from a wxChoice. + *ProcessString = ChoiceCtrl->GetString(ChoiceCtrl->GetSelection()); EscapeString(ProcessString, StripQuotes); @@ -67,6 +75,8 @@ void GetEscapeString(wxChoice *ChoiceCtrl, wxString *ProcessString, bool StripQu void CaptureString(wxString *ProcessString, bool StripQuotes) { + // Capture a string for processing. + ProcessString->Replace(wxT("\\n"), wxT("\n"), TRUE); ProcessString->Replace(wxT("\\;"), wxT(";"), TRUE); ProcessString->Replace(wxT("\\,"), wxT(","), TRUE); @@ -80,9 +90,24 @@ void CaptureString(wxString *ProcessString, bool StripQuotes) } +void ResetUnusedString(wxString *ProcessString) +{ + + // Reset an unused string. + + ProcessString->Replace(wxT("\\\\"), wxT("\\"), TRUE); + ProcessString->Replace(wxT("\n"), wxT(""), TRUE); + ProcessString->Replace(wxT("\\;"), wxT(";"), TRUE); + ProcessString->Replace(wxT("\\,"), wxT(","), TRUE); + +} + void ConvertToHTML(wxString *ProcessString) { + // Convert string into text that can be used with a + // wxHTMLWindow. + ProcessString->Replace(wxT("&"), wxT("&"), TRUE); ProcessString->Replace(wxT("<"), wxT("<"), TRUE); ProcessString->Replace(wxT(">"), wxT(">"), TRUE); @@ -91,33 +116,65 @@ void ConvertToHTML(wxString *ProcessString) } void DeleteMapDataProcess(int IndexNum, std::map* MapData){ + + // Delete map data (for map). + MapData->erase(IndexNum); + } void DeleteMapDataProcess(int IndexNum, std::map* MapData){ + + // Delete map data (for map). + MapData->erase(IndexNum); + } void DeleteMapDataProcess(int IndexNum, std::map* MapData){ + + // Delete map data (for map). + MapData->erase(IndexNum); + } void DeleteMapDataProcess(int IndexNum, std::map* MapData){ + + // Delete map data (for map). + MapData->erase(IndexNum); + } -/* -template -void DeleteMapData(ArgMap* ArgMapPtr, Args*... ArgsList){ - - //DeleteMapDataProcess(ArgMapPtr); +bool MapDataExists(int *ItemIndex, std::map *MapPtr){ - DeleteMapData(ArgsList...); + // Check if map data exists (for map). + + if (MapPtr->find(*ItemIndex) == MapPtr->end()){ + + return FALSE; + + } else { + + return TRUE; + + } } -*/ -/* -void test(int* x) { -} -*/ \ No newline at end of file +bool MapDataExists(int *ItemIndex, std::map *MapPtr){ + + // Check if map data exists (for map). + + if (MapPtr->find(*ItemIndex) == MapPtr->end()){ + + return FALSE; + + } else { + + return TRUE; + + } + +} \ No newline at end of file