Actin®  Version 5.2.0
Software for Robotics Simulation and Control
ecToken.h
Go to the documentation of this file.
1 #ifndef ecToken_H_
2 #define ecToken_H_
3 //------------------------------------------------------------------------------
4 // Copyright (c) 2003-2013 Energid Technologies. All rights reserved.
5 //
9 //
10 //------------------------------------------------------------------------------
11 #include <foundCore/ecConfig.h> // Required to be first header.
12 #include <foundCore/ecTypes.h>
13 
14 #include <boost/preprocessor/seq/for_each.hpp>
15 #include <boost/version.hpp>
16 #include <iosfwd>
17 
19 #define ECTOKEN_DEFINITIONS(decl,seq) BOOST_PP_SEQ_FOR_EACH(_ECTOKEN_DECL,decl,_MAKE_SEQ2(seq))
20 
21 // If ECTOKEN_DEFINE is defined, then we also initialize the token.
22 #ifdef ECTOKEN_DEFINE
23 # define _ECTOKEN_DEFN(name,str) name = str
24 #else
25 # define _ECTOKEN_DEFN(name,str) name
26 #endif
27 
29 #define _ECTOKEN_DECL(r,decl,elem) extern decl const EcToken _ECTOKEN_DEFN elem;
30 
34 #define _MAKE_SEQ2(seq) BOOST_PP_CAT(_SEQ2_MACRO_1 seq,_FINISH)()
35 #define _SEQ2_MACRO_1(x,y) ((x, y)) _SEQ2_MACRO_2
36 #define _SEQ2_MACRO_2(x,y) ((x, y)) _SEQ2_MACRO_1
37 #define _SEQ2_MACRO_1_FINISH()
38 #define _SEQ2_MACRO_2_FINISH()
39 
40 
42 {
43 public:
45  EcToken
46  (
47  );
48 
50  EcToken
51  (
52  const EcString& token
53  );
54 
56  EcToken
57  (
58  const char* token
59  );
60 
62  EcToken
63  (
64  const EcString& xmlNamespace,
65  const EcString& token
66  );
67 
69  ~EcToken
70  (
71  );
72 
74  EcToken
75  (
76  const EcToken& orig
77  );
78 
80  EcToken& operator=
81  (
82  const EcToken& orig
83  );
84 
86  EcBoolean operator==
87  (
88  const EcToken& orig
89  ) const;
90 
92  EcBoolean operator!=
93  (
94  const EcToken& orig
95  ) const;
96 
98  EcBoolean operator<
99  (
100  const EcToken& orig
101  ) const;
102 
104  const EcString& xmlNamespace
105  (
106  ) const;
107 
109  const EcString& token
110  (
111  ) const;
112 
114  EcString namespaceAndToken
115  (
116  ) const;
117 
119  void strip
120  (
121  );
122 
123  // Provide basic string methods. They are pass-throughs to the token.
124 
126  EcToken& operator=(const EcString& token);
127 
129  EcToken& operator+=(const EcString& token);
130 
132  EcBoolean operator==(const EcString& orig) const;
133 
135  EcSizeT size() const;
136 
138  EcSizeT length() const;
139 
141  void resize(EcSizeT n);
142 
144  void clear();
145 
147  EcBoolean empty() const;
148 
154  EcString& append(const EcString& str);
155 
163  EcString& append(const EcString& str, EcSizeT pos, EcSizeT n);
164 
171  EcString& append(const char* s, EcSizeT n);
172 
174  void assign(const EcString&);
175 
177  EcString& erase(EcSizeT pos = 0, EcSizeT n = EcString::npos);
178 
180  EcSizeT copy(char* s, EcSizeT n, EcSizeT pos = 0);
181 
183  void swap(EcString& str);
184 
186  const char* c_str() const;
187 
195  EcSizeT find(const EcString& str, EcSizeT pos = 0) const;
196 
205  EcSizeT find(const char* s, EcSizeT pos, EcSizeT n) const;
206 
214  EcSizeT find(const char* s, EcSizeT pos = 0) const;
215 
223  EcSizeT find(char c, EcSizeT pos = 0) const;
224 
231  EcString substr(EcSizeT pos = 0, EcSizeT n = EcString::npos) const;
232 
234  operator const EcString&() const;
235 
236 protected:
239 };
240 
243 operator==
244  (
245  const EcString& left,
246  const EcToken& right
247  )
248 {
249  return right.operator==(left);
250 }
251 
254 operator+
255  (
256  const EcToken& left,
257  const EcString& right
258  )
259 {
260  return (EcToken(left) += right);
261 }
262 
265 operator+
266  (
267  const EcToken& left,
268  const char* right
269  )
270 {
271  return (EcToken(left) += right);
272 }
273 
275 inline std::ostream& operator<<
276  (
277  std::ostream& os,
278  const EcToken& token
279  )
280 {
281  return os << token.token();
282 }
283 
284 #endif // ecToken_H_
Specify some global configuration parameters and values.
A defininition of basic types of data and structs.
std::vector< T > & append(std::vector< T > &lhs, const std::vector< T > &rhs)
Append one vector to the end of another vector.
std::size_t EcSizeT
unsigned integer type used to represent indices and the sizes of containers
Definition: ecTypes.h:129
An EcString-like class that holds a tag and a namespace.
Definition: ecToken.h:41
EcBoolean EC_STABLE_XML_DECL operator==(const EcString &left, const EcToken &right)
overload of operator== to compare EcString with EcToken
Definition: ecToken.h:244
#define EC_STABLE_XML_DECL
xml directory
Definition: ecConfig.h:207
bool EcBoolean
Boolean (0 or 1)
Definition: ecTypes.h:21
EcString m_XmlNamespace
The XML namespace string.
Definition: ecToken.h:238
EcString m_Token
The token string.
Definition: ecToken.h:237
std::basic_string< char > EcString
a character string
Definition: ecTypes.h:116
Created by Energid Technologies www.energid.com
Copyright © 2016 Energid. All trademarks mentioned in this document are property of their respective owners.