SASC
DVBSoftCAM

SI::String Class Reference

#include <si.h>

Inheritance diagram for SI::String:

List of all members.

Public Member Functions

char * getText ()
char * getText (char *buffer, int size)
char * getText (char *buffer, char *shortVersion, int sizeBuffer, int sizeShortVersion)

Protected Member Functions

virtual void Parse ()
void decodeText (char *buffer, int size)
void decodeText (char *buffer, char *shortVersion, int sizeBuffer, int sizeShortVersion)

Detailed Description

Definition at line 448 of file si.h.


Member Function Documentation

void SI::String::decodeText ( char *  buffer,
int  size 
) [protected]

Definition at line 249 of file si.c.

References SI::Object::data, SI::CharArray::getData(), SI::VariableLengthPart::getLength(), and i.

Referenced by getText().

                                              {
   const unsigned char *from=data.getData(0);
   char *to=buffer;

   /* Disable detection of coding tables - libdtv doesn't do it either
   if ( (0x01 <= *from) && (*from <= 0x1f) ) {
      codeTable=*from
   }
   */

   if (*from == 0x10)
      from += 3; // skips code table info

   int len=getLength();
   for (int i = 0; i < len; i++) {
      if (*from == 0)
         break;
      if (    ((' ' <= *from) && (*from <= '~'))
           || (*from == '\n')
           || (0xA0 <= *from)
           || (*from == 0x86 || *from == 0x87)
         )
         *to++ = *from;
      else if (*from == 0x8A)
         *to++ = '\n';
      from++;
      if (to - buffer >= size - 1)
         break;
   }
   *to = '\0';
}
void SI::String::decodeText ( char *  buffer,
char *  shortVersion,
int  sizeBuffer,
int  sizeShortVersion 
) [protected]

Definition at line 281 of file si.c.

References SI::Object::data, SI::CharArray::getData(), SI::VariableLengthPart::getLength(), and i.

                                                                                              {
   const unsigned char *from=data.getData(0);
   char *to=buffer;
   char *toShort=shortVersion;
   int IsShortName=0;

   if (*from == 0x10)
      from += 3; // skips code table info

   int len=getLength();
   for (int i = 0; i < len; i++) {
      if (    ((' ' <= *from) && (*from <= '~'))
           || (*from == '\n')
           || (0xA0 <= *from)
         )
      {
         *to++ = *from;
         if (IsShortName)
            *toShort++ = *from;
      }
      else if (*from == 0x8A)
         *to++ = '\n';
      else if (*from == 0x86)
         IsShortName++;
      else if (*from == 0x87)
         IsShortName--;
      else if (*from == 0)
         break;
      from++;
      if (to - buffer >= sizeBuffer - 1 || toShort - shortVersion >= sizeShortVersion - 1)
         break;
   }
   *to = '\0';
   *toShort = '\0';
}
char * SI::String::getText ( char *  buffer,
int  size 
)

Definition at line 224 of file si.c.

References decodeText(), and SI::VariableLengthPart::getLength().

                                            {
   int len=getLength();
   if (len < 0 || len >= size) {
      strncpy(buffer, "text error", size);
      buffer[size-1] = 0;
      return buffer;
   }
   decodeText(buffer, size);
   return buffer;
}
char * SI::String::getText ( )

Definition at line 215 of file si.c.

References SI::Object::data, decodeText(), and SI::VariableLengthPart::getLength().

Referenced by SI::ExtendedEventDescriptors::getText(), SI::ExtendedEventDescriptors::getTextItemized(), and SI::ExtendedEventDescriptors::getTextPlain().

                      {
   int len=getLength();
   if (len < 0 || len > 4095)
      return strdup("text error"); // caller will delete it!
   char *data=new char(len+1);
   decodeText(data, len+1);
   return data;
}
char * SI::String::getText ( char *  buffer,
char *  shortVersion,
int  sizeBuffer,
int  sizeShortVersion 
)

Definition at line 236 of file si.c.

References decodeText(), and SI::VariableLengthPart::getLength().

                                                                                            {
   int len=getLength();
   if (len < 0 || len >= sizeBuffer) {
      strncpy(buffer, "text error", sizeBuffer);
      buffer[sizeBuffer-1] = 0;
      *shortVersion = 0;
      return buffer;
   }
   decodeText(buffer, shortVersion, sizeBuffer, sizeShortVersion);
   return buffer;
}
virtual void SI::String::Parse ( ) [inline, protected, virtual]

Implements SI::Parsable.

Definition at line 471 of file si.h.

{}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines