1ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/* 2ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ********************************************************************** 354dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * Copyright (C) 2005-2012, International Business Machines 4ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Corporation and others. All Rights Reserved. 5ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ********************************************************************** 6ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 7ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 8ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#ifndef __CSRECOG_H 9ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#define __CSRECOG_H 10ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 11ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/uobject.h" 12ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 13ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#if !UCONFIG_NO_CONVERSION 14ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 15ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "inputext.h" 16ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 17ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_BEGIN 18ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1954dcd9b6a06071f647dac967e9e267abb9410720Craig Corneliusclass CharsetMatch; 2054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius 21ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass CharsetRecognizer : public UMemory 22ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 23ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru public: 24ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 25ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the IANA name of this charset. 2654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * Note that some recognizers can recognize more than one charset, but that this API 2754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * assumes just one name per recognizer. 2854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * TODO: need to account for multiple names in public API that enumerates over the 2954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * known detectable charsets. 30ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the charset name. 31ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 32ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual const char *getName() const = 0; 33ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 34ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 35ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the ISO language code for this charset. 36ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the language code, or <code>null</code> if the language cannot be determined. 37ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 38ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual const char *getLanguage() const; 39ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 4054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius /* 4154dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * Try the given input text against this Charset, and fill in the results object 4254dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * with the quality of the match plus other information related to the match. 4354dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * 4454dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * Return TRUE if the the input bytes are a potential match, and 4554dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * FALSE if the input data is not compatible with, or illegal in this charset. 4654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius */ 4754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius virtual UBool match(InputText *textIn, CharsetMatch *results) const = 0; 48ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 49ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual ~CharsetRecognizer(); 50ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru}; 51ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 52ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_END 53ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 54ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif 55ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif /* __CSRECOG_H */ 56