Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* |
michael@0 | 2 | ********************************************************************** |
michael@0 | 3 | * Copyright (C) 2005-2012, International Business Machines |
michael@0 | 4 | * Corporation and others. All Rights Reserved. |
michael@0 | 5 | ********************************************************************** |
michael@0 | 6 | */ |
michael@0 | 7 | |
michael@0 | 8 | #ifndef __CSRECOG_H |
michael@0 | 9 | #define __CSRECOG_H |
michael@0 | 10 | |
michael@0 | 11 | #include "unicode/uobject.h" |
michael@0 | 12 | |
michael@0 | 13 | #if !UCONFIG_NO_CONVERSION |
michael@0 | 14 | |
michael@0 | 15 | #include "inputext.h" |
michael@0 | 16 | |
michael@0 | 17 | U_NAMESPACE_BEGIN |
michael@0 | 18 | |
michael@0 | 19 | class CharsetMatch; |
michael@0 | 20 | |
michael@0 | 21 | class CharsetRecognizer : public UMemory |
michael@0 | 22 | { |
michael@0 | 23 | public: |
michael@0 | 24 | /** |
michael@0 | 25 | * Get the IANA name of this charset. |
michael@0 | 26 | * Note that some recognizers can recognize more than one charset, but that this API |
michael@0 | 27 | * assumes just one name per recognizer. |
michael@0 | 28 | * TODO: need to account for multiple names in public API that enumerates over the |
michael@0 | 29 | * known detectable charsets. |
michael@0 | 30 | * @return the charset name. |
michael@0 | 31 | */ |
michael@0 | 32 | virtual const char *getName() const = 0; |
michael@0 | 33 | |
michael@0 | 34 | /** |
michael@0 | 35 | * Get the ISO language code for this charset. |
michael@0 | 36 | * @return the language code, or <code>null</code> if the language cannot be determined. |
michael@0 | 37 | */ |
michael@0 | 38 | virtual const char *getLanguage() const; |
michael@0 | 39 | |
michael@0 | 40 | /* |
michael@0 | 41 | * Try the given input text against this Charset, and fill in the results object |
michael@0 | 42 | * with the quality of the match plus other information related to the match. |
michael@0 | 43 | * |
michael@0 | 44 | * Return TRUE if the the input bytes are a potential match, and |
michael@0 | 45 | * FALSE if the input data is not compatible with, or illegal in this charset. |
michael@0 | 46 | */ |
michael@0 | 47 | virtual UBool match(InputText *textIn, CharsetMatch *results) const = 0; |
michael@0 | 48 | |
michael@0 | 49 | virtual ~CharsetRecognizer(); |
michael@0 | 50 | }; |
michael@0 | 51 | |
michael@0 | 52 | U_NAMESPACE_END |
michael@0 | 53 | |
michael@0 | 54 | #endif |
michael@0 | 55 | #endif /* __CSRECOG_H */ |