| 
    SNAP Library 2.0, Developer Reference
    2013-05-13 16:33:57
    
   SNAP, a general purpose, high performance system for analysis and manipulation of large networks 
   | 
  
  
  
 
#include <unicode.h>
Public Types | |
| typedef TEncoding_ | TEncoding | 
Public Member Functions | |
| T8BitCodec () | |
| T8BitCodec (TUnicodeErrorHandling errorHandling_, int replacementChar_=TUniCodec::DefaultReplacementChar) | |
| void | Test () const | 
| template<typename TSrcVec , typename TDestCh > | |
| size_t | ToUnicode (const TSrcVec &src, size_t srcIdx, const size_t srcCount, TVec< TDestCh > &dest, const bool clrDest=true) const | 
| template<typename TSrcVec , typename TDestCh > | |
| size_t | ToUnicode (const TSrcVec &src, TVec< TDestCh > &dest, const bool clrDest=true) const | 
| size_t | ToUnicode (const TIntV &src, TIntV &dest, const bool clrDest=true) const | 
| size_t | ToUnicode (const TStr &src, TIntV &dest, const bool clrDest=true) const | 
| template<typename TSrcVec , typename TDestVec > | |
| size_t | FromUnicode (const TSrcVec &src, size_t srcIdx, const size_t srcCount, TDestVec &dest, const bool clrDest=true) const | 
| template<typename TSrcVec , typename TDestVec > | |
| size_t | FromUnicode (const TSrcVec &src, TDestVec &dest, const bool clrDest=true) const | 
| size_t | UniToStr (const TIntV &src, size_t srcIdx, const size_t srcCount, TStr &dest, const bool clrDest=true) const | 
| size_t | UniToStr (const TIntV &src, TStr &dest, const bool clrDest=true) const | 
Static Public Member Functions | |
| static TStr | GetName () | 
Public Attributes | |
| TUnicodeErrorHandling | errorHandling | 
| int | replacementChar | 
Protected Types | |
| typedef TUniVecIdx | TVecIdx | 
| typedef TEncoding_ T8BitCodec< TEncoding_ >::TEncoding | 
typedef TUniVecIdx T8BitCodec< TEncoding_ >::TVecIdx [protected] | 
        
| T8BitCodec< TEncoding_ >::T8BitCodec | ( | ) |  [inline] | 
        
| T8BitCodec< TEncoding_ >::T8BitCodec | ( | TUnicodeErrorHandling | errorHandling_, | 
| int | replacementChar_ = TUniCodec::DefaultReplacementChar  | 
        ||
| ) |  [inline] | 
        
Definition at line 571 of file unicode.h.
                                                                                                                 :
                errorHandling(errorHandling_), replacementChar(replacementChar_) { }
| size_t T8BitCodec< TEncoding_ >::FromUnicode | ( | const TSrcVec & | src, | 
| size_t | srcIdx, | ||
| const size_t | srcCount, | ||
| TDestVec & | dest, | ||
| const bool | clrDest = true  | 
        ||
| ) |  const [inline] | 
        
Definition at line 618 of file unicode.h.
Referenced by T8BitCodec< TEncoding_ISO8859_3 >::FromUnicode(), T8BitCodec< TEncoding_ISO8859_3 >::Test(), and T8BitCodec< TEncoding_ISO8859_3 >::UniToStr().
        {
                typedef typename TVecElt<TDestVec>::TElement TDestCh;
                if (clrDest) dest.Clr();
                size_t toDo = srcCount, nEncoded = 0;
                while (toDo-- > 0) {
                        int chSrc = (int) src[TVecIdx(srcIdx)]; srcIdx++;
                        int chDest = TEncoding::FromUnicode(chSrc);
                        if (chDest < 0) {
                                switch (errorHandling) {
                                case uehThrow: throw TUnicodeException(srcIdx - 1, chSrc, "Invalid character for encoding into " + GetName() + ".");
                                case uehAbort: return nEncoded;
                                case uehReplace: TVecElt<TDestVec>::Add(dest, TDestCh(replacementChar)); continue;
                                case uehIgnore: continue;
                                default: Fail; } }
                        TVecElt<TDestVec>::Add(dest, TDestCh(chDest)); nEncoded++; }
                return nEncoded;
        }

| size_t T8BitCodec< TEncoding_ >::FromUnicode | ( | const TSrcVec & | src, | 
| TDestVec & | dest, | ||
| const bool | clrDest = true  | 
        ||
| ) |  const [inline] | 
        
Definition at line 640 of file unicode.h.
Referenced by T8BitCodec< TEncoding_ISO8859_3 >::FromUnicode().
{ return FromUnicode(src, 0, src.Len(), dest, clrDest); }

| static TStr T8BitCodec< TEncoding_ >::GetName | ( | ) |  [inline, static] | 
        
Definition at line 573 of file unicode.h.
Referenced by T8BitCodec< TEncoding_ISO8859_3 >::FromUnicode(), and T8BitCodec< TEncoding_ISO8859_3 >::GetName().
{ return TEncoding::GetName(); }

| void T8BitCodec< TEncoding_ >::Test | ( | ) |  const [inline] | 
        
Definition at line 575 of file unicode.h.
        {
                int nDecoded = 0;
                for (int c = 0; c <= 255; c++) {
                        int cu = TEncoding::ToUnicode(c); if (cu == -1) continue;
                        nDecoded++;
                        IAssert(0 <= cu && cu < 0x110000);
                        int c2 = TEncoding::FromUnicode(cu);
                        IAssert(c2 == c); }
                int nEncoded = 0;
                for (int cu = 0; cu < 0x110000; cu++) {
                        int c = TEncoding::FromUnicode(cu); if (c == -1) continue;
                        nEncoded++;
                        IAssert(0 <= c && c <= 255);
                        int cu2 = TEncoding::ToUnicode(c);
                        IAssert(cu2 == cu); }
                IAssert(nDecoded == nEncoded);
        }
| size_t T8BitCodec< TEncoding_ >::ToUnicode | ( | const TSrcVec & | src, | 
| size_t | srcIdx, | ||
| const size_t | srcCount, | ||
| TVec< TDestCh > & | dest, | ||
| const bool | clrDest = true  | 
        ||
| ) |  const [inline] | 
        
Definition at line 597 of file unicode.h.
Referenced by T8BitCodec< TEncoding_ISO8859_3 >::Test(), and T8BitCodec< TEncoding_ISO8859_3 >::ToUnicode().
        {
                if (clrDest) dest.Clr();
                size_t toDo = srcCount;
                while (toDo-- > 0) {
                        int chSrc = ((int) src[TVecIdx(srcIdx)]) & 0xff; srcIdx++;
                        int chDest = TEncoding::ToUnicode(chSrc);
                        dest.Add(chDest); }
                return srcCount;
        }

| size_t T8BitCodec< TEncoding_ >::ToUnicode | ( | const TSrcVec & | src, | 
| TVec< TDestCh > & | dest, | ||
| const bool | clrDest = true  | 
        ||
| ) |  const [inline] | 
        
Definition at line 610 of file unicode.h.
Referenced by T8BitCodec< TEncoding_ISO8859_3 >::ToUnicode().
{ return ToUnicode(src, 0, src.Len(), dest, clrDest); }

| size_t T8BitCodec< TEncoding_ >::ToUnicode | ( | const TIntV & | src, | 
| TIntV & | dest, | ||
| const bool | clrDest = true  | 
        ||
| ) |  const [inline] | 
        
Definition at line 612 of file unicode.h.
Referenced by T8BitCodec< TEncoding_ISO8859_3 >::ToUnicode().

| size_t T8BitCodec< TEncoding_ >::ToUnicode | ( | const TStr & | src, | 
| TIntV & | dest, | ||
| const bool | clrDest = true  | 
        ||
| ) |  const [inline] | 
        
Definition at line 613 of file unicode.h.
Referenced by T8BitCodec< TEncoding_ISO8859_3 >::ToUnicode().

| size_t T8BitCodec< TEncoding_ >::UniToStr | ( | const TIntV & | src, | 
| size_t | srcIdx, | ||
| const size_t | srcCount, | ||
| TStr & | dest, | ||
| const bool | clrDest = true  | 
        ||
| ) |  const [inline] | 
        
| size_t T8BitCodec< TEncoding_ >::UniToStr | ( | const TIntV & | src, | 
| TStr & | dest, | ||
| const bool | clrDest = true  | 
        ||
| ) |  const [inline] | 
        
Definition at line 646 of file unicode.h.
Referenced by T8BitCodec< TEncoding_ISO8859_3 >::UniToStr().

| TUnicodeErrorHandling T8BitCodec< TEncoding_ >::errorHandling | 
Definition at line 567 of file unicode.h.
Referenced by T8BitCodec< TEncoding_ISO8859_3 >::FromUnicode().
| int T8BitCodec< TEncoding_ >::replacementChar | 
Definition at line 568 of file unicode.h.
Referenced by T8BitCodec< TEncoding_ISO8859_3 >::FromUnicode().