1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/icu/source/i18n/csrecog.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,55 @@ 1.4 +/* 1.5 + ********************************************************************** 1.6 + * Copyright (C) 2005-2012, International Business Machines 1.7 + * Corporation and others. All Rights Reserved. 1.8 + ********************************************************************** 1.9 + */ 1.10 + 1.11 +#ifndef __CSRECOG_H 1.12 +#define __CSRECOG_H 1.13 + 1.14 +#include "unicode/uobject.h" 1.15 + 1.16 +#if !UCONFIG_NO_CONVERSION 1.17 + 1.18 +#include "inputext.h" 1.19 + 1.20 +U_NAMESPACE_BEGIN 1.21 + 1.22 +class CharsetMatch; 1.23 + 1.24 +class CharsetRecognizer : public UMemory 1.25 +{ 1.26 + public: 1.27 + /** 1.28 + * Get the IANA name of this charset. 1.29 + * Note that some recognizers can recognize more than one charset, but that this API 1.30 + * assumes just one name per recognizer. 1.31 + * TODO: need to account for multiple names in public API that enumerates over the 1.32 + * known detectable charsets. 1.33 + * @return the charset name. 1.34 + */ 1.35 + virtual const char *getName() const = 0; 1.36 + 1.37 + /** 1.38 + * Get the ISO language code for this charset. 1.39 + * @return the language code, or <code>null</code> if the language cannot be determined. 1.40 + */ 1.41 + virtual const char *getLanguage() const; 1.42 + 1.43 + /* 1.44 + * Try the given input text against this Charset, and fill in the results object 1.45 + * with the quality of the match plus other information related to the match. 1.46 + * 1.47 + * Return TRUE if the the input bytes are a potential match, and 1.48 + * FALSE if the input data is not compatible with, or illegal in this charset. 1.49 + */ 1.50 + virtual UBool match(InputText *textIn, CharsetMatch *results) const = 0; 1.51 + 1.52 + virtual ~CharsetRecognizer(); 1.53 +}; 1.54 + 1.55 +U_NAMESPACE_END 1.56 + 1.57 +#endif 1.58 +#endif /* __CSRECOG_H */