SNAP Library 2.0, User Reference
2013-05-13 16:33:57
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
#include <unicodestring.h>
Public Member Functions | |
TUStr () | |
TUStr (const TUStr &UStr) | |
TUStr (const TIntV &_UniChV) | |
TUStr (const TStr &Str) | |
~TUStr () | |
TUStr (TSIn &SIn) | |
void | Save (TSOut &SOut) const |
void | LoadXml (const PXmlTok &XmlTok, const TStr &Nm) |
void | SaveXml (TSOut &SOut, const TStr &Nm) const |
TUStr & | operator= (const TUStr &UStr) |
bool | operator== (const TUStr &UStr) const |
TUStr & | operator+= (const TUStr &UStr) |
int | operator[] (const int &UniChN) const |
void | Clr () |
int | Len () const |
bool | Empty () const |
void | ToLowerCase () |
void | ToUpperCase () |
void | ToStarterCase () |
void | GetWordBoundPV (TBoolV &WordBoundPV) |
void | GetWordUStrV (TUStrV &UStrV) |
TStr | GetStr () const |
TStr | GetStarterStr () const |
TStr | GetStarterLowerCaseStr () const |
Static Public Member Functions | |
static int | GetScriptId (const TStr &ScriptNm) |
static TStr | GetScriptNm (const int &ScriptId) |
static int | GetChScriptId (const int &UniCh) |
static TStr | GetChScriptNm (const int &UniCh) |
static TStr | GetChNm (const int &UniCh) |
static TStr | GetChTypeStr (const int &UniCh) |
static bool | IsCase (const int &UniCh) |
static bool | IsUpperCase (const int &UniCh) |
static bool | IsLowerCase (const int &UniCh) |
static bool | IsAlphabetic (const int &UniCh) |
static bool | IsMath (const int &UniCh) |
static TStr | EncodeUtf8 (const int &UniCh) |
Static Private Member Functions | |
static void | AssertUnicodeDefOk () |
Private Attributes | |
TIntV | UniChV |
Definition at line 32 of file unicodestring.h.
TUStr::TUStr | ( | ) | [inline] |
Definition at line 38 of file unicodestring.h.
: UniChV(){AssertUnicodeDefOk();}
TUStr::TUStr | ( | const TUStr & | UStr | ) | [inline] |
Definition at line 39 of file unicodestring.h.
: UniChV(UStr.UniChV){AssertUnicodeDefOk();}
TUStr::TUStr | ( | const TIntV & | _UniChV | ) | [inline] |
Definition at line 40 of file unicodestring.h.
: UniChV(_UniChV){AssertUnicodeDefOk();}
TUStr::TUStr | ( | const TStr & | Str | ) |
Definition at line 12 of file unicodestring.cpp.
{ AssertUnicodeDefOk(); TUnicodeDef::GetDef()->DecodeUtf8(Str, UniChV); TIntV NfcUniChV; TUnicodeDef::GetDef()->Decompose(UniChV, NfcUniChV, true); UniChV=NfcUniChV; }
TUStr::~TUStr | ( | ) | [inline] |
Definition at line 42 of file unicodestring.h.
{}
TUStr::TUStr | ( | TSIn & | SIn | ) | [inline] |
Definition at line 43 of file unicodestring.h.
: UniChV(SIn){AssertUnicodeDefOk();}
static void TUStr::AssertUnicodeDefOk | ( | ) | [inline, static, private] |
Definition at line 35 of file unicodestring.h.
{ EAssertR(TUnicodeDef::IsDef(), "Unicode-Definition-File not loaded!");}
void TUStr::Clr | ( | ) | [inline] |
Definition at line 56 of file unicodestring.h.
bool TUStr::Empty | ( | ) | const [inline] |
Definition at line 58 of file unicodestring.h.
TStr TUStr::EncodeUtf8 | ( | const int & | UniCh | ) | [static] |
Definition at line 157 of file unicodestring.cpp.
{ AssertUnicodeDefOk(); return TUnicodeDef::GetDef()->EncodeUtf8Str(TIntV::GetV(UniCh)); }
TStr TUStr::GetChNm | ( | const int & | UniCh | ) | [static] |
Definition at line 104 of file unicodestring.cpp.
{ TStr UniChNm(TUnicodeDef::GetDef()->ucd.GetCharNameS(UniCh)); return UniChNm; }
int TUStr::GetChScriptId | ( | const int & | UniCh | ) | [static] |
Definition at line 96 of file unicodestring.cpp.
{ return TUnicodeDef::GetDef()->ucd.GetScript(UniCh); }
TStr TUStr::GetChScriptNm | ( | const int & | UniCh | ) | [static] |
Definition at line 100 of file unicodestring.cpp.
{ return GetScriptNm(GetChScriptId(UniCh)); }
TStr TUStr::GetChTypeStr | ( | const int & | UniCh | ) | [static] |
Definition at line 109 of file unicodestring.cpp.
{ TChA ChTypeChA; ChTypeChA+='['; if (IsCase(UniCh)){ChTypeChA+="Case,";} if (IsUpperCase(UniCh)){ChTypeChA+="UpperCase,";} if (IsLowerCase(UniCh)){ChTypeChA+="LowerCase,";} if (IsAlphabetic(UniCh)){ChTypeChA+="Alphabetic,";} if (IsMath(UniCh)){ChTypeChA+="Math,";} if (ChTypeChA.LastCh()=='['){ChTypeChA+=']';} else {ChTypeChA[ChTypeChA.Len()-1]=']';} return ChTypeChA; }
int TUStr::GetScriptId | ( | const TStr & | ScriptNm | ) | [static] |
Definition at line 88 of file unicodestring.cpp.
{ return TUnicodeDef::GetDef()->ucd.GetScriptByName(ScriptNm); }
TStr TUStr::GetScriptNm | ( | const int & | ScriptId | ) | [static] |
Definition at line 92 of file unicodestring.cpp.
{ return TUnicodeDef::GetDef()->ucd.GetScriptName(ScriptId); }
TStr TUStr::GetStarterLowerCaseStr | ( | ) | const |
Definition at line 79 of file unicodestring.cpp.
{ TIntV UniChV1; TIntV UniChV2; TIntV UniChV3; TUnicodeDef::GetDef()->GetSimpleLowerCase(UniChV, UniChV1); TUnicodeDef::GetDef()->ExtractStarters(UniChV1, UniChV2); TUnicodeDef::GetDef()->Decompose(UniChV2, UniChV3, true); TStr Str=TUnicodeDef::GetDef()->EncodeUtf8Str(UniChV3); return Str; }
TStr TUStr::GetStarterStr | ( | ) | const |
Definition at line 71 of file unicodestring.cpp.
{ TIntV UniChV1; TIntV UniChV2; TUnicodeDef::GetDef()->ExtractStarters(UniChV, UniChV1); TUnicodeDef::GetDef()->Decompose(UniChV1, UniChV2, true); TStr Str=TUnicodeDef::GetDef()->EncodeUtf8Str(UniChV2); return Str; }
TStr TUStr::GetStr | ( | ) | const |
Definition at line 66 of file unicodestring.cpp.
{ TStr Str=TUnicodeDef::GetDef()->EncodeUtf8Str(UniChV); return Str; }
void TUStr::GetWordBoundPV | ( | TBoolV & | WordBoundPV | ) |
Definition at line 33 of file unicodestring.cpp.
{ TUnicodeDef::GetDef()->FindWordBoundaries(UniChV, WordBoundPV); }
void TUStr::GetWordUStrV | ( | TUStrV & | UStrV | ) |
Definition at line 37 of file unicodestring.cpp.
{ // clear word vector WordUStrV.Clr(); // create boundaries TBoolV WordBoundPV; GetWordBoundPV(WordBoundPV); IAssert(Len()==WordBoundPV.Len()-1); IAssert((WordBoundPV.Len()>0)&&(WordBoundPV.Last())); // traverse characters and bounds int UniChs=Len(); TIntV WordUniChV; for (int UniChN=0; UniChN<=UniChs; UniChN++){ if ((UniChN==UniChs)||(WordBoundPV[UniChN+1])){ // finish or word-boundary if (UniChN<UniChs){ // if not finish // if last-word-char or single-alphabetic-char if ((!WordUniChV.Empty())||(IsAlphabetic(UniChV[UniChN]))){ WordUniChV.Add(UniChV[UniChN]); // add char } } if (!WordUniChV.Empty()){ // add current word to vector TUStr WordUStr(WordUniChV); // construct word from char-vector WordUStrV.Add(WordUStr); // add word to word-vector WordUniChV.Clr(false); // clear char-vector } } else { // add character to char-vector WordUniChV.Add(UniChV[UniChN]); } } }
bool TUStr::IsAlphabetic | ( | const int & | UniCh | ) | [static] |
Definition at line 143 of file unicodestring.cpp.
{ TUniChInfo ChInfo; if (TUnicodeDef::GetDef()->ucd.IsGetChInfo(UniCh, ChInfo)){ return ChInfo.IsAlphabetic();} else {return false;} }
bool TUStr::IsCase | ( | const int & | UniCh | ) | [static] |
Definition at line 122 of file unicodestring.cpp.
{ TUniChInfo ChInfo; if (TUnicodeDef::GetDef()->ucd.IsGetChInfo(UniCh, ChInfo)){ return ChInfo.IsCased();} else {return false;} }
bool TUStr::IsLowerCase | ( | const int & | UniCh | ) | [static] |
Definition at line 136 of file unicodestring.cpp.
{ TUniChInfo ChInfo; if (TUnicodeDef::GetDef()->ucd.IsGetChInfo(UniCh, ChInfo)){ return ChInfo.IsLowercase();} else {return false;} }
bool TUStr::IsMath | ( | const int & | UniCh | ) | [static] |
Definition at line 150 of file unicodestring.cpp.
{ TUniChInfo ChInfo; if (TUnicodeDef::GetDef()->ucd.IsGetChInfo(UniCh, ChInfo)){ return ChInfo.IsMath();} else {return false;} }
bool TUStr::IsUpperCase | ( | const int & | UniCh | ) | [static] |
Definition at line 129 of file unicodestring.cpp.
{ TUniChInfo ChInfo; if (TUnicodeDef::GetDef()->ucd.IsGetChInfo(UniCh, ChInfo)){ return ChInfo.IsUppercase();} else {return false;} }
int TUStr::Len | ( | ) | const [inline] |
Definition at line 57 of file unicodestring.h.
void TUStr::LoadXml | ( | const PXmlTok & | XmlTok, |
const TStr & | Nm | ||
) |
Definition at line 52 of file unicodestring.h.
Definition at line 48 of file unicodestring.h.
bool TUStr::operator== | ( | const TUStr & | UStr | ) | const [inline] |
Definition at line 50 of file unicodestring.h.
int TUStr::operator[] | ( | const int & | UniChN | ) | const [inline] |
Definition at line 53 of file unicodestring.h.
{return UniChV[UniChN];}
void TUStr::Save | ( | TSOut & | SOut | ) | const [inline] |
Definition at line 44 of file unicodestring.h.
void TUStr::SaveXml | ( | TSOut & | SOut, |
const TStr & | Nm | ||
) | const |
void TUStr::ToLowerCase | ( | ) |
Definition at line 19 of file unicodestring.cpp.
{ TUnicodeDef::GetDef()->ToSimpleLowerCase(UniChV); }
void TUStr::ToStarterCase | ( | ) |
Definition at line 27 of file unicodestring.cpp.
{ TIntV StarterUniChV; TUnicodeDef::GetDef()->ExtractStarters(UniChV, StarterUniChV); TUnicodeDef::GetDef()->Decompose(StarterUniChV, UniChV, true); }
void TUStr::ToUpperCase | ( | ) |
Definition at line 23 of file unicodestring.cpp.
{ TUnicodeDef::GetDef()->ToSimpleUpperCase(UniChV); }
TIntV TUStr::UniChV [private] |
Definition at line 34 of file unicodestring.h.