route.h
1 /*
2 * Nebula Atom
3 
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17 
18 #ifndef NAF_TOOLS_ROUTE
19 #define NAF_TOOLS_ROUTE
20 
21 
22 #include <string>
23 #include <vector>
24 #include <functional>
25 
26 #include "Poco/URI.h"
27 
28 
29 namespace NAF
30 {
31  namespace Tools
32  {
33  enum class RouteType;
34  class Route;
35  }
36 }
37 
38 using namespace Poco;
39 
40 
41 enum class NAF::Tools::RouteType
42 {
43  kEntrypoint
44  ,kEndpoint
45 };
46 
47 
49 {
50  public:
51  Route();
52  Route(std::string route);
53  Route(std::vector<std::string> segments);
54  ~Route();
55 
56  std::string get_route() const { return route_; }
57  RouteType get_current_route_type() const {return current_route_type_;}
58  std::vector<std::string> get_segments() const {return segments_;}
59 
60  void set_current_route_type(RouteType current_route_type) {current_route_type_ = current_route_type;}
61  void set_segments(std::vector<std::string> segments) {segments_ = segments;}
62 
63  std::string SegmentsToString_();
64  bool operator==(const Route& route);
65 
66  protected:
67  void StringToSegment_(std::string& route);
68  void IdentifyRouteType_();
69 
70  private:
71  std::string route_;
72  RouteType current_route_type_;
73  std::vector<std::string> segments_;
74 };
75 
76 #endif // NAF_TOOLS_ROUTE
Definition: route.h:49