SASC
DVBSoftCAM

SI::DescriptorLoop Class Reference

#include <si.h>

Inheritance diagram for SI::DescriptorLoop:

List of all members.

Public Member Functions

 DescriptorLoop ()
Descriptor * getNext (Iterator &it)
Descriptor * getNext (Iterator &it, DescriptorTag tag, bool returnUnimplemetedDescriptor=false)
Descriptor * getNext (Iterator &it, DescriptorTag *tags, int arrayLength, bool returnUnimplemetedDescriptor=false)
int getNumberOfDescriptors ()
template<typename T >
int getDescriptorTags (T *tags)

Protected Member Functions

Descriptor * createDescriptor (int &i, bool returnUnimplemetedDescriptor)

Protected Attributes

DescriptorTagDomain domain

Detailed Description

Definition at line 331 of file si.h.


Constructor & Destructor Documentation

SI::DescriptorLoop::DescriptorLoop ( ) [inline]

Definition at line 333 of file si.h.

References domain, and SI::SI.

{ domain=SI; }

Member Function Documentation

Descriptor * SI::DescriptorLoop::createDescriptor ( int &  i,
bool  returnUnimplemetedDescriptor 
) [protected]

Definition at line 155 of file si.c.

References SI::Parsable::CheckParse(), SI::Object::checkSize(), SI::Object::data, domain, SI::CharArray::getData(), SI::Descriptor::getDescriptor(), and SI::Descriptor::getLength().

Referenced by getNext().

                                                                                      {
   if (!checkSize(Descriptor::getLength(data.getData(i))))
      return 0;
   Descriptor *d=Descriptor::getDescriptor(data+i, domain, returnUnimplemetedDescriptor);
   if (!d)
      return 0;
   i+=d->getLength();
   d->CheckParse();
   return d;
}
template<typename T >
int SI::DescriptorLoop::getDescriptorTags ( T *  tags) [inline]

Definition at line 366 of file si.h.

References count, SI::Object::data, SI::CharArray::getData(), SI::Descriptor::getDescriptorTag(), and SI::VariableLengthPart::getLength().

      {
         const unsigned char *p=data.getData();
         const unsigned char *end=p+getLength();
         int count=0;
         while (p < end) {
            tags[count++]=(T)Descriptor::getDescriptorTag(p);
            p+=Descriptor::getLength(p);
         }
         return count;
      }
Descriptor * SI::DescriptorLoop::getNext ( Iterator &  it,
DescriptorTag  tag,
bool  returnUnimplemetedDescriptor = false 
)

Definition at line 115 of file si.c.

References createDescriptor(), SI::Object::data, SI::CharArray::getData(), SI::Descriptor::getDescriptorTag(), SI::VariableLengthPart::getLength(), and SI::Object::isValid().

                                                                                                      {
   Descriptor *d=0;
   int len;
   if (isValid() && it.i<(len=getLength())) {
      const unsigned char *p=data.getData(it.i);
      const unsigned char *end=p+len-it.i;
      while (p < end) {
         if (Descriptor::getDescriptorTag(p) == tag) {
            d=createDescriptor(it.i, returnUnimplemetedDescriptor);
            if (d)
               break;
         }
         it.i+=Descriptor::getLength(p);
         p+=Descriptor::getLength(p);
      }
   }
   return d;
}
Descriptor * SI::DescriptorLoop::getNext ( Iterator &  it)

Definition at line 108 of file si.c.

References createDescriptor(), SI::VariableLengthPart::getLength(), and SI::Object::isValid().

                                                {
   if (isValid() && it.i<getLength()) {
      return createDescriptor(it.i, true);
   }
   return 0;
}
Descriptor * SI::DescriptorLoop::getNext ( Iterator &  it,
DescriptorTag *  tags,
int  arrayLength,
bool  returnUnimplemetedDescriptor = false 
)

Definition at line 134 of file si.c.

References createDescriptor(), SI::Object::data, SI::CharArray::getData(), SI::Descriptor::getDescriptorTag(), SI::VariableLengthPart::getLength(), and SI::Object::isValid().

                                                                                                                          {
   Descriptor *d=0;
   int len;
   if (isValid() && it.i<(len=getLength())) {
      const unsigned char *p=data.getData(it.i);
      const unsigned char *end=p+len-it.i;
      while (p < end) {
         for (int u=0; u<arrayLength;u++)
            if (Descriptor::getDescriptorTag(p) == tags[u]) {
               d=createDescriptor(it.i, returnUnimplementedDescriptor);
               break;
            }
         if (d)
            break; //length is added to it.i by createDescriptor, break here
         it.i+=Descriptor::getLength(p);
         p+=Descriptor::getLength(p);
      }
   }
   return d;
}
int SI::DescriptorLoop::getNumberOfDescriptors ( )

Definition at line 166 of file si.c.

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

                                           {
   const unsigned char *p=data.getData();
   const unsigned char *end=p+getLength();
   int count=0;
   while (p < end) {
      count++;
      p+=Descriptor::getLength(p);
   }
   return count;
}

Member Data Documentation


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