GnuCash  5.6-150-g038405b370+
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
gnc-tokenizer-dummy.cpp
1 /********************************************************************\
2  * gnc-tokenizer-dummy.cpp - takes a file and converts it into a *
3  * two-dimensional vector of strings (table) *
4  * each row will only have one single column *
5  * *
6  * Copyright (C) 2016 Geert Janssens <geert@kobaltwit.be> *
7  * *
8  * This program is free software; you can redistribute it and/or *
9  * modify it under the terms of the GNU General Public License as *
10  * published by the Free Software Foundation; either version 2 of *
11  * the License, or (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License*
19  * along with this program; if not, contact: *
20  * *
21  * Free Software Foundation Voice: +1-617-542-5942 *
22  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
23  * Boston, MA 02110-1301, USA gnu@gnu.org *
24 \********************************************************************/
25 
26 #include "gnc-tokenizer-dummy.hpp"
27 
28 #include <iostream>
29 #include <fstream> // fstream
30 #include <vector>
31 #include <string>
32 #include <algorithm> // copy
33 #include <iterator> // ostream_operator
34 
35 #include <boost/locale.hpp>
36 
37 
38 int GncDummyTokenizer::tokenize()
39 {
40  StrVec vec;
41  std::string line;
42 
43  m_tokenized_contents.clear();
44  std::istringstream in_stream(m_utf8_contents);
45 
46  while (std::getline (in_stream, line))
47  {
48  vec.push_back (line);
49  m_tokenized_contents.push_back(vec);
50 
51  line.clear();
52  vec.clear();
53  }
54 
55  return 0;
56 }
Dummy converter class to convert a file into vector of string vectors.