xref: /aosp_15_r20/external/icu/libicu/cts_headers/inputext.h (revision 0e209d3975ff4a8c132096b14b0e9364a753506e)
1*0e209d39SAndroid Build Coastguard Worker // © 2016 and later: Unicode, Inc. and others.
2*0e209d39SAndroid Build Coastguard Worker // License & terms of use: http://www.unicode.org/copyright.html
3*0e209d39SAndroid Build Coastguard Worker /*
4*0e209d39SAndroid Build Coastguard Worker  **********************************************************************
5*0e209d39SAndroid Build Coastguard Worker  *   Copyright (C) 2005-2008, International Business Machines
6*0e209d39SAndroid Build Coastguard Worker  *   Corporation and others.  All Rights Reserved.
7*0e209d39SAndroid Build Coastguard Worker  **********************************************************************
8*0e209d39SAndroid Build Coastguard Worker  */
9*0e209d39SAndroid Build Coastguard Worker 
10*0e209d39SAndroid Build Coastguard Worker #ifndef __INPUTEXT_H
11*0e209d39SAndroid Build Coastguard Worker #define __INPUTEXT_H
12*0e209d39SAndroid Build Coastguard Worker 
13*0e209d39SAndroid Build Coastguard Worker /**
14*0e209d39SAndroid Build Coastguard Worker  * \file
15*0e209d39SAndroid Build Coastguard Worker  * \internal
16*0e209d39SAndroid Build Coastguard Worker  *
17*0e209d39SAndroid Build Coastguard Worker  * This is an internal header for the Character Set Detection code. The
18*0e209d39SAndroid Build Coastguard Worker  * name is probably too generic...
19*0e209d39SAndroid Build Coastguard Worker  */
20*0e209d39SAndroid Build Coastguard Worker 
21*0e209d39SAndroid Build Coastguard Worker 
22*0e209d39SAndroid Build Coastguard Worker #include "unicode/uobject.h"
23*0e209d39SAndroid Build Coastguard Worker 
24*0e209d39SAndroid Build Coastguard Worker #if !UCONFIG_NO_CONVERSION
25*0e209d39SAndroid Build Coastguard Worker 
26*0e209d39SAndroid Build Coastguard Worker U_NAMESPACE_BEGIN
27*0e209d39SAndroid Build Coastguard Worker 
28*0e209d39SAndroid Build Coastguard Worker class InputText : public UMemory
29*0e209d39SAndroid Build Coastguard Worker {
30*0e209d39SAndroid Build Coastguard Worker     // Prevent copying
31*0e209d39SAndroid Build Coastguard Worker     InputText(const InputText &);
32*0e209d39SAndroid Build Coastguard Worker public:
33*0e209d39SAndroid Build Coastguard Worker     InputText(UErrorCode &status);
34*0e209d39SAndroid Build Coastguard Worker     ~InputText();
35*0e209d39SAndroid Build Coastguard Worker 
36*0e209d39SAndroid Build Coastguard Worker     void setText(const char *in, int32_t len);
37*0e209d39SAndroid Build Coastguard Worker     void setDeclaredEncoding(const char *encoding, int32_t len);
38*0e209d39SAndroid Build Coastguard Worker     UBool isSet() const;
39*0e209d39SAndroid Build Coastguard Worker     void MungeInput(UBool fStripTags);
40*0e209d39SAndroid Build Coastguard Worker 
41*0e209d39SAndroid Build Coastguard Worker     // The text to be checked.  Markup will have been
42*0e209d39SAndroid Build Coastguard Worker     //   removed if appropriate.
43*0e209d39SAndroid Build Coastguard Worker     uint8_t    *fInputBytes;
44*0e209d39SAndroid Build Coastguard Worker     int32_t     fInputLen;          // Length of the byte data in fInputBytes.
45*0e209d39SAndroid Build Coastguard Worker     // byte frequency statistics for the input text.
46*0e209d39SAndroid Build Coastguard Worker     //   Value is percent, not absolute.
47*0e209d39SAndroid Build Coastguard Worker     //   Value is rounded up, so zero really means zero occurrences.
48*0e209d39SAndroid Build Coastguard Worker     int16_t  *fByteStats;
49*0e209d39SAndroid Build Coastguard Worker     UBool     fC1Bytes;          // True if any bytes in the range 0x80 - 0x9F are in the input;false by default
50*0e209d39SAndroid Build Coastguard Worker     char     *fDeclaredEncoding;
51*0e209d39SAndroid Build Coastguard Worker 
52*0e209d39SAndroid Build Coastguard Worker     const uint8_t           *fRawInput;     // Original, untouched input bytes.
53*0e209d39SAndroid Build Coastguard Worker     //  If user gave us a byte array, this is it.
54*0e209d39SAndroid Build Coastguard Worker     //  If user gave us a stream, it's read to a
55*0e209d39SAndroid Build Coastguard Worker     //   buffer here.
56*0e209d39SAndroid Build Coastguard Worker     int32_t                  fRawLength;    // Length of data in fRawInput array.
57*0e209d39SAndroid Build Coastguard Worker 
58*0e209d39SAndroid Build Coastguard Worker };
59*0e209d39SAndroid Build Coastguard Worker 
60*0e209d39SAndroid Build Coastguard Worker U_NAMESPACE_END
61*0e209d39SAndroid Build Coastguard Worker 
62*0e209d39SAndroid Build Coastguard Worker #endif
63*0e209d39SAndroid Build Coastguard Worker #endif /* __INPUTEXT_H */
64