UnicodeCharType Class Reference

Inheritance diagram for UnicodeCharType:

StoredTypeDescriptor List of all members.

Public Types

typedef uint Ordinal
 Each type must have a unique positive integer ordinal associated with it.

Static Public Member Functions

static int compareStrings (Ucs2ConstBuffer pStr1, Ucs2ConstBuffer pStr2, uint nChars)

Private Member Functions

virtual Ordinal getOrdinal () const
 
Returns:
the ordinal representing this type.

virtual uint getBitCount () const
 
Returns:
number of bits in marshalled representation, or 0 for a non-bit type; currently only 0 or 1 is supported

virtual uint getFixedByteCount () const
 
Returns:
the width in bytes for a fixed-width non-bit type which admits no per-attribute precision, or 0 for types with per-attribute precision; for bit types, this yields the size of the unmarshalled representation

virtual uint getMinByteCount (uint cbMaxWidth) const
 Gets the number of bytes required to store the narrowest value with this type, given a particular max byte count.
virtual uint getAlignmentByteCount (uint cbWidth) const
 Gets the alignment size in bytes required for values of this type, given a particular max byte count.
virtual void visitValue (DataVisitor &dataVisitor, void const *pData, TupleStorageByteLength cbData) const
 Visits a value of this type.
virtual int compareValues (void const *pData1, TupleStorageByteLength cbData1, void const *pData2, TupleStorageByteLength cbData2) const
 Compares two values of this type.

Detailed Description

Definition at line 181 of file StandardTypeDescriptor.cpp.


Member Typedef Documentation

typedef uint StoredTypeDescriptor::Ordinal [inherited]

Each type must have a unique positive integer ordinal associated with it.

This is used to reconstruct a StoredTypeDescriptor object from a stored attribute definition.

Definition at line 44 of file StoredTypeDescriptor.h.


Member Function Documentation

virtual Ordinal UnicodeCharType::getOrdinal (  )  const [inline, private, virtual]

Returns:
the ordinal representing this type.

Implements StoredTypeDescriptor.

Definition at line 183 of file StandardTypeDescriptor.cpp.

References STANDARD_TYPE_UNICODE_CHAR.

00184     {
00185         return STANDARD_TYPE_UNICODE_CHAR;
00186     }

virtual uint UnicodeCharType::getBitCount (  )  const [inline, private, virtual]

Returns:
number of bits in marshalled representation, or 0 for a non-bit type; currently only 0 or 1 is supported

Implements StoredTypeDescriptor.

Definition at line 188 of file StandardTypeDescriptor.cpp.

00189     {
00190         return 0;
00191     }

virtual uint UnicodeCharType::getFixedByteCount (  )  const [inline, private, virtual]

Returns:
the width in bytes for a fixed-width non-bit type which admits no per-attribute precision, or 0 for types with per-attribute precision; for bit types, this yields the size of the unmarshalled representation

Implements StoredTypeDescriptor.

Definition at line 193 of file StandardTypeDescriptor.cpp.

00194     {
00195         return 0;
00196     }

virtual uint UnicodeCharType::getMinByteCount ( uint  cbMaxWidth  )  const [inline, private, virtual]

Gets the number of bytes required to store the narrowest value with this type, given a particular max byte count.

For a fixed-width type, the return value is the same as the input.

Parameters:
cbMaxWidth maximum width for which to compute the minimum
Returns:
number of bytes

Implements StoredTypeDescriptor.

Definition at line 198 of file StandardTypeDescriptor.cpp.

00199     {
00200         return cbMaxWidth;
00201     }

virtual uint UnicodeCharType::getAlignmentByteCount ( uint  cbWidth  )  const [inline, private, virtual]

Gets the alignment size in bytes required for values of this type, given a particular max byte count.

This must be 1, 2, 4, or 8, and may not be greater than 2 for variable-width datatypes. For fixed-width datatypes, the width must be a multiple of the alignment size.

Parameters:
cbWidth width for which to compute the alignment
Returns:
number of bytes

Implements StoredTypeDescriptor.

Definition at line 203 of file StandardTypeDescriptor.cpp.

00204     {
00205         return 2;
00206     }

virtual void UnicodeCharType::visitValue ( DataVisitor dataVisitor,
void const *  pData,
TupleStorageByteLength  cbData 
) const [inline, private, virtual]

Visits a value of this type.

Parameters:
dataVisitor the DataVisitor which should be called with the interpreted value
pData the address of the data value
cbData the number of bytes of data

Implements StoredTypeDescriptor.

Definition at line 208 of file StandardTypeDescriptor.cpp.

References DataVisitor::visitUnicodeChars().

00212     {
00213         assert((cbData & 1) == 0);
00214         Ucs2ConstBuffer pStr = static_cast<Ucs2ConstBuffer>(pData);
00215         dataVisitor.visitUnicodeChars(pStr,(cbData >> 1));
00216     }

virtual int UnicodeCharType::compareValues ( void const *  pData1,
TupleStorageByteLength  cbData1,
void const *  pData2,
TupleStorageByteLength  cbData2 
) const [inline, private, virtual]

Compares two values of this type.

Parameters:
pData1 the address of the first data value
cbData1 the width of the first data value in bytes
pData2 the address of the second data value
cbData2 the width of the second data value in bytes
Returns:
negative if the first data value is less than the second; positive if greater; zero if equal

Implements StoredTypeDescriptor.

Definition at line 218 of file StandardTypeDescriptor.cpp.

References compareStrings().

00223     {
00224         assert(cbData1 == cbData2);
00225         assert((cbData1 & 1) == 0);
00226         Ucs2ConstBuffer pStr1 = static_cast<Ucs2ConstBuffer>(pData1);
00227         Ucs2ConstBuffer pStr2 = static_cast<Ucs2ConstBuffer>(pData2);
00228         uint nChars = (cbData1 >> 1);
00229         int c = compareStrings(pStr1, pStr2, nChars);
00230         return c;
00231     }

static int UnicodeCharType::compareStrings ( Ucs2ConstBuffer  pStr1,
Ucs2ConstBuffer  pStr2,
uint  nChars 
) [inline, static]

Definition at line 234 of file StandardTypeDescriptor.cpp.

Referenced by UnicodeVarCharType::compareValues(), and compareValues().

00236     {
00237         for (uint i = 0; i < nChars; ++i) {
00238             int c = *pStr1;
00239             c -= *pStr2;
00240             if (c) {
00241                 return c;
00242             }
00243             ++pStr1;
00244             ++pStr2;
00245         }
00246         return 0;
00247     }


The documentation for this class was generated from the following file:
Generated on Mon Jun 22 04:00:48 2009 for Fennel by  doxygen 1.5.1