XMLAttDef Class Referenceabstract

Represents the core information of an attribute definition. More...

Inheritance diagram for XMLAttDef:

## Public Types

enum | AttTypes { CData = 0, ID = 1, IDRef = 2, IDRefs = 3, Entity = 4, Entities = 5, NmToken = 6, NmTokens = 7, Notation = 8, Enumeration = 9, Simple = 10, Any_Any = 11, Any_Other = 12, Any_List = 13, AttTypes_Count, AttTypes_Min = 0, AttTypes_Max = 13, AttTypes_Unknown = -1 }
enum | DefAttTypes { Default = 0, Fixed = 1, Required = 2, Required_And_Fixed = 3, Implied = 4, ProcessContents_Skip = 5, ProcessContents_Lax = 6, ProcessContents_Strict = 7, Prohibited = 8, DefAttTypes_Count, DefAttTypes_Min = 0, DefAttTypes_Max = 8, DefAttTypes_Unknown = -1 }
enum | CreateReasons { NoReason, JustFaultIn }

## Public Member Functions

Destructor
virtual | ~XMLAttDef ()
| Destructor. More...
Virtual interface
virtual const XMLCh * | getFullName () const =0
| Get the full name of this attribute type. More...
virtual void | reset ()=0
| The derived class should implement any cleaning up required between each use of an instance of this class for validation. More...
Getter methods
DefAttTypes | getDefaultType () const
| Get the default type of this attribute type. More...
const XMLCh * | getEnumeration () const
| Get the enumeration value (if any) of this attribute type. More...
XMLSize_t | getId () const
| Get the pool id of this attribute type. More...
AttTypes | getType () const
| Get the type of this attribute. More...
const XMLCh * | getValue () const
| Get the default/fixed value of this attribute (if any.) More...
CreateReasons | getCreateReason () const
| Get the create reason for this attribute. More...
bool | isExternal () const
| Indicate whether this attribute has been declared externally. More...
MemoryManager * | getMemoryManager () const
| Get the plugged-in memory manager. More...
Public Member Functions inherited from XMemory
void * | operator new (size_t size)
| This method overrides operator new. More...
void * | operator new (size_t size, MemoryManager *memMgr)
| This method defines a custom operator new, that will use the provided memory manager to perform the allocation. More...
void * | operator new (size_t size, void *ptr)
| This method overrides placement operator new. More...
void | operator delete (void *p)
| This method overrides operator delete. More...
void | operator delete (void *p, MemoryManager *memMgr)
| This method provides a matching delete for the custom operator new. More...
void | operator delete (void *p, void *ptr)
| This method provides a matching delete for the placement new. More...

## Static Public Member Functions

Public, static methods
static const XMLCh * | getAttTypeString (const AttTypes attrType, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
| Get a string representation of the passed attribute type enum. More...
static const XMLCh * | getDefAttTypeString (const DefAttTypes attrType, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
| Get a string representation of the passed def attribute type enum. More...

## Static Public Attributes

static const unsigned int | fgInvalidAttrId

## Setter methods

void | setDefaultType (const XMLAttDef::DefAttTypes newValue)
| Set the default attribute type. More...
void | setId (const XMLSize_t newId)
| Set the pool id for this attribute type. More...
void | setType (const XMLAttDef::AttTypes newValue)
| Set the type of this attribute type. More...
void | setValue (const XMLCh *const newValue)
| Set the default/fixed value of this attribute type. More...
void | setEnumeration (const XMLCh *const newValue)
| Set the enumerated value of this attribute type. More...
void | setCreateReason (const CreateReasons newReason)
| Update the create reason for this attribute type. More...
void | setExternalAttDeclaration (const bool aValue)
| Set the attribute decl to indicate external declaration. More...
| XMLAttDef (const AttTypes type=CData, const DefAttTypes defType=Implied, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
| XMLAttDef (const XMLCh *const attValue, const AttTypes type, const DefAttTypes defType, const XMLCh *const enumValues=0, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)

## Additional Inherited Members

Protected Member Functions inherited from XMemory
| XMemory ()
| Protected default constructor. More...

## Detailed Description

Represents the core information of an attribute definition.

This class defines the basic characteristics of an attribute, no matter what type of validator is used. If a particular schema associates more information with an attribute it will create a derivative of this class. So this class provides an abstract way to get basic information on attributes from any type of validator.

This class supports keyed collection semantics on the fully qualified attribute name, by providing a getKey() method to extract the key string. getKey(), in this case, just calls the virtual method getFullName() to get the fully qualified name, as defined by the derived class.

Note that the 'value' of an attribute type definition is the default or of fixed value given to it in its definition. If the attribute is of the enumerated or notation type, it will have an 'enumeration value' as well which is a space separated list of its possible vlaues.

## Member Enumeration Documentation

## AttTypes

enum XMLAttDef::AttTypes

Enumerator
CData |
ID |
IDRef |
IDRefs |
Entity |
Entities |
NmToken |
NmTokens |
Notation |
Enumeration |
Simple |
Any_Any |
Any_Other |
Any_List |
AttTypes_Count |
AttTypes_Min |
AttTypes_Max |
AttTypes_Unknown |

## CreateReasons

enum XMLAttDef::CreateReasons

Enumerator
NoReason |
JustFaultIn |

## DefAttTypes

enum XMLAttDef::DefAttTypes

Enumerator
Default |
Fixed |
Required |
Required_And_Fixed |
Implied |
ProcessContents_Skip |
ProcessContents_Lax |
ProcessContents_Strict |
Prohibited |
DefAttTypes_Count |
DefAttTypes_Min |
DefAttTypes_Max |
DefAttTypes_Unknown |

## Constructor & Destructor Documentation

## ~XMLAttDef()

virtual XMLAttDef::~XMLAttDef | ( |  | ) |

virtual

Destructor.

## XMLAttDef() [1/2]

XMLAttDef::XMLAttDef | ( | const AttTypes | type = `CData`,
|  | const DefAttTypes | defType = `Implied`,
|  | MemoryManager *const | manager = `XMLPlatformUtils::fgMemoryManager`
| ) |  |

protected

## XMLAttDef() [2/2]

XMLAttDef::XMLAttDef | ( | const XMLCh *const | attValue,
|  | const AttTypes | type,
|  | const DefAttTypes | defType,
|  | const XMLCh *const | enumValues = `0`,
|  | MemoryManager *const | manager = `XMLPlatformUtils::fgMemoryManager`
| ) |  |

protected

## Member Function Documentation

## getAttTypeString()

static const XMLCh* XMLAttDef::getAttTypeString | ( | const AttTypes | attrType,
|  | MemoryManager *const | manager = `XMLPlatformUtils::fgMemoryManager`
| ) |  |

static

Get a string representation of the passed attribute type enum.

This method allows you to get a textual representation of an attribute type, mostly for debug or display.

Parameters

  attrType | The attribute type value to get the string for.
  manager | The MemoryManager to use to allocate objects

Returns
  A const pointer to the static string that holds the text description of the passed type.

## getCreateReason()

XMLAttDef::CreateReasons XMLAttDef::getCreateReason | ( |  | ) | const

Get the create reason for this attribute.

This method returns an enumeration which indicates why this attribute declaration exists.

Returns
  An enumerated value that indicates the reason why this attribute was added to the attribute table.

## getDefAttTypeString()

static const XMLCh* XMLAttDef::getDefAttTypeString | ( | const DefAttTypes | attrType,
|  | MemoryManager *const | manager = `XMLPlatformUtils::fgMemoryManager`
| ) |  |

static

Get a string representation of the passed def attribute type enum.

This method allows you to get a textual representation of an default attributetype, mostly for debug or display.

Parameters

  attrType | The default attribute type value to get the string for.
  manager | The MemoryManager to use to allocate objects

Returns
  A const pointer to the static string that holds the text description of the passed default type.

## getDefaultType()

XMLAttDef::DefAttTypes XMLAttDef::getDefaultType | ( |  | ) | const

Get the default type of this attribute type.

This method returns the 'default type' of the attribute. Default type in this case refers to the XML concept of a default type for an attribute, i.e. #FIXED, #IMPLIED, etc...

Returns
  The default type enum for this attribute type.

## getEnumeration()

const XMLCh * XMLAttDef::getEnumeration | ( |  | ) | const

Get the enumeration value (if any) of this attribute type.

If the attribute is of an enumeration or notation type, then this method will return a const reference to a string that contains the space separated values that can the attribute can have.

Returns
  A const pointer to a string that contains the space separated legal values for this attribute.

## getFullName()

virtual const XMLCh* XMLAttDef::getFullName | ( |  | ) | const

pure virtual

Get the full name of this attribute type.

The derived class should return a const pointer to the full name of this attribute. This will vary depending on the type of validator in use.

Returns
  A const pointer to the full name of this attribute type.

## getId()

XMLSize_t XMLAttDef::getId | ( |  | ) | const

Get the pool id of this attribute type.

This method will return the id of this attribute in the validator's attribute pool. It was set by the validator when this attribute was created.

Returns
  The pool id of this attribute type.

## getMemoryManager()

MemoryManager * XMLAttDef::getMemoryManager | ( |  | ) | const

Get the plugged-in memory manager.

This method returns the plugged-in memory manager user for dynamic memory allocation/deallocation.

Returns
  the plugged-in memory manager

## getType()

XMLAttDef::AttTypes XMLAttDef::getType | ( |  | ) | const

Get the type of this attribute.

Gets the type of this attribute. This type is represented by an enum that converts the types of attributes allowed by XML, e.g. CDATA, NMTOKEN, NOTATION, etc...

Returns
  The attribute type enumeration value for this type of attribute.

## getValue()

const XMLCh * XMLAttDef::getValue | ( |  | ) | const

Get the default/fixed value of this attribute (if any.)

If the attribute defined a default/fixed value, then it is stored and this method will retrieve it. If it has non, then a null pointer is returned.

Returns
  A const pointer to the default/fixed value for this attribute type.

## isExternal()

bool XMLAttDef::isExternal | ( |  | ) | const

Indicate whether this attribute has been declared externally.

This method returns a boolean that indicates whether this attribute has been declared externally.

Returns
  true if this attribute has been declared externally, else false.

## reset()

virtual void XMLAttDef::reset | ( |  | ) |

pure virtual

The derived class should implement any cleaning up required between each use of an instance of this class for validation.

## setCreateReason()

void XMLAttDef::setCreateReason | ( | const CreateReasons | newReason | ) |

Update the create reason for this attribute type.

This method will update the 'create reason' field for this attribute decl object.

Parameters

  newReason | The new create reason.

## setDefaultType()

void XMLAttDef::setDefaultType | ( | const XMLAttDef::DefAttTypes | newValue | ) |

Set the default attribute type.

This method sets the default attribute type for this attribute. This setting controls whether the attribute is required, fixed, implied, etc...

Parameters

  newValue | The new default attribute to set

## setEnumeration()

void XMLAttDef::setEnumeration | ( | const XMLCh *const | newValue | ) |

Set the enumerated value of this attribute type.

This method sets the enumerated/notation value list for this attribute type. It is a space separated set of possible values. These values must meet the constrains of the XML spec for such values of this type of attribute. This should only be set if the setType() method is used to set the type to the enumeration or notation types.

Parameters

  newValue | The new enumerated/notation value list to set.

References MemoryManager::deallocate(), and XMLString::replicate().

## setExternalAttDeclaration()

void XMLAttDef::setExternalAttDeclaration | ( | const bool | aValue | ) |

Set the attribute decl to indicate external declaration.

Parameters

  aValue | The new value to indicate external declaration.

## setId()

void XMLAttDef::setId | ( | const XMLSize_t | newId | ) |

Set the pool id for this attribute type.

This method sets the pool id of this attribute type. This is usually called by the validator that creates the actual instance (which is of a derived type known only by the validator.)

Parameters

  newId | The new pool id to set.

## setType()

void XMLAttDef::setType | ( | const XMLAttDef::AttTypes | newValue | ) |

Set the type of this attribute type.

This method will set the type of the attribute. The type of an attribute controls how it is normalized and what kinds of characters it can hold.

Parameters

  newValue | The new attribute type to set

## setValue()

void XMLAttDef::setValue | ( | const XMLCh *const | newValue | ) |

Set the default/fixed value of this attribute type.

This method set the fixed/default value for the attribute. This value will be used when instances of this attribute type are faulted in. It must be a valid value for the type set by setType(). If the type is enumeration or notation, this must be one of the valid values set in the setEnumeration() call.

Parameters

  newValue | The new fixed/default value to set.

References MemoryManager::deallocate(), and XMLString::replicate().

## Member Data Documentation

## fgInvalidAttrId

const unsigned int XMLAttDef::fgInvalidAttrId

static

The documentation for this class was generated from the following file:

- XMLAttDef.hpp