示例#1
0
void Lemmatizator::LoadString1( lem::CString *str, lem::Stream &bin, int compression )
{
 switch( char_size )
 {
  case 1:
  {
   if( compression==0 )
    {
     bin.read( str->ptr(), lem::CString::max_len );
     str->ptr()[lem::CString::max_len]=0;
    }
   else
    {
     lem::uint8_t len = bin.read_uint8();
     bin.read( str->ptr(), len );
     str->ptr()[len]=0;
    }
   
   str->calc_hash();

   break;
  }

  default:
  {
   LEM_STOPIT;
  }
 }
}
示例#2
0
void Lemmatizator::LoadEncodedString( UCString *str, lem::Stream &bin, int compression )
{
 switch( char_size )
 {
  case 1:
  {
   lem::uint8_t str8[ lem::CString::max_len+1 ];

   if( compression==0 )
    {
     bin.read( str8, lem::CString::max_len );
     str8[lem::CString::max_len]=0;

     int i=0;
     while( str8[i]!=0 )
      {
       str->ptr()[i] = i2wchar[str8[i]];
       ++i;
      }

     str->ptr()[i]=0;
    }
   else
    {
     lem::uint8_t len = bin.read_uint8();
     bin.read( str8, len );
     str8[len]=0;

     for( int i=0; i<len; ++i )
      {
       str->ptr()[i] = i2wchar[str8[i]];
      }

     str->ptr()[len]=0;
    }
   
   str->calc_hash();

   break;
  }

  default:
  {
   LEM_STOPIT;
  }
 }
}