// textprocessing.cpp - Text processing subroutines. // // (c) 2012-2015 Xestia Software Development. // // This file is part of Xestia Address Book. // // Xestia Address Book is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by the // Free Software Foundation, version 3 of the license. // // Xestia Address Book is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License along // with Xestia Address Book. If not, see #include #include #include #include #include #include "textprocessing.h" void EscapeString(wxString *ReceivedString, bool StripQuotes) { ReceivedString->Replace(wxT("\\"), wxT("\\\\"), TRUE); ReceivedString->Replace(wxT(","), wxT("\\,"), TRUE); ReceivedString->Replace(wxT(";"), wxT("\\;"), TRUE); ReceivedString->Replace(wxT("\r\n"), wxT("\\n"), TRUE); ReceivedString->Replace(wxT("\n"), wxT("\\n"), TRUE); if (StripQuotes == TRUE){ ReceivedString->Replace(wxT("\""), wxT(""), TRUE); } } void GetEscapeString(wxTextCtrl *TextCtrl, wxString *ProcessString, bool StripQuotes) { *ProcessString = TextCtrl->GetValue(); EscapeString(ProcessString, StripQuotes); } void GetEscapeString(wxComboBox *ComboCtrl, wxString *ProcessString, bool StripQuotes) { *ProcessString = ComboCtrl->GetValue(); EscapeString(ProcessString, StripQuotes); } void GetEscapeString(wxChoice *ChoiceCtrl, wxString *ProcessString, bool StripQuotes) { *ProcessString = ChoiceCtrl->GetString(ChoiceCtrl->GetSelection()); EscapeString(ProcessString, StripQuotes); } void CaptureString(wxString *ProcessString, bool StripQuotes) { ProcessString->Replace(wxT("\\n"), wxT("\n"), TRUE); ProcessString->Replace(wxT("\\;"), wxT(";"), TRUE); ProcessString->Replace(wxT("\\,"), wxT(","), TRUE); ProcessString->Replace(wxT("\\\\"), wxT("\\"), TRUE); if (StripQuotes == TRUE){ ProcessString->Replace(wxT("\""), wxT(""), TRUE); } } void ConvertToHTML(wxString *ProcessString) { ProcessString->Replace(wxT("&"), wxT("&"), TRUE); ProcessString->Replace(wxT("<"), wxT("<"), TRUE); ProcessString->Replace(wxT(">"), wxT(">"), TRUE); ProcessString->Replace(wxT("\n"), wxT("
"), TRUE); } void DeleteMapDataProcess(int IndexNum, std::map* MapData){ MapData->erase(IndexNum); } void DeleteMapDataProcess(int IndexNum, std::map* MapData){ MapData->erase(IndexNum); } void DeleteMapDataProcess(int IndexNum, std::map* MapData){ MapData->erase(IndexNum); } void DeleteMapDataProcess(int IndexNum, std::map* MapData){ MapData->erase(IndexNum); } /* template void DeleteMapData(ArgMap* ArgMapPtr, Args*... ArgsList){ //DeleteMapDataProcess(ArgMapPtr); DeleteMapData(ArgsList...); } */ /* void test(int* x) { } */