SNAP Library 3.0, User Reference  2016-07-20 17:56:49
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TUniChDb::TSubcatHelper Class Reference

#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
 
TUniChDbowner
 

Detailed Description

Definition at line 1720 of file unicode.h.

Constructor & Destructor Documentation

TUniChDb::TSubcatHelper::TSubcatHelper ( TUniChDb owner_)
inline

Definition at line 1727 of file unicode.h.

1727 : owner(owner_) { }
TUniChDb::TSubcatHelper::~TSubcatHelper ( )
inline

Definition at line 1754 of file unicode.h.

1755  {
1756  if (invalidCatCodes.IsKey("L&")) invalidCatCodes.DelKey("L&");
1757  // Output any unexpected ones (there shouldn't be any).
1758  if (! invalidCatCodes.Empty()) {
1759  printf("Invalid cat code(s) in the comments: ");
1761  printf(" \"%s\"", invalidCatCodes.GetKey(i).CStr());
1762  printf("\n"); }
1763  }
bool Empty() const
Definition: hash.h:185
void DelKey(const TKey &Key)
Definition: hash.h:362
bool FNextKeyId(int &KeyId) const
Definition: hash.h:436
int FFirstKeyId() const
Definition: hash.h:236
char * CStr()
Definition: dt.h:476
bool IsKey(const TKey &Key) const
Definition: hash.h:216
const TKey & GetKey(const int &KeyId) const
Definition: hash.h:210

Member Function Documentation

void TUniChDb::TSubcatHelper::ProcessComment ( TUniChDb::TUcdFileReader reader)
inline

Definition at line 1729 of file unicode.h.

1730  {
1731  hasCat = false; subCat = ucOtherNotAssigned;
1732  if (reader.comment.Len() > 3)
1733  {
1734  IAssert(reader.comment[0] == '#');
1735  IAssert(reader.comment[1] == ' ');
1736  char chCat = reader.comment[2], chSubCat = reader.comment[3];
1737  if (reader.comment.Len() > 4) IAssert(isspace(uchar(reader.comment[4])));
1738  if (TUniChInfo::IsValidSubCat(chCat, chSubCat)) {
1739  hasCat = true; subCat = (TUniChSubCategory) ((int(uchar(chCat)) << 8) | (int(uchar(chSubCat)))); }
1740  else invalidCatCodes.AddKey(TStr(chCat) + TStr(chSubCat));
1741  }
1742  }
#define IAssert(Cond)
Definition: bd.h:262
enum TUniChSubCategory_ TUniChSubCategory
int Len() const
Definition: dt.h:259
static bool IsValidSubCat(const char chCat, const char chSubCat)
Definition: unicode.h:1164
unsigned char uchar
Definition: bd.h:10
int AddKey(const TKey &Key)
Definition: hash.h:331
TUniChSubCategory subCat
Definition: unicode.h:1723
Definition: dt.h:412
void TUniChDb::TSubcatHelper::SetCat ( const int  cp)
inline

Definition at line 1744 of file unicode.h.

1744  {
1745  int i = owner.h.GetKeyId(cp); IAssert(i >= 0);
1746  IAssert(owner.h[i].subCat == ucOtherNotAssigned);
1747  IAssert(hasCat);
1748  owner.h[i].SetCatAndSubCat(subCat); }
#define IAssert(Cond)
Definition: bd.h:262
THash< TInt, TUniChInfo > h
Definition: unicode.h:1263
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TUniChSubCategory subCat
Definition: unicode.h:1723
void TUniChDb::TSubcatHelper::TestCat ( const int  cp)
inline

Definition at line 1749 of file unicode.h.

1749  {
1750  if (! hasCat) return;
1751  int i = owner.h.GetKeyId(cp); IAssert(i >= 0);
1752  IAssert(owner.h[i].subCat == subCat); }
#define IAssert(Cond)
Definition: bd.h:262
THash< TInt, TUniChInfo > h
Definition: unicode.h:1263
int GetKeyId(const TKey &Key) const
Definition: hash.h:424
TUniChSubCategory subCat
Definition: unicode.h:1723

Member Data Documentation

bool TUniChDb::TSubcatHelper::hasCat

Definition at line 1723 of file unicode.h.

TStrH TUniChDb::TSubcatHelper::invalidCatCodes

Definition at line 1724 of file unicode.h.

TUniChDb& TUniChDb::TSubcatHelper::owner

Definition at line 1725 of file unicode.h.

TUniChSubCategory TUniChDb::TSubcatHelper::subCat

Definition at line 1723 of file unicode.h.


The documentation for this class was generated from the following file: