1 // textprocessing.h - Text processing subroutines header.
3 // (c) 2012-2015 Xestia Software Development.
5 // This file is part of Xestia Address Book.
7 // Xestia Address Book is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
11 // Xestia Address Book is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
23 #ifndef TEXTPROCESSING_H
24 #define TEXTPROCESSING_H
26 void EscapeString(wxString *ReceivedString, bool StripQuotes);
27 void GetEscapeString(wxTextCtrl *TextCtrl, wxString *ProcessString, bool StripQuotes);
28 void GetEscapeString(wxComboBox *ComboCtrl, wxString *ProcessString, bool StripQuotes);
29 void GetEscapeString(wxChoice *ChoiceCtrl, wxString *ProcessString, bool StripQuotes);
30 void CaptureString(wxString *ProcessString, bool StripQuotes);
31 void ResetUnusedString(wxString *ProcessString);
32 void ConvertToHTML(wxString *ProcessString);
34 void DeleteMapDataProcess(int IndexNum, std::map<int, std::string>* MapData);
35 void DeleteMapDataProcess(int IndexNum, std::map<int, wxString>* MapData);
36 void DeleteMapDataProcess(int IndexNum, std::map<int, bool>* MapData);
37 void DeleteMapDataProcess(int IndexNum, std::map<int, int>* MapData);
39 bool MapDataExists(int *ItemIndex, std::map<int,wxString> *MapPtr);
40 bool MapDataExists(int *ItemIndex, std::map<int,int> *MapPtr);
42 wxString OutputText(wxString *TextInput);
44 //void DeleteMapDataB() {};
46 //void DeleteMapData() {};
50 template <typename ArgMap, typename... Args>
51 void DeleteMapData(ArgMap* ArgMapPtr, Args*... ArgsList){
60 void test(const char* s, T t) {
62 if (*s == '%' && *(++s) != '%') {
64 //throw std::runtime_error("Not enough parameters!");
73 //throw std::logic_error("Too many arguments!");
78 template<class T, class U, class... Args>
79 void test(const char* s, T t, U u, Args... args) {
81 if (*s == '%' && *(++s) != '%') {
84 // width = t; // Uncommenting this would cause a failure if the parameters aren't all int's.
86 std::cout << std::setw(width) << u;
90 test(++s, u, args...);
96 //throw std::logic_error("Too many arguments!");
102 template<typename... Args>
103 void DeleteMapData(int IndexNum, Args*... args) {
105 //DeleteMapDataProcess(IndexNum, t);
107 intSeekSelectedData = IndexNum;
108 DeleteMapDataB(args...);
110 //throw std::logic_error("Too many arguments!");
115 //void DeleteMapDataB() { };
117 template<typename MapData, typename... Args>
118 void DeleteMapDataB(MapData* mapdata, Args*... args) {
120 DeleteMapDataB(args...);
124 template<typename... Args>
125 void DeleteMapData(int IndexNum, Args*... args) {
127 //int intSeekSelectedData = 0;
129 //DeleteMapDataProcess(IndexNum, Moo);
131 //intSeekSelectedData = IndexNum;
132 DeleteMapDataB(args...);
136 //void DeleteMapData<ArgMap, Args>(ArgMap* ArgMapPtr, Args*... ArgsList);