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
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TUniChDb::TSubcatHelper Class Reference

#include <unicode.h>

Collaboration diagram for TUniChDb::TSubcatHelper:

List of all members.

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

Definition at line 1727 of file unicode.h.

: owner(owner_) { }

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"); }
                }

Here is the call graph for this function:


Member Function Documentation

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));
                        }
                }

Here is the call graph for this function:

Here is the caller graph for this function:

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); }

Here is the call graph for this function:

Here is the caller graph for this function:

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); }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 1723 of file unicode.h.

Referenced by ProcessComment(), SetCat(), and TestCat().

Definition at line 1725 of file unicode.h.

Referenced by SetCat(), and TestCat().


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