Public Member Functions | Private Attributes

ACEXML_Entity_Manager Class Reference

Class to manage and resolve entity references. More...

#include <ACEXML/parser/parser/Entity_Manager.h>

Collaboration diagram for ACEXML_Entity_Manager:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ACEXML_Entity_Manager (void)
 Default constructor.
 ~ACEXML_Entity_Manager (void)
 Destructor.
int add_entity (const ACEXML_Char *ref, const ACEXML_Char *value)
 Add a new entity declaration.
const ACEXML_Charresolve_entity (const ACEXML_Char *ref)
 Resolve an entity reference.
int resolve_entity (const ACEXML_Char *ref, ACEXML_Char *&systemId, ACEXML_Char *&publicId)
size_t size (void) const
 Number of items in the Entity Manager.
int reset (void)
 Reset the state.

Private Attributes

ACEXML_ENTITIES_MANAGERentities_
bool init_

Detailed Description

Class to manage and resolve entity references.

Todo:
Fill in details for this class.

Definition at line 62 of file Entity_Manager.h.


Constructor & Destructor Documentation

ACEXML_Entity_Manager::ACEXML_Entity_Manager ( void   ) 

Default constructor.

Definition at line 10 of file Entity_Manager.cpp.

  : entities_ (0)
{

}

ACEXML_Entity_Manager::~ACEXML_Entity_Manager ( void   ) 

Destructor.

Definition at line 16 of file Entity_Manager.cpp.

{
  this->reset();
}


Member Function Documentation

ACEXML_INLINE int ACEXML_Entity_Manager::add_entity ( const ACEXML_Char ref,
const ACEXML_Char value 
)

Add a new entity declaration.

Definition at line 4 of file Entity_Manager.inl.

{
  if (!this->entities_ )
    ACE_NEW_RETURN (this->entities_, ACEXML_ENTITIES_MANAGER, -1);
  ACEXML_String name (ref, 0, false);
  ACEXML_String value  (v, 0, false);
  return this->entities_->bind (name, value);
}

ACEXML_INLINE int ACEXML_Entity_Manager::reset ( void   ) 

Reset the state.

Definition at line 52 of file Entity_Manager.inl.

{
  delete this->entities_;
  this->entities_ = 0;
  return 0;
}

ACEXML_INLINE const ACEXML_Char * ACEXML_Entity_Manager::resolve_entity ( const ACEXML_Char ref  ) 

Resolve an entity reference.

Definition at line 15 of file Entity_Manager.inl.

{
  if (!this->entities_)
    return 0;

  ACEXML_ENTITY_ENTRY *entry = 0;

  if (this->entities_->find (ACEXML_String (ref, 0, false),
                            entry) == 0)
    return entry->int_id_.c_str();
  return 0;
}

ACEXML_INLINE int ACEXML_Entity_Manager::resolve_entity ( const ACEXML_Char ref,
ACEXML_Char *&  systemId,
ACEXML_Char *&  publicId 
)

Resolve an entity reference and return the tuple of systemId and publicId

Definition at line 29 of file Entity_Manager.inl.

{
  if (!this->entities_)
    return 0;

  publicId = systemId = 0;
  ACEXML_ENTITY_ENTRY_ITERATOR iter (*this->entities_, ref);
  ACEXML_ENTITY_ENTRY_ITERATOR end (*this->entities_, ref, 1);

  if (iter != end)
    {
      systemId = const_cast<ACEXML_Char*> ((*iter).int_id_.c_str());
      ++iter;
      if (iter != end)
        publicId = const_cast<ACEXML_Char*> ((*iter).int_id_.c_str());
      return 0;
    }
  return -1;
}

ACEXML_INLINE size_t ACEXML_Entity_Manager::size ( void   )  const

Number of items in the Entity Manager.

Definition at line 61 of file Entity_Manager.inl.

{
  if (!this->entities_)
    return 0;
  return this->entities_->current_size();
}


Member Data Documentation

Definition at line 89 of file Entity_Manager.h.

Definition at line 90 of file Entity_Manager.h.


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