Lucene++ - a full-featured, c++ search engine
API Documentation

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files

- File List
- Globals

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
StringUtils.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2011 Alan Wright. All rights reserved.
3 // Distributable under the terms of either the Apache License (Version 2.0)
4 // or the GNU Lesser General Public License.
6
7 #ifndef STRINGUTILS_H
8 #define STRINGUTILS_H
9
10 #include "Lucene.h"
11
12 namespace Lucene
13 {
14 class LPPAPI StringUtils
15 {
16 public:
18 static const int32_t MAX_ENCODING_UTF8_SIZE;
19
21 static const int32_t CHARACTER_MAX_RADIX;
22
23 public:
25 static int32_t toUnicode(const uint8_t* utf8, int32_t length, CharArray unicode);
26
28 static int32_t toUnicode(const uint8_t* utf8, int32_t length, UnicodeResultPtr unicodeResult);
29
31 static String toUnicode(const uint8_t* utf8, int32_t length);
32
34 static String toUnicode(const SingleString& s);
35
37 static int32_t toUTF8(const wchar_t* unicode, int32_t length, ByteArray utf8);
38
40 static int32_t toUTF8(const wchar_t* unicode, int32_t length, UTF8ResultPtr utf8Result);
41
43 static SingleString toUTF8(const wchar_t* unicode, int32_t length);
44
46 static SingleString toUTF8(const String& s);
47
49 static void toLower(String& str);
50
52 static String toLower(const String& str);
53
55 static void toUpper(String& str);
56
58 static String toUpper(const String& str);
59
61 static int32_t compareCase(const String& first, const String& second);
62
64 static Collection<String> split(const String& str, const String& delim);
65
67 static int32_t toInt(const String& value);
68
70 static int64_t toLong(const String& value);
71
73 static int64_t toLong(const String& value, int32_t base);
74
76 static double toDouble(const String& value);
77
79 static int32_t hashCode(const String& value);
80
82 static String toString(int64_t value, int32_t base);
83
85 template <class TYPE>
86 static String toString(const TYPE& value)
87 {
88 StringStream os;
89 os << value;
90 return os.str();
91 }
92 };
93
94 #define UTF8_TO_STRING(utf8) StringUtils::toUnicode(utf8, SIZEOF_ARRAY(utf8))
95 }
96
97 #endif

clucene.sourceforge.net