Identifier.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2011, SRI International (R)
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #pragma once
19 
20 #ifndef __OpenKarto_Name_h__
21 #define __OpenKarto_Name_h__
22 
23 #include <OpenKarto/String.h>
24 
25 namespace karto
26 {
27 
29 
30 
41  {
42  public:
46  Identifier();
47 
52  Identifier(const char* pString);
53 
58  Identifier(const String& rString);
59 
63  Identifier(const Identifier& rOther);
64 
68  virtual ~Identifier();
69 
70  public:
75  const String& GetName() const;
76 
81  void SetName(const String& pName);
82 
87  const String& GetScope() const;
88 
93  void SetScope(const String& rScope);
94 
99  kt_size_t Size() const;
100 
104  void Clear();
105 
110  const String& ToString() const;
111 
112  public:
116  Identifier& operator=(const Identifier& rOther);
117 
121  kt_bool operator==(const Identifier& rOther) const;
122 
126  kt_bool operator!=(const Identifier& rOther) const
127  {
128  return !(*this == rOther);
129  }
130 
135  kt_bool operator<(const Identifier& rOther) const;
136 
140  friend KARTO_FORCEINLINE std::ostream& operator << (std::ostream& rStream, const Identifier& rIdentifier)
141  {
142  rStream << rIdentifier.ToString();
143  return rStream;
144  }
145 
146  private:
151  void Parse(const String& rString);
152 
157  void Validate(const String& rString);
158 
162  void Update();
163 
169  inline kt_bool IsValidFirst(char c)
170  {
171  return (isalpha(c) || c == '/');
172  }
173 
179  inline kt_bool IsValid(char c)
180  {
181  return (isalnum(c) || c == '/' || c == '_' || c == '-');
182  }
183 
184  private:
188  };
189 
191 
192 }
193 
194 #endif // __OpenKarto_Name_h__
bool kt_bool
Definition: Types.h:145
std::size_t kt_size_t
Definition: Types.h:138
TFSIMD_FORCE_INLINE bool operator==(const Matrix3x3 &m1, const Matrix3x3 &m2)
#define KARTO_EXPORT
Definition: Macros.h:78
bool operator<(const CellData &a, const CellData &b)
#define KARTO_FORCEINLINE
Definition: Macros.h:56
kt_bool IsValidFirst(char c)
Definition: Identifier.h:169
const String & ToString() const
Definition: Identifier.cpp:93
kt_bool operator!=(const Identifier &rOther) const
Definition: Identifier.h:126
kt_bool IsValid(char c)
Definition: Identifier.h:179
Definition: Any.cpp:20


nav2d_karto
Author(s): Sebastian Kasperski
autogenerated on Tue Nov 7 2017 06:02:36