Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Initial import of code already done for Xestia Address Book
[xestiaab/.git] / source / common / textprocessing.cpp
1 #include <wx/wx.h>
2 #include <iostream>
3 #include <iomanip>
4 #include <string.h>
5 #include <map>
6 #include "textprocessing.h"
8 void EscapeString(wxString *ReceivedString, bool StripQuotes)
9 {
11         ReceivedString->Replace(wxT("\\"), wxT("\\\\"), TRUE);
12         ReceivedString->Replace(wxT(","), wxT("\\,"), TRUE);
13         ReceivedString->Replace(wxT(";"), wxT("\\;"), TRUE);
14         ReceivedString->Replace(wxT("\r\n"), wxT("\\n"), TRUE);
15         ReceivedString->Replace(wxT("\n"), wxT("\\n"), TRUE);
16         
17         if (StripQuotes == TRUE){
18         
19                 ReceivedString->Replace(wxT("\""), wxT(""), TRUE);
20                 
21         }
23 }
25 void GetEscapeString(wxTextCtrl *TextCtrl, wxString *ProcessString, bool StripQuotes)
26 {
28         *ProcessString = TextCtrl->GetValue();
29         EscapeString(ProcessString, StripQuotes);
31 }
33 void GetEscapeString(wxComboBox *ComboCtrl, wxString *ProcessString, bool StripQuotes)
34 {
36         *ProcessString = ComboCtrl->GetValue();
37         EscapeString(ProcessString, StripQuotes);
39 }
41 void GetEscapeString(wxChoice *ChoiceCtrl, wxString *ProcessString, bool StripQuotes)
42 {
44         *ProcessString = ChoiceCtrl->GetString(ChoiceCtrl->GetSelection());
45         EscapeString(ProcessString, StripQuotes);
47 }
49 void CaptureString(wxString *ProcessString, bool StripQuotes)
50 {
52         ProcessString->Replace(wxT("\\n"), wxT("\n"), TRUE);
53         ProcessString->Replace(wxT("\\;"), wxT(";"), TRUE);
54         ProcessString->Replace(wxT("\\,"), wxT(","), TRUE);
55         ProcessString->Replace(wxT("\\\\"), wxT("\\"), TRUE);
56         
57         if (StripQuotes == TRUE){
58         
59                 ProcessString->Replace(wxT("\""), wxT(""), TRUE);
60         
61         }
63 }
65 void ConvertToHTML(wxString *ProcessString)
66 {
68         ProcessString->Replace(wxT("&"), wxT("&amp;"), TRUE);
69         ProcessString->Replace(wxT("<"), wxT("&lt;"), TRUE);
70         ProcessString->Replace(wxT(">"), wxT("&gt;"), TRUE);
71         ProcessString->Replace(wxT("\n"), wxT("<br>"), TRUE);
73 }
75 void DeleteMapDataProcess(int IndexNum, std::map<int, std::string>* MapData){
76         MapData->erase(IndexNum);
77 }
79 void DeleteMapDataProcess(int IndexNum, std::map<int, wxString>* MapData){
80         MapData->erase(IndexNum);
81 }
83 void DeleteMapDataProcess(int IndexNum, std::map<int, int>* MapData){
84         MapData->erase(IndexNum);
85 }
87 void DeleteMapDataProcess(int IndexNum, std::map<int, bool>* MapData){
88         MapData->erase(IndexNum);
89 }
91 /*
92 template <typename ArgMap, typename... Args>
93 void DeleteMapData(ArgMap* ArgMapPtr, Args*... ArgsList){
95         //DeleteMapDataProcess(ArgMapPtr);
97         DeleteMapData(ArgsList...);
99 }
100 */
101 /*
102 void test(int* x) {
105 */
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy