ANNA Suite  2020b
Multipurpose development suite for Telco applications
Data.hpp
Go to the documentation of this file.
1 // ANNA - Anna is Not Nothingness Anymore //
2 // //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
4 // //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
7 
8 
9 #ifndef anna_xml_Data_hpp
10 #define anna_xml_Data_hpp
11 
12 #include <string>
13 #include <stdlib.h>
14 
15 namespace anna {
16 
17 namespace xml {
18 
19 class Node;
20 
38 class Data {
39 public:
44  const std::string& getValue() const { return a_value; }
45 
50  const char* getCStringValue() const { return a_value.c_str(); }
51 
56  int getIntegerValue() const { return atoi(a_value.c_str()); }
57 
62  void setValue(const char* value) { a_value = (value != NULL) ? value : ""; filter(a_value); }
63 
68  void setValue(const std::string& value) { a_value = value; }
69 
74  void setValue(const int value) ;
75 
80  virtual std::string asString() const ;
81 
82 protected:
86  Data() : a_owner(NULL) {;}
87 
88 private:
89  std::string a_value;
90  Node* a_owner;
91 
92  void setNode(Node* node) { a_owner = node; }
93 
100  static const std::string& filter(const std::string& str) { return str; }
101 
102  friend class Node;
103 };
104 
105 }
106 }
107 
108 #endif
void setValue(const std::string &value)
Definition: Data.hpp:68
virtual std::string asString() const
Data()
Definition: Data.hpp:86
const std::string & getValue() const
Definition: Data.hpp:44
Definition: Node.hpp:56
Definition: Data.hpp:38
int getIntegerValue() const
Definition: Data.hpp:56
xml::Node Node
Definition: Node.hpp:21
Definition: app.hpp:12
void setValue(const char *value)
Definition: Data.hpp:62
const char * getCStringValue() const
Definition: Data.hpp:50