FONTAINE 1.0
|
00001 // 00002 // The Fontaine Font Analysis Project 00003 // 00004 // Copyright (c) 2009 by Edward H. Trager 00005 // All Rights Reserved 00006 // 00007 // Released under the GNU GPL version 2.0 or later. 00008 // 00009 00010 00011 // 00012 // OrthographyAnalysis 00013 // 00014 #ifndef ORTHOGRAPHY_RESULTS 00015 #define ORTHOGRAPHY_RESULTS 00016 00017 #include <string> 00018 #include <set> 00019 #include <vector> 00020 00021 #include "OrthographyData.h" 00022 00023 #include "Utf8String.h" 00024 #include <string.h> 00025 00026 class OrthographyResults{ 00027 00028 public: 00029 00030 enum SUPPORTLEVEL { UNSUPPORTED=0, FRAGMENTARY, PARTIAL, FULL }; 00031 // 00032 // Minimum allowable coverage to be considered 00033 // as having "partial support": 00034 // 00035 const static int minCoverage=80; 00036 00037 // 00038 // Comparison Functor: 00039 // 00040 struct compare{ 00041 bool operator()(const OrthographyResults *o1,const OrthographyResults *o2) const{ 00042 00043 return strcmp(o1->_pData->commonName,o2->_pData->commonName) < 0; 00044 00045 } 00046 }; 00047 00048 private: 00049 00050 const OrthographyData *_pData; 00051 00052 UINT32 _hits; 00053 UINT32 _tries; 00054 SUPPORTLEVEL _supportLevel; 00055 00056 std::vector<UTF32> _missingValues; 00057 00058 // Report missing state flag: 00059 bool _reportMissing; 00060 00061 public: 00062 00063 // 00064 // Constructors: 00065 // 00066 OrthographyResults(const OrthographyData *pData,UINT32 hits,UINT32 tries,std::vector<UTF32> &missing); 00067 OrthographyResults(const OrthographyData *pData,UINT32 hits, UINT32 tries); 00068 00069 // 00070 // Destructor 00071 // 00072 ~OrthographyResults(); 00073 00074 UINT32 getHits(void) const; 00075 UINT32 getTries(void) const; 00076 int getPercentCoverage(void) const; 00077 SUPPORTLEVEL getSupportLevel(void) const; 00078 const char * getSupportLevelAsCString(void) const; 00079 const char* getCommonName(void) const; 00080 const char* getNativeName(void) const; 00081 const char* getSampleCharacters(void) const; 00082 const char* getSampleSentence(int nth) const; 00083 std::string getMissingValuesAsString(void) const; 00084 00085 std::string getReport(bool reportMissing) const; 00086 00087 void setReportOnMissing(bool x); 00088 00089 private: 00090 00091 const char* UTF32ValueToUTF8( UTF32 UTF32Value ) const; 00092 00093 }; 00094 00095 #endif