SNAP Library 2.1, Developer Reference
2013-09-25 10:47:25
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
#include <unicode.h>
Public Member Functions | |
TSubcatHelper (TUniChDb &owner_) | |
void | ProcessComment (TUniChDb::TUcdFileReader &reader) |
void | SetCat (const int cp) |
void | TestCat (const int cp) |
~TSubcatHelper () | |
Public Attributes | |
bool | hasCat |
TUniChSubCategory | subCat |
TStrH | invalidCatCodes |
TUniChDb & | owner |
TUniChDb::TSubcatHelper::TSubcatHelper | ( | TUniChDb & | owner_ | ) | [inline] |
TUniChDb::TSubcatHelper::~TSubcatHelper | ( | ) | [inline] |
Definition at line 1754 of file unicode.h.
References TStr::CStr(), THash< TKey, TDat, THashFunc >::DelKey(), THash< TKey, TDat, THashFunc >::Empty(), THash< TKey, TDat, THashFunc >::FFirstKeyId(), THash< TKey, TDat, THashFunc >::FNextKeyId(), THash< TKey, TDat, THashFunc >::GetKey(), invalidCatCodes, and THash< TKey, TDat, THashFunc >::IsKey().
{ if (invalidCatCodes.IsKey("L&")) invalidCatCodes.DelKey("L&"); // Output any unexpected ones (there shouldn't be any). if (! invalidCatCodes.Empty()) { printf("Invalid cat code(s) in the comments: "); for (int i = invalidCatCodes.FFirstKeyId(); invalidCatCodes.FNextKeyId(i); ) printf(" \"%s\"", invalidCatCodes.GetKey(i).CStr()); printf("\n"); } }
void TUniChDb::TSubcatHelper::ProcessComment | ( | TUniChDb::TUcdFileReader & | reader | ) | [inline] |
Definition at line 1729 of file unicode.h.
References THash< TKey, TDat, THashFunc >::AddKey(), TUniChDb::TUcdFileReader::comment, hasCat, IAssert, invalidCatCodes, TUniChInfo::IsValidSubCat(), TChA::Len(), and subCat.
Referenced by TUniChDb::InitDerivedCoreProperties(), TUniChDb::InitPropList(), and TUniChDb::InitScripts().
{ hasCat = false; subCat = ucOtherNotAssigned; if (reader.comment.Len() > 3) { IAssert(reader.comment[0] == '#'); IAssert(reader.comment[1] == ' '); char chCat = reader.comment[2], chSubCat = reader.comment[3]; if (reader.comment.Len() > 4) IAssert(isspace(uchar(reader.comment[4]))); if (TUniChInfo::IsValidSubCat(chCat, chSubCat)) { hasCat = true; subCat = (TUniChSubCategory) ((int(uchar(chCat)) << 8) | (int(uchar(chSubCat)))); } else invalidCatCodes.AddKey(TStr(chCat) + TStr(chSubCat)); } }
void TUniChDb::TSubcatHelper::SetCat | ( | const int | cp | ) | [inline] |
Definition at line 1744 of file unicode.h.
References THash< TKey, TDat, THashFunc >::GetKeyId(), TUniChDb::h, hasCat, IAssert, owner, and subCat.
Referenced by TUniChDb::InitDerivedCoreProperties(), TUniChDb::InitPropList(), and TUniChDb::InitScripts().
{ int i = owner.h.GetKeyId(cp); IAssert(i >= 0); IAssert(owner.h[i].subCat == ucOtherNotAssigned); IAssert(hasCat); owner.h[i].SetCatAndSubCat(subCat); }
void TUniChDb::TSubcatHelper::TestCat | ( | const int | cp | ) | [inline] |
Definition at line 1749 of file unicode.h.
References THash< TKey, TDat, THashFunc >::GetKeyId(), TUniChDb::h, hasCat, IAssert, owner, and subCat.
Referenced by TUniChDb::InitDerivedCoreProperties(), TUniChDb::InitPropList(), and TUniChDb::InitScripts().
{ if (! hasCat) return; int i = owner.h.GetKeyId(cp); IAssert(i >= 0); IAssert(owner.h[i].subCat == subCat); }
Definition at line 1723 of file unicode.h.
Referenced by ProcessComment(), SetCat(), and TestCat().
Definition at line 1724 of file unicode.h.
Referenced by ProcessComment(), and ~TSubcatHelper().
Definition at line 1723 of file unicode.h.
Referenced by ProcessComment(), SetCat(), and TestCat().