libcommonc++  0.7
CharOps.h++
Go to the documentation of this file.
1 /* ---------------------------------------------------------------------------
2  commonc++ - A C++ Common Class Library
3  Copyright (C) 2005-2014 Mark A Lindner
4 
5  This file is part of commonc++.
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License as published by the Free Software Foundation; either
10  version 2 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public
18  License along with this library; if not, write to the Free
19  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  ---------------------------------------------------------------------------
21 */
22 
23 #ifndef __ccxx_CharOps_hxx
24 #define __ccxx_CharOps_hxx
25 
26 #include <commonc++/Common.h++>
27 
28 namespace ccxx {
29 
37 {
38  public:
39 
50  static int compare(const char16_t* a, const char16_t* b,
51  bool ignoreCase = false);
52 
63  static int compare(const char16_t a, const char16_t b,
64  bool ignoreCase = false);
65 
77  static int compare(const char16_t* a, const char16_t* b, uint_t n,
78  bool ignoreCase = false);
79 
89  static char16_t* move(char16_t* dest, char16_t* src, uint_t n);
90 
99  static const char16_t* find(const char16_t* str, char16_t c, uint_t len = 0);
100 
109  static char16_t* find(char16_t* str, char16_t c, uint_t len = 0);
110 
119  static const char16_t* find(const char16_t* str, const char16_t* s);
120 
129  static char16_t* find(char16_t* str, const char16_t* s);
130 
141  static const char16_t* findLast(const char16_t* str, char16_t c,
142  uint_t fromIndex = END);
143 
154  static char16_t* findLast(char16_t* str, char16_t c, uint_t fromIndex = END);
155 
167  static const char16_t* findLast(const char16_t* str, const char16_t* s,
168  uint_t fromIndex = END);
169 
181  static char16_t* findLast(char16_t* str, const char16_t* s,
182  uint_t fromIndex = END);
183 
190  static uint_t length(const char16_t* str);
191 
201  static char16_t* copy(char16_t* dest, const char16_t* src, uint_t n);
202 
212  static char16_t* copyRaw(char16_t* dest, const char16_t* src, uint_t n);
213 
221  static int32_t toLong(const char16_t* str, int base = 10);
222 
230  static uint32_t toULong(const char16_t* str, int base = 10);
231 
239  static int64_t toLongLong(const char16_t* str, int base = 10);
240 
248  static uint64_t toULongLong(const char16_t* str, int base = 10);
249 
256  static float toFloat(const char16_t* str);
257 
265  static double toDouble(const char16_t* str);
266 
268  static const uint_t END;
269  static const char16_t TRUE_REP[];
270  static const char16_t FALSE_REP[];
271  static const char16_t DIGITS[];
272 
273  private:
274 
275  static char* _toASCII(const char16_t* str, char* buf, uint_t len);
276 };
277 
278 } // namespace ccxx
279 
280 #endif // __ccxx_CharOps_hxx
unsigned int uint_t
An alias for unsigned int.
Definition: Integers.h++:74
UTF-16 character array operations.
Definition: CharOps.h++:36
static const uint_t END
A pseudo-index indicating the end of a UTF-16 character array.
Definition: CharOps.h++:268
#define COMMONCPP_API
Definition: Common.h++:126
uint16_t char16_t
A UTF-16 character.
Definition: Common.h++:201
Definition: AllocationMap.c++:25