highlighter application  1.1
HCE project utils : highlighter
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
OutDataStruct.hpp
Go to the documentation of this file.
1 
13 #ifndef OUT_DATA_STRUCT_HPP
14 #define OUT_DATA_STRUCT_HPP
15 
16 #include <stdexcept>
17 #include <string>
18 #include <vector>
19 
21 {
22  private:
23  unsigned int errorCode;
24  std::string errorMsg;
25  std::vector<std::string> contents;
26  std::vector<std::string> wcaches;
27  unsigned int highlightedCounter;
28  unsigned int foundCounter;
29  public:
30  OutDataStruct():errorCode(0), errorMsg(""), highlightedCounter(0), foundCounter(0) {}
31  void setErrorCode(unsigned int _errorCode)
32  {
33  errorCode = _errorCode;
34  }
35  void setErrorMsg(const std::string &_errorMsg)
36  {
37  errorMsg = _errorMsg;
38  }
39  void addContent(std::string &content)
40  {
41  contents.push_back(content);
42  }
43  void addContent(std::string &&content)
44  {
45  contents.push_back(content);
46  }
47  void addWcache(std::string &wcache)
48  {
49  wcaches.push_back(wcache);
50  }
51  void addWcache(std::string &&wcache)
52  {
53  wcaches.push_back(wcache);
54  }
55 
56  void setHighlightedCounter(unsigned int _highlightedCounter)
57  {
58  highlightedCounter = _highlightedCounter;
59  }
60  void setFoundCounter(unsigned int _foundCounter)
61  {
62  foundCounter = _foundCounter;
63  }
64 
65  unsigned int getErrCode() const
66  {
67  return errorCode;
68  }
69  std::string &getErrorMsg()
70  {
71  return errorMsg;
72  }
73  std::string &getContent(unsigned int i)
74  {
75  if(i >= contents.size())
76  {
77  throw std::out_of_range("contents out of range");
78  }
79  return contents[i];
80  }
81  std::string &getWcache(unsigned int i)
82  {
83  if(wcaches.size() <= i)
84  {
85  throw std::out_of_range(">>> Index out of range");
86  }
87  return wcaches[i];
88  }
89  unsigned int getHighlightedCounter() const
90  {
91  return highlightedCounter;
92  }
93  unsigned int getFoundCounter() const
94  {
95  return foundCounter;
96  }
97  unsigned int getContentsCount() const
98  {
99  return contents.size();
100  }
101  unsigned int getWcachesCount() const
102  {
103  return wcaches.size();
104  }
106 };
107 
108 #endif