ICU 70.1  70.1
casemap.h
Go to the documentation of this file.
1 // © 2017 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 
4 // casemap.h
5 // created: 2017jan12 Markus W. Scherer
6 
7 #ifndef __CASEMAP_H__
8 #define __CASEMAP_H__
9 
10 #include "unicode/utypes.h"
11 
12 #if U_SHOW_CPLUSPLUS_API
13 
14 #include "unicode/stringpiece.h"
15 #include "unicode/uobject.h"
16 
22 U_NAMESPACE_BEGIN
23 
24 class BreakIterator;
25 class ByteSink;
26 class Edits;
27 
34 public:
65  static int32_t toLower(
66  const char *locale, uint32_t options,
67  const char16_t *src, int32_t srcLength,
68  char16_t *dest, int32_t destCapacity, Edits *edits,
69  UErrorCode &errorCode);
70 
101  static int32_t toUpper(
102  const char *locale, uint32_t options,
103  const char16_t *src, int32_t srcLength,
104  char16_t *dest, int32_t destCapacity, Edits *edits,
105  UErrorCode &errorCode);
106 
107 #if !UCONFIG_NO_BREAK_ITERATION
108 
152  static int32_t toTitle(
153  const char *locale, uint32_t options, BreakIterator *iter,
154  const char16_t *src, int32_t srcLength,
155  char16_t *dest, int32_t destCapacity, Edits *edits,
156  UErrorCode &errorCode);
157 
158 #endif // UCONFIG_NO_BREAK_ITERATION
159 
194  static int32_t fold(
195  uint32_t options,
196  const char16_t *src, int32_t srcLength,
197  char16_t *dest, int32_t destCapacity, Edits *edits,
198  UErrorCode &errorCode);
199 
221  static void utf8ToLower(
222  const char *locale, uint32_t options,
223  StringPiece src, ByteSink &sink, Edits *edits,
224  UErrorCode &errorCode);
225 
247  static void utf8ToUpper(
248  const char *locale, uint32_t options,
249  StringPiece src, ByteSink &sink, Edits *edits,
250  UErrorCode &errorCode);
251 
252 #if !UCONFIG_NO_BREAK_ITERATION
253 
287  static void utf8ToTitle(
288  const char *locale, uint32_t options, BreakIterator *iter,
289  StringPiece src, ByteSink &sink, Edits *edits,
290  UErrorCode &errorCode);
291 
292 #endif // UCONFIG_NO_BREAK_ITERATION
293 
318  static void utf8Fold(
319  uint32_t options,
320  StringPiece src, ByteSink &sink, Edits *edits,
321  UErrorCode &errorCode);
322 
353  static int32_t utf8ToLower(
354  const char *locale, uint32_t options,
355  const char *src, int32_t srcLength,
356  char *dest, int32_t destCapacity, Edits *edits,
357  UErrorCode &errorCode);
358 
389  static int32_t utf8ToUpper(
390  const char *locale, uint32_t options,
391  const char *src, int32_t srcLength,
392  char *dest, int32_t destCapacity, Edits *edits,
393  UErrorCode &errorCode);
394 
395 #if !UCONFIG_NO_BREAK_ITERATION
396 
439  static int32_t utf8ToTitle(
440  const char *locale, uint32_t options, BreakIterator *iter,
441  const char *src, int32_t srcLength,
442  char *dest, int32_t destCapacity, Edits *edits,
443  UErrorCode &errorCode);
444 
445 #endif // UCONFIG_NO_BREAK_ITERATION
446 
481  static int32_t utf8Fold(
482  uint32_t options,
483  const char *src, int32_t srcLength,
484  char *dest, int32_t destCapacity, Edits *edits,
485  UErrorCode &errorCode);
486 
487 private:
488  CaseMap() = delete;
489  CaseMap(const CaseMap &other) = delete;
490  CaseMap &operator=(const CaseMap &other) = delete;
491 };
492 
493 U_NAMESPACE_END
494 
495 #endif /* U_SHOW_CPLUSPLUS_API */
496 
497 #endif // __CASEMAP_H__
The BreakIterator class implements methods for finding the location of boundaries in text.
Definition: brkiter.h:106
A ByteSink can be filled with bytes.
Definition: bytestream.h:53
Low-level C++ case mapping functions.
Definition: casemap.h:33
static int32_t utf8Fold(uint32_t options, const char *src, int32_t srcLength, char *dest, int32_t destCapacity, Edits *edits, UErrorCode &errorCode)
Case-folds a UTF-8 string and optionally records edits.
static int32_t toTitle(const char *locale, uint32_t options, BreakIterator *iter, const char16_t *src, int32_t srcLength, char16_t *dest, int32_t destCapacity, Edits *edits, UErrorCode &errorCode)
Titlecases a UTF-16 string and optionally records edits.
static int32_t toLower(const char *locale, uint32_t options, const char16_t *src, int32_t srcLength, char16_t *dest, int32_t destCapacity, Edits *edits, UErrorCode &errorCode)
Lowercases a UTF-16 string and optionally records edits.
static void utf8ToUpper(const char *locale, uint32_t options, StringPiece src, ByteSink &sink, Edits *edits, UErrorCode &errorCode)
Uppercases a UTF-8 string and optionally records edits.
static int32_t utf8ToTitle(const char *locale, uint32_t options, BreakIterator *iter, const char *src, int32_t srcLength, char *dest, int32_t destCapacity, Edits *edits, UErrorCode &errorCode)
Titlecases a UTF-8 string and optionally records edits.
static void utf8ToTitle(const char *locale, uint32_t options, BreakIterator *iter, StringPiece src, ByteSink &sink, Edits *edits, UErrorCode &errorCode)
Titlecases a UTF-8 string and optionally records edits.
static int32_t fold(uint32_t options, const char16_t *src, int32_t srcLength, char16_t *dest, int32_t destCapacity, Edits *edits, UErrorCode &errorCode)
Case-folds a UTF-16 string and optionally records edits.
static int32_t utf8ToLower(const char *locale, uint32_t options, const char *src, int32_t srcLength, char *dest, int32_t destCapacity, Edits *edits, UErrorCode &errorCode)
Lowercases a UTF-8 string and optionally records edits.
static int32_t utf8ToUpper(const char *locale, uint32_t options, const char *src, int32_t srcLength, char *dest, int32_t destCapacity, Edits *edits, UErrorCode &errorCode)
Uppercases a UTF-8 string and optionally records edits.
static void utf8ToLower(const char *locale, uint32_t options, StringPiece src, ByteSink &sink, Edits *edits, UErrorCode &errorCode)
Lowercases a UTF-8 string and optionally records edits.
static int32_t toUpper(const char *locale, uint32_t options, const char16_t *src, int32_t srcLength, char16_t *dest, int32_t destCapacity, Edits *edits, UErrorCode &errorCode)
Uppercases a UTF-16 string and optionally records edits.
static void utf8Fold(uint32_t options, StringPiece src, ByteSink &sink, Edits *edits, UErrorCode &errorCode)
Case-folds a UTF-8 string and optionally records edits.
Records lengths of string edits but not replacement text.
Definition: edits.h:80
A string-like object that points to a sized piece of memory.
Definition: stringpiece.h:60
UMemory is the common ICU base class.
Definition: uobject.h:115
C++ API: StringPiece: Read-only byte string wrapper class.
#define U_FINAL
Defined to the C++11 "final" keyword if available.
Definition: umachine.h:141
C++ API: Common ICU base class UObject.
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
#define U_COMMON_API
Set to export library symbols from inside the common library, and to import them from outside.
Definition: utypes.h:300