ICU 58.2 58.2

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

- File List
- Globals

ucsdet.h
Go to the documentation of this file.
1 // Copyright (C) 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 **********************************************************************
5 * Copyright (C) 2005-2013, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 **********************************************************************
8 * file name: ucsdet.h
9 * encoding: US-ASCII
10 * indentation:4
11 *
12 * created on: 2005Aug04
13 * created by: Andy Heninger
14 *
15 * ICU Character Set Detection, API for C
16 *
17 * Draft version 18 Oct 2005
18 *
19 */
20
21 #ifndef __UCSDET_H
22 #define __UCSDET_H
23
24 #include "unicode/utypes.h"
25
26 #if !UCONFIG_NO_CONVERSION
27
28 #include "unicode/localpointer.h"
29 #include "unicode/uenum.h"
30
51 struct UCharsetDetector;
56 typedef struct UCharsetDetector UCharsetDetector;
57
58 struct UCharsetMatch;
64 typedef struct UCharsetMatch UCharsetMatch;
65
74 U_STABLE UCharsetDetector * U_EXPORT2
75 ucsdet_open(UErrorCode *status);
76
86 U_STABLE void U_EXPORT2
87 ucsdet_close(UCharsetDetector *ucsd);
88
89 #if U_SHOW_CPLUSPLUS_API
90
91 U_NAMESPACE_BEGIN
92
102 U_DEFINE_LOCAL_OPEN_POINTER(LocalUCharsetDetectorPointer, UCharsetDetector, ucsdet_close);
103
104 U_NAMESPACE_END
105
106 #endif
107
123 U_STABLE void U_EXPORT2
124 ucsdet_setText(UCharsetDetector *ucsd, const char *textIn, int32_t len, UErrorCode *status);
125
126
145 U_STABLE void U_EXPORT2
146 ucsdet_setDeclaredEncoding(UCharsetDetector *ucsd, const char *encoding, int32_t length, UErrorCode *status);
147
148
174 U_STABLE const UCharsetMatch * U_EXPORT2
175 ucsdet_detect(UCharsetDetector *ucsd, UErrorCode *status);
176
177
208 U_STABLE const UCharsetMatch ** U_EXPORT2
209 ucsdet_detectAll(UCharsetDetector *ucsd, int32_t *matchesFound, UErrorCode *status);
210
211
212
228 U_STABLE const char * U_EXPORT2
229 ucsdet_getName(const UCharsetMatch *ucsm, UErrorCode *status);
230
254 U_STABLE int32_t U_EXPORT2
255 ucsdet_getConfidence(const UCharsetMatch *ucsm, UErrorCode *status);
256
286 U_STABLE const char * U_EXPORT2
287 ucsdet_getLanguage(const UCharsetMatch *ucsm, UErrorCode *status);
288
289
312 U_STABLE int32_t U_EXPORT2
313 ucsdet_getUChars(const UCharsetMatch *ucsm,
314 UChar *buf, int32_t cap, UErrorCode *status);
315
316
317
346 U_STABLE UEnumeration * U_EXPORT2
347 ucsdet_getAllDetectableCharsets(const UCharsetDetector *ucsd, UErrorCode *status);
348
360 U_STABLE UBool U_EXPORT2
361 ucsdet_isInputFilterEnabled(const UCharsetDetector *ucsd);
362
363
375 U_STABLE UBool U_EXPORT2
376 ucsdet_enableInputFilter(UCharsetDetector *ucsd, UBool filter);
377
378 #ifndef U_HIDE_INTERNAL_API
379
392 U_INTERNAL UEnumeration * U_EXPORT2
393 ucsdet_getDetectableCharsets(const UCharsetDetector *ucsd, UErrorCode *status);
394
408 U_INTERNAL void U_EXPORT2
409 ucsdet_setDetectableCharset(UCharsetDetector *ucsd, const char *encoding, UBool enabled, UErrorCode *status);
410 #endif /* U_HIDE_INTERNAL_API */
411
412 #endif
413 #endif /* __UCSDET_H */
414
415
ucsdet_setDetectableCharset
void ucsdet_setDetectableCharset(UCharsetDetector *ucsd, const char *encoding, UBool enabled, UErrorCode *status)
Enable or disable individual charset encoding.
ucsdet_enableInputFilter
UBool ucsdet_enableInputFilter(UCharsetDetector *ucsd, UBool filter)
Enable filtering of input text.
UEnumeration
struct UEnumeration UEnumeration
structure representing an enumeration object instance
Definition: uenum.h:41
ucsdet_getName
const char * ucsdet_getName(const UCharsetMatch *ucsm, UErrorCode *status)
Get the name of the charset represented by a UCharsetMatch.
U_INTERNAL
#define U_INTERNAL
This is used to declare a function as an internal ICU C API.
Definition: umachine.h:142
ucsdet_close
void ucsdet_close(UCharsetDetector *ucsd)
Close a charset detector.
ucsdet_getUChars
int32_t ucsdet_getUChars(const UCharsetMatch *ucsm, UChar *buf, int32_t cap, UErrorCode *status)
Get the entire input text as a UChar string, placing it into a caller-supplied buffer.
ucsdet_getDetectableCharsets
UEnumeration * ucsdet_getDetectableCharsets(const UCharsetDetector *ucsd, UErrorCode *status)
Get an iterator over the set of detectable charsets - over the charsets that are enabled by the speci...
ucsdet_detect
const UCharsetMatch * ucsdet_detect(UCharsetDetector *ucsd, UErrorCode *status)
Return the charset that best matches the supplied input data.
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:131
ucsdet_setText
void ucsdet_setText(UCharsetDetector *ucsd, const char *textIn, int32_t len, UErrorCode *status)
Set the input byte data whose charset is to detected.
ucsdet_setDeclaredEncoding
void ucsdet_setDeclaredEncoding(UCharsetDetector *ucsd, const char *encoding, int32_t length, UErrorCode *status)
Set the declared encoding for charset detection.
U_DEFINE_LOCAL_OPEN_POINTER
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
Definition: localpointer.h:530
localpointer.h
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
UCharsetDetector
struct UCharsetDetector UCharsetDetector
Structure representing a charset detector.
Definition: ucsdet.h:56
LocalUCharsetDetectorPointer
"Smart pointer" class, closes a UCharsetDetector via ucsdet_close().
UChar
uint16_t UChar
Define UChar to be UCHAR_TYPE, if that is #defined (for example, to char16_t), or wchar_t if that is ...
Definition: umachine.h:337
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:132
ucsdet_detectAll
const UCharsetMatch ** ucsdet_detectAll(UCharsetDetector *ucsd, int32_t *matchesFound, UErrorCode *status)
Find all charset matches that appear to be consistent with the input, returning an array of results...
ucsdet_getAllDetectableCharsets
UEnumeration * ucsdet_getAllDetectableCharsets(const UCharsetDetector *ucsd, UErrorCode *status)
Get an iterator over the set of all detectable charsets - over the charsets that are known to the cha...
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:396
ucsdet_open
UCharsetDetector * ucsdet_open(UErrorCode *status)
Open a charset detector.
uenum.h
C API: String Enumeration.
ucsdet_getConfidence
int32_t ucsdet_getConfidence(const UCharsetMatch *ucsm, UErrorCode *status)
Get a confidence number for the quality of the match of the byte data with the charset.
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
ucsdet_isInputFilterEnabled
UBool ucsdet_isInputFilterEnabled(const UCharsetDetector *ucsd)
Test whether input filtering is enabled for this charset detector.
ucsdet_getLanguage
const char * ucsdet_getLanguage(const UCharsetMatch *ucsm, UErrorCode *status)
Get the RFC 3066 code for the language of the input data.
UCharsetMatch
struct UCharsetMatch UCharsetMatch
Opaque structure representing a match that was identified from a charset detection operation...
Definition: ucsdet.h:64
U_STABLE
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:134
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:259