|
SNAP Library , Developer Reference
2013-01-07 14:03:36
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
#include <unicode.h>

Public Member Functions | |
| TUcdFileReader () | |
| TUcdFileReader (const TStr &fileName) | |
| void | Open (const TStr &fileName) |
| void | Close () |
| ~TUcdFileReader () | |
| bool | GetNextLine (TStrV &dest) |
Static Public Member Functions | |
| static int | ParseCodePoint (const TStr &s) |
| static void | ParseCodePointList (const TStr &s, TIntV &dest, bool ClrDestP=true) |
| static void | ParseCodePointRange (const TStr &s, int &from, int &to) |
Public Attributes | |
| TChA | comment |
Protected Member Functions | |
| int | GetCh () |
| void | PutBack (int c) |
| bool | ReadNextLine () |
Protected Attributes | |
| TChA | buf |
| FILE * | f |
| int | putBackCh |
Private Member Functions | |
| TUcdFileReader & | operator= (const TUcdFileReader &r) |
| TUcdFileReader (const TUcdFileReader &r) | |
| TUniChDb::TUcdFileReader::TUcdFileReader | ( | const TUcdFileReader & | r | ) | [inline, private] |
| TUniChDb::TUcdFileReader::TUcdFileReader | ( | ) | [inline] |
| TUniChDb::TUcdFileReader::TUcdFileReader | ( | const TStr & | fileName | ) | [inline] |
| TUniChDb::TUcdFileReader::~TUcdFileReader | ( | ) | [inline] |
| void TUniChDb::TUcdFileReader::Close | ( | ) | [inline] |
Definition at line 1683 of file unicode.h.
Referenced by TUniChDb::InitDerivedCoreProperties(), TUniChDb::InitLineBreaks(), TUniChDb::InitPropList(), TUniChDb::InitScripts(), TUniChDb::InitSpecialCasing(), TUniChDb::InitWordAndSentenceBoundaryFlags(), TUniChDb::LoadTxt(), Open(), TUniChDb::TestComposition(), TUniChDb::TestFindNextWordOrSentenceBoundary(), and ~TUcdFileReader().

| int TUniChDb::TUcdFileReader::GetCh | ( | ) | [inline, protected] |
| bool TUniChDb::TUcdFileReader::GetNextLine | ( | TStrV & | dest | ) | [inline] |
Definition at line 1685 of file unicode.h.
References buf, TVec< TVal >::Clr(), TVec< TVal >::Len(), TStr::Len(), ReadNextLine(), TStr::SplitOnAllCh(), and TStr::ToTrunc().
Referenced by TUniChDb::InitDerivedCoreProperties(), TUniChDb::InitLineBreaks(), TUniChDb::InitPropList(), TUniChDb::InitScripts(), TUniChDb::InitSpecialCasing(), TUniChDb::InitWordAndSentenceBoundaryFlags(), TUniCaseFolding::LoadTxt(), TUniChDb::LoadTxt(), TUniChDb::TestComposition(), and TUniChDb::TestFindNextWordOrSentenceBoundary().
{
dest.Clr();
while (true) {
if (! ReadNextLine()) return false;
TStr line = buf; line.ToTrunc();
if (line.Len() <= 0) continue;
line.SplitOnAllCh(';', dest, false);
for (int i = 0; i < dest.Len(); i++) dest[i].ToTrunc();
return true; }}


| void TUniChDb::TUcdFileReader::Open | ( | const TStr & | fileName | ) | [inline] |
Definition at line 1682 of file unicode.h.
References Close(), TStr::CStr(), f, IAssertR, and putBackCh.
Referenced by TUniChDb::InitDerivedCoreProperties(), TUniChDb::InitLineBreaks(), TUniChDb::InitPropList(), TUniChDb::InitScripts(), TUniChDb::InitSpecialCasing(), TUniChDb::InitWordAndSentenceBoundaryFlags(), TUniCaseFolding::LoadTxt(), TUniChDb::LoadTxt(), TUniChDb::TestComposition(), TUniChDb::TestFindNextWordOrSentenceBoundary(), and TUcdFileReader().


| TUcdFileReader& TUniChDb::TUcdFileReader::operator= | ( | const TUcdFileReader & | r | ) | [inline, private] |
Definition at line 1677 of file unicode.h.
References Fail.
{ Fail; return *((TUcdFileReader *) 0); }
| static int TUniChDb::TUcdFileReader::ParseCodePoint | ( | const TStr & | s | ) | [inline, static] |
Definition at line 1694 of file unicode.h.
References IAssertR, and TStr::IsHexInt().
Referenced by TUniChDb::InitSpecialCasing(), TUniCaseFolding::LoadTxt(), TUniChDb::LoadTxt(), ParseCodePointRange(), and TUniChDb::TestFindNextWordOrSentenceBoundary().


| static void TUniChDb::TUcdFileReader::ParseCodePointList | ( | const TStr & | s, |
| TIntV & | dest, | ||
| bool | ClrDestP = true |
||
| ) | [inline, static] |
Definition at line 1696 of file unicode.h.
References TVec< TVal >::Add(), TVec< TVal >::Clr(), IAssertR, TVec< TVal >::Len(), and TStr::SplitOnWs().
Referenced by TUniChDb::InitSpecialCasing(), TUniCaseFolding::LoadTxt(), TUniChDb::LoadTxt_ProcessDecomposition(), TUniChDb::TestCaseConversion(), and TUniChDb::TestComposition().
{ // space-separated list
if (ClrDestP) dest.Clr();
TStrV parts; s.SplitOnWs(parts);
for (int i = 0; i < parts.Len(); i++) {
int c; bool ok = parts[i].IsHexInt(true, 0, 0x10ffff, c); IAssertR(ok, s);
dest.Add(c); } }


| static void TUniChDb::TUcdFileReader::ParseCodePointRange | ( | const TStr & | s, |
| int & | from, | ||
| int & | to | ||
| ) | [inline, static] |
Definition at line 1702 of file unicode.h.
References TStr::GetSubStr(), TStr::Len(), ParseCodePoint(), and TStr::SearchStr().
Referenced by TUniChDb::InitDerivedCoreProperties(), TUniChDb::InitLineBreaks(), TUniChDb::InitPropList(), TUniChDb::InitScripts(), and TUniChDb::InitWordAndSentenceBoundaryFlags().
{ // xxxx or xxxx..yyyy
int i = s.SearchStr(".."); if (i < 0) { from = ParseCodePoint(s); to = from; return; }
from = ParseCodePoint(s.GetSubStr(0, i - 1));
to = ParseCodePoint(s.GetSubStr(i + 2, s.Len() - 1)); }


| void TUniChDb::TUcdFileReader::PutBack | ( | int | c | ) | [inline, protected] |
| bool TUniChDb::TUcdFileReader::ReadNextLine | ( | ) | [inline, protected] |
Definition at line 1662 of file unicode.h.
References buf, TChA::Clr(), comment, GetCh(), and PutBack().
Referenced by GetNextLine().
{
buf.Clr(); comment.Clr();
bool inComment = false, first = true;
while (true) {
int c = GetCh();
if (c == EOF) return ! first;
else if (c == 13) {
c = GetCh(); if (c != 10) PutBack(c);
return true; }
else if (c == 10) return true;
else if (c == '#') inComment = true;
if (! inComment) buf += char(c);
else comment += char(c); }
/*first = false;*/}


TChA TUniChDb::TUcdFileReader::buf [protected] |
Definition at line 1651 of file unicode.h.
Referenced by GetNextLine(), and ReadNextLine().
Definition at line 1653 of file unicode.h.
Referenced by TUniChDb::TSubcatHelper::ProcessComment(), and ReadNextLine().
FILE* TUniChDb::TUcdFileReader::f [protected] |
int TUniChDb::TUcdFileReader::putBackCh [protected] |