2017-01-20 00:20:31 +00:00
|
|
|
// © 2016 and later: Unicode, Inc. and others.
|
2016-06-15 18:58:17 +00:00
|
|
|
// License & terms of use: http://www.unicode.org/copyright.html
|
2006-02-06 18:03:11 +00:00
|
|
|
/*
|
|
|
|
**********************************************************************
|
2016-05-31 21:45:07 +00:00
|
|
|
* Copyright (C) 2005-2012, International Business Machines
|
|
|
|
* Corporation and others. All Rights Reserved.
|
2006-02-06 18:03:11 +00:00
|
|
|
**********************************************************************
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __CSRECOG_H
|
|
|
|
#define __CSRECOG_H
|
|
|
|
|
|
|
|
#include "unicode/uobject.h"
|
|
|
|
|
2006-05-09 18:06:10 +00:00
|
|
|
#if !UCONFIG_NO_CONVERSION
|
|
|
|
|
2006-02-06 18:03:11 +00:00
|
|
|
#include "inputext.h"
|
|
|
|
|
|
|
|
U_NAMESPACE_BEGIN
|
|
|
|
|
2012-06-01 20:40:48 +00:00
|
|
|
class CharsetMatch;
|
|
|
|
|
2006-02-06 18:03:11 +00:00
|
|
|
class CharsetRecognizer : public UMemory
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Get the IANA name of this charset.
|
2012-06-01 20:40:48 +00:00
|
|
|
* Note that some recognizers can recognize more than one charset, but that this API
|
|
|
|
* assumes just one name per recognizer.
|
|
|
|
* TODO: need to account for multiple names in public API that enumerates over the
|
|
|
|
* known detectable charsets.
|
2006-02-06 18:03:11 +00:00
|
|
|
* @return the charset name.
|
|
|
|
*/
|
|
|
|
virtual const char *getName() const = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the ISO language code for this charset.
|
|
|
|
* @return the language code, or <code>null</code> if the language cannot be determined.
|
|
|
|
*/
|
|
|
|
virtual const char *getLanguage() const;
|
|
|
|
|
2012-06-01 20:40:48 +00:00
|
|
|
/*
|
|
|
|
* Try the given input text against this Charset, and fill in the results object
|
|
|
|
* with the quality of the match plus other information related to the match.
|
|
|
|
*
|
|
|
|
* Return TRUE if the the input bytes are a potential match, and
|
|
|
|
* FALSE if the input data is not compatible with, or illegal in this charset.
|
|
|
|
*/
|
|
|
|
virtual UBool match(InputText *textIn, CharsetMatch *results) const = 0;
|
2006-02-06 18:03:11 +00:00
|
|
|
|
|
|
|
virtual ~CharsetRecognizer();
|
|
|
|
};
|
|
|
|
|
|
|
|
U_NAMESPACE_END
|
|
|
|
|
2006-05-09 18:06:10 +00:00
|
|
|
#endif
|
2006-02-06 18:03:11 +00:00
|
|
|
#endif /* __CSRECOG_H */
|