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


 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
UnicodeUtils.h
Go to the documentation of this file.
1 
2 // Copyright (c) 2009-2014 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 UNICODEUTILS_H
8 #define UNICODEUTILS_H
9 
10 #include "LuceneObject.h"
11 
12 namespace Lucene {
13 
14 class LPPAPI UnicodeUtil {
15 public:
16  virtual ~UnicodeUtil();
17 
18 public:
20  static bool isAlnum(wchar_t c);
21 
23  static bool isAlpha(wchar_t c);
24 
26  static bool isDigit(wchar_t c);
27 
29  static bool isSpace(wchar_t c);
30 
32  static bool isUpper(wchar_t c);
33 
35  static bool isLower(wchar_t c);
36 
38  static bool isOther(wchar_t c);
39 
41  static bool isNonSpacing(wchar_t c);
42 
44  static wchar_t toUpper(wchar_t c);
45 
47  static wchar_t toLower(wchar_t c);
48 };
49 
51 template <typename TYPE>
53 public:
56  length = 0;
57  }
58 
59 public:
61  int32_t length;
62 
63 public:
64  void setLength(int32_t length) {
65  if (!result) {
66  result = Array<TYPE>::newInstance((int32_t)(1.5 * (double)length));
67  }
68  if (result.size() < length) {
69  result.resize((int32_t)(1.5 * (double)length));
70  }
71  this->length = length;
72  }
73 
74  void copyText(const TranslationResult& other) {
75  setLength(other.length);
76  MiscUtils::arrayCopy(other.result.get(), 0, result.get(), 0, other.length);
77  }
78 
79  void copyText(boost::shared_ptr< TranslationResult<TYPE> > other) {
80  copyText(*other);
81  }
82 };
83 
84 class LPPAPI UTF8Result : public TranslationResult<uint8_t> {
85 public:
86  virtual ~UTF8Result();
87 };
88 
89 class LPPAPI UnicodeResult : public TranslationResult<wchar_t> {
90 public:
91  virtual ~UnicodeResult();
92 };
93 
94 }
95 
96 #endif

clucene.sourceforge.net