IShTokenStream Struct Reference
[Shell Interfaces]

Inheritance diagram for IShTokenStream:

IMCUnknown List of all members.

Public Member Functions

virtual MCCOMErr MCCOMAPI GetBegin ()=0
virtual MCCOMErr MCCOMAPI GetEnd ()=0
virtual MCCOMErr MCCOMAPI GetKeyword (int32 *keyword)=0
virtual MCCOMErr MCCOMAPI GetNextToken (int8 *token)=0
virtual MCCOMErr MCCOMAPI GetLong (int32 *value)=0
virtual MCCOMErr MCCOMAPI GetQuickFix (real *value)=0
virtual MCCOMErr MCCOMAPI GetPoint2D (real *x, real *y)=0
virtual MCCOMErr MCCOMAPI GetPoint3D (real *x, real *y, real *z)=0
virtual MCCOMErr MCCOMAPI GetShortArray (int32 nb, int16 *valArray)=0
virtual MCCOMErr MCCOMAPI GetLongArray (int32 nb, int32 *valArray)=0
virtual MCCOMErr MCCOMAPI GetString (int8 *astring)=0
virtual MCCOMErr MCCOMAPI GetArray (int32 nb, real *valArray)=0
virtual MCCOMErr MCCOMAPI GetMat33 (real &m00, real &m01, real &m02, real &m10, real &m11, real &m12, real &m20, real &m21, real &m22)=0
virtual boolean MCCOMAPI IsEndToken (int8 *atoken)=0
virtual MCCOMErr MCCOMAPI CompactAttribute (int8 *atoken, int32 *keyword)=0
virtual MCCOMErr MCCOMAPI SkipTokenData ()=0
virtual MCCOMErr MCCOMAPI Indent ()=0
virtual MCCOMErr MCCOMAPI PutKeyword (int32 keyword)=0
virtual MCCOMErr MCCOMAPI PutKeywordAndBegin (int32 keyword)=0
virtual MCCOMErr MCCOMAPI PutEnd ()=0
virtual MCCOMErr MCCOMAPI PutLong (int32 along)=0
virtual MCCOMErr MCCOMAPI PutQuickFix (real avalue)=0
virtual MCCOMErr MCCOMAPI PutPoint2D (real x, real y)=0
virtual MCCOMErr MCCOMAPI PutPoint3D (real x, real y, real z)=0
virtual MCCOMErr MCCOMAPI PutShortArray (int32 nb, const int16 *valArray)=0
virtual MCCOMErr MCCOMAPI PutLongArray (int32 nb, const int32 *valArray)=0
virtual MCCOMErr MCCOMAPI PutString (const int8 *astring)=0
virtual MCCOMErr MCCOMAPI PutArray (int32 nb, const real *valArray)=0
virtual MCCOMErr MCCOMAPI PutMat33 (real m00, real m01, real m02, real m10, real m11, real m12, real m20, real m21, real m22)=0
virtual void MCCOMAPI BeginBufferAsBinHex (uint32 &lastInfo)=0
virtual void MCCOMAPI PutBufferAsBinHex (int8 *data, int32 count, uint32 &lastInfo)=0
virtual void MCCOMAPI GetBufferAsBinHex (int8 *data, int32 count, uint32 &lastInfo)=0
virtual void MCCOMAPI EndPutBufferAsBinHex (uint32 &lastInfo)=0
virtual TMCiostream &MCCOMAPI GetStream ()=0
virtual MCCOMErr MCCOMAPI InitTokenMgr ()=0

Detailed Description

Interface for token streams. See MCToken.h for token definitions used. Used to read/write tokenized data files (as are standard for Carrara) as in the following simple example, which reads in the position of a vertex:
    MCCOMErr ReadVertex(IShTokenStream* inStream,int8 *token, I3DExVertex* vertex)
    {
                ThrowIfNil(vertex);
                stream->GetNextToken(token);
                if (token[0] != tBEGIN)
                {
                        return MC_ERROR_FILE_NOT_FOUND;
                }
                stream->GetNextToken(token);
                int32 key;
                TVector3 position = TVector3::kZero;
                while (!stream->IsEndToken(token))
                {
                        stream->CompactAttribute(token,&key);
                        switch (key)
                        {
                                case 'posi':
                                        stream->GetPoint3D(&(position.x), &(position.y), &(position.z))
                                        break;
                                default:
                                        stream->SkipTokenData();
                                        break;
                        }
                        stream->GetNextToken(token);
                }
                vertex->SetPosition(position);
        }

Before reading or writing a new file, call InitTokenMgr() to initialize various variables (such as indentation size).

To read and write binary data in a tokenized text file, we must encode them as text. BeginBufferAsBinHex(), PutBufferAsBinHex(), GetBufferAsBinHex(), and EndPutBufferAsBinHex() handle this functionality.


Member Function Documentation

virtual void MCCOMAPI IShTokenStream::BeginBufferAsBinHex (  uint32 &  lastInfo  )  [pure virtual]
 

Initialise the saving of a binary buffer into a text stream. Should be called before PutBufferAsBinHex.

Parameters:
lastInfo Pass this a 0. This will be used by PutBufferAsBinHex and EndBufferAsBinHex.

virtual MCCOMErr MCCOMAPI IShTokenStream::CompactAttribute (  int8 *  atoken,
int32 *  keyword
)  [pure virtual]
 

virtual void MCCOMAPI IShTokenStream::EndPutBufferAsBinHex (  uint32 &  lastInfo  )  [pure virtual]
 

Finish saving a binary buffer. lastInfo should come from the last call to PutBufferAsBinHex.

Parameters:
lastInfo From the last PutBufferAsBinHex

virtual MCCOMErr MCCOMAPI IShTokenStream::GetArray (  int32  nb,
real *  valArray
)  [pure virtual]
 

virtual MCCOMErr MCCOMAPI IShTokenStream::GetBegin (   )  [pure virtual]
 

virtual void MCCOMAPI IShTokenStream::GetBufferAsBinHex (  int8 *  data,
int32  count,
uint32 &  lastInfo
)  [pure virtual]
 

Load a binary buffer from a text stream. lastInfo should come from the last call to GetBufferAsBinHex or from BeginBufferAsBinHex.

Parameters:
data pointer to the buffer to fill
count number of bytes to fill
lastInfo From the last GetBufferAsBinHex or BeginBufferAsBinHex call

virtual MCCOMErr MCCOMAPI IShTokenStream::GetEnd (   )  [pure virtual]
 

virtual MCCOMErr MCCOMAPI IShTokenStream::GetKeyword (  int32 *  keyword  )  [pure virtual]
 

virtual MCCOMErr MCCOMAPI IShTokenStream::GetLong (  int32 *  value  )  [pure virtual]
 

virtual MCCOMErr MCCOMAPI IShTokenStream::GetLongArray (  int32  nb,
int32 *  valArray
)  [pure virtual]
 

virtual MCCOMErr MCCOMAPI IShTokenStream::GetMat33 (  real &  m00,
real &  m01,
real &  m02,
real &  m10,
real &  m11,
real &  m12,
real &  m20,
real &  m21,
real &  m22
)  [pure virtual]
 

virtual MCCOMErr MCCOMAPI IShTokenStream::GetNextToken (  int8 *  token  )  [pure virtual]
 

virtual MCCOMErr MCCOMAPI IShTokenStream::GetPoint2D (  real *  x,
real *  y
)  [pure virtual]
 

virtual MCCOMErr MCCOMAPI IShTokenStream::GetPoint3D (  real *  x,
real *  y,
real *  z
)  [pure virtual]
 

virtual MCCOMErr MCCOMAPI IShTokenStream::GetQuickFix (  real *  value  )  [pure virtual]
 

virtual MCCOMErr MCCOMAPI IShTokenStream::GetShortArray (  int32  nb,
int16 *  valArray
)  [pure virtual]
 

virtual TMCiostream& MCCOMAPI IShTokenStream::GetStream (   )  [pure virtual]
 

virtual MCCOMErr MCCOMAPI IShTokenStream::GetString (  int8 *  astring  )  [pure virtual]
 

virtual MCCOMErr MCCOMAPI IShTokenStream::Indent (   )  [pure virtual]
 

virtual MCCOMErr MCCOMAPI IShTokenStream::InitTokenMgr (   )  [pure virtual]
 

InitTokenMgr() should be called every time before reading or writing a new file. The parameter sets gTokenAsciiFormat (this controls ASCII translation). Other globals like the indentation level are reset to their default values too.

virtual boolean MCCOMAPI IShTokenStream::IsEndToken (  int8 *  atoken  )  [pure virtual]
 

virtual MCCOMErr MCCOMAPI IShTokenStream::PutArray (  int32  nb,
const real *  valArray
)  [pure virtual]
 

virtual void MCCOMAPI IShTokenStream::PutBufferAsBinHex (  int8 *  data,
int32  count,
uint32 &  lastInfo
)  [pure virtual]
 

Save a binary buffer into a text stream. lastInfo should come from the last call to PutBufferAsBinHex or from BeginBufferAsBinHex.

Parameters:
data pointer to the buffer to save
count number of bytes of data in the buffer
lastInfo From the last PutBufferAsBinHex or BeginBufferAsBinHex call

virtual MCCOMErr MCCOMAPI IShTokenStream::PutEnd (   )  [pure virtual]
 

virtual MCCOMErr MCCOMAPI IShTokenStream::PutKeyword (  int32  keyword  )  [pure virtual]
 

virtual MCCOMErr MCCOMAPI IShTokenStream::PutKeywordAndBegin (  int32  keyword  )  [pure virtual]
 

virtual MCCOMErr MCCOMAPI IShTokenStream::PutLong (  int32  along  )  [pure virtual]
 

virtual MCCOMErr MCCOMAPI IShTokenStream::PutLongArray (  int32  nb,
const int32 *  valArray
)  [pure virtual]
 

virtual MCCOMErr MCCOMAPI IShTokenStream::PutMat33 (  real  m00,
real  m01,
real  m02,
real  m10,
real  m11,
real  m12,
real  m20,
real  m21,
real  m22
)  [pure virtual]
 

virtual MCCOMErr MCCOMAPI IShTokenStream::PutPoint2D (  real  x,
real  y
)  [pure virtual]
 

virtual MCCOMErr MCCOMAPI IShTokenStream::PutPoint3D (  real  x,
real  y,
real  z
)  [pure virtual]
 

virtual MCCOMErr MCCOMAPI IShTokenStream::PutQuickFix (  real  avalue  )  [pure virtual]
 

virtual MCCOMErr MCCOMAPI IShTokenStream::PutShortArray (  int32  nb,
const int16 *  valArray
)  [pure virtual]
 

virtual MCCOMErr MCCOMAPI IShTokenStream::PutString (  const int8 *  astring  )  [pure virtual]
 

virtual MCCOMErr MCCOMAPI IShTokenStream::SkipTokenData (   )  [pure virtual]
 


The documentation for this struct was generated from the following file:
Generated on Mon Mar 14 12:29:05 2005 for Carrara SDK Doc by  doxygen 1.3.9.1