Packages: All | Ctx | Dom | IO | OracleXml | Parser | Tools | XPath | XPointer | Xsl Functions | Datatypes

Package Ctx

Ctx is the namespace (sub-space of OracleXml) for TCtx (XML context) related types and interfaces.


Member Function Index

InterfaceFunctionDescription
ErrorHandler  createException  Create an exception for the last exceptional situation
ErrorHandler  getMesLang  Get current language (encoding) of error messages
ErrorHandler  handleError  Handle current error
ErrorHandler  ~ErrorHandler  Virtual destructor - interface level handle to actual destructors
MemAllocator  alloc  Allocates memory of given size
MemAllocator  dealloc  deallocate memory pointed to by the argument
MemAllocator  ~MemAllocator  Virtual destructor - interface level handle to actual destructors
TCtx  TCtx  Default constructor
TCtx  TCtx  Same as above but takes parameters provided by the user
TCtx  TCtx  Same as above.
TCtx  getEncoding  Get data encoding in use by XML context
TCtx  getErrHandler  Get Error Handler provided by the user
TCtx  getMemAllocator  Get memory allocator
TCtx  isSimple  Get a flag saying if data encoding is simple
TCtx  isUnicode  Get a flag saying if data encoding is Unicode
TCtx  ~TCtx  Destructor - clears space and destroys the implementation


Interface ErrorHandler (Interface one-line doc)

It is the root error handler class. It deals with local processing of errors, in particular in C implementation. It may throw XmlException in some implementations. But this is not specified in its signature in order to accomodate needs of all impementations. However, it can create exception objects. The error handler is passed to the TCtx constructor when TCtx is initialized. Implementations of this interface are provided by the user.

Member Function Index

FunctionDescription
createException Create an exception for the last exceptional situation
getMesLang Get current language (encoding) of error messages
handleError Handle current error
~ErrorHandler Virtual destructor - interface level handle to actual destructors


Interface MemAllocator (Interface one-line doc)

It is a simple root interface to make the TCtx interface reasonably generic so that different allocator approaches can be used in the future. It is passed to the TCtx constructor when Tctx is initialized. It is a low level allocator that does not know the type of an object being allocated. The allocators with this interface can also be used directly. In this case the user is responsible for the explicit deallocation of objects (with dealloc)

Member Function Index

FunctionDescription
alloc Allocates memory of given size
dealloc deallocate memory pointed to by the argument
~MemAllocator Virtual destructor - interface level handle to actual destructors


Interface TCtx (Interface one-line doc)

This is an implicit interface to XML context implementations. It is primarily used for memory allocation, error (not exception) handling, and different encodings handling. The context interface is an implicit interface that is supposed to be used as type parameter. The name TCtx will be used as a corresponding type parameter name. Its actuall substitutions are instantiations of implementations parameterized (templatized) by real context implementations. In the case of errors XmlException might be thrown.

All constructors create and initialize context implementations. In a multithreaded environment a separate context implementation has to be initialized for each thread.

If the MemAllocator interface is passed as a parameter to the TCtx constructor, than, in many cases, it makes sense to overwrite the operator new. In this case all memory allocations in both C and C++ can be done by the same allocator. This works like this:

Example

      void* operator new( ub4 sz, MemAllocator* memalloc)
      {...return memalloc->alloc( sz);...}
      ...
      (extern) MemAllocator* mem_alloc (= initialize actual allocator) ;
      ...
      TCtx* ctxp = new( mem_alloc) TCtx( name, errh, mem_alloc, (...));
      ...
      ctxp->~TCtx();
      mem_alloc->dealloc( ctxp);

Member Function Index

FunctionDescription
TCtx Default constructor
TCtx Same as above but takes parameters provided by the user
TCtx Same as above.
getEncoding Get data encoding in use by XML context
getErrHandler Get Error Handler provided by the user
getMemAllocator Get memory allocator
isSimple Get a flag saying if data encoding is simple
isUnicode Get a flag saying if data encoding is Unicode
~TCtx Destructor - clears space and destroys the implementation

createException

Name createException
Interface ErrorHandler
Purpose Create an exception for the last exceptional situation
Prototype   virtual XmlException* createException() const = 0;
Arguments void
Returns (XmlException *) XmlException object
Description This virtual member function defines a prototype for user defined functions creating an XML exception based on the last exceptional situation processed by handleError()

getMesLang

Name getMesLang
Interface ErrorHandler
Purpose Get current language (encoding) of error messages
Prototype   virtual oratext* getMesLang() const = 0;
Arguments void
Returns (oratext *) Current language (encoding) of error messages
Description This is a virtual member function that defines a prototype for user defined functions returning current language (encoding) of error messages for the exceptional situations during execution

handleError

Name handleError
Interface ErrorHandler
Purpose Handle current error
Prototype   virtual void handleError( oratext* msg, unsigned errcode) = 0;
Arguments
msg  (IN)  Oracle error message
errcode  (IN)  Oracle error code
Returns (void)
Description This virtual member function defines a prototype for user defined functions implementing user defined actions for particular exceptional situations

~ErrorHandler

Name ~ErrorHandler
Interface ErrorHandler
Purpose Virtual destructor - interface level handle to actual destructors
Prototype   virtual ~ErrorHandler() {}
Arguments void
Returns (void)
Description It provides an interface level handle to actual destructors that can be invoked without knowing their names or implementations

alloc

Name alloc
Interface MemAllocator
Purpose Allocates memory of given size
Prototype   virtual void* alloc( ub4 size) = 0;
Arguments
size  (IN)  memory size to be allocated
Returns (void *) Pointer to memory allocated
Description This is a virtual member function that defines a prototype for user defined allocator functions

dealloc

Name dealloc
Interface MemAllocator
Purpose deallocate memory pointed to by the argument
Prototype   virtual void  dealloc( void* ptr) = 0;
Arguments
ptr  (IN)  pointer to previously allocated memory
Returns (void)
Description This is a virtual member function that defines a prototype for user defined deallocator functions. Such deallocators are supposed to deallocate memory allocated by the alloc member functions

~MemAllocator

Name ~MemAllocator
Interface MemAllocator
Purpose Virtual destructor - interface level handle to actual destructors
Prototype   virtual ~MemAllocator() {}
Arguments void
Returns (void)
Description It provides an interface level handle to actual destructors that can be invoked without knowing their names or implementations

TCtx

Name TCtx
Interface TCtx
Purpose Default constructor
Prototype
Arguments void
Returns (TCtx) Context object
Description This constructor creates the context object and initializes it with default values of parameters (see xml.h for a detailed description). It throws XmlException if fails to create a context object

TCtx

Name TCtx
Interface TCtx
Purpose Same as above but takes parameters provided by the user
Prototype
Arguments
name  (IN)  user defined name of the context
errh  (IN)  user defined error handler
memalloc  (IN)  user defined memory allocator
encs  (IN)  user specified encodings
Returns (TCtx) Context object
Description This constructor creates the context object and initializes it with parameter values provided by the user. It throws XmlException if fails to create a context object

TCtx

Name TCtx
Interface TCtx
Purpose Same as above.
Prototype
Arguments void
Returns Context object
Description Same as above but takes an additinal parameter

getEncoding

Name getEncoding
Interface TCtx
Purpose Get data encoding in use by XML context
Prototype
Arguments void
Returns (oratext *) name of data encoding
Description Returns data encoding in use by XML context. Ordinarily, the data encoding is chosen by the user, so this function is not needed. However, if the data encoding is not specified, and allowed to default, this function can be used to return the name of that default encoding.

getErrHandler

Name getErrHandler
Interface TCtx
Purpose Get Error Handler provided by the user
Prototype
Arguments void
Returns (ErrorHandler *) Pointer to the Error Handler object, or NULL
Description This member functions returns Error Handler provided by the user when the context was created, or NULL if none were provided.

getMemAllocator

Name getMemAllocator
Interface TCtx
Purpose Get memory allocator
Prototype
Arguments void
Returns (MemAllocator*) Pointer to the memory allocator object
Description This member function returns memory allocator provided by the user when the context was created, or default memory allocator. It is imortant that this memory allocator is used for all C level memory allocations

isSimple

Name isSimple
Interface TCtx
Purpose Get a flag saying if data encoding is simple
Prototype
Arguments void
Returns (boolean) TRUE of data encoding is "simple", FALSE otherwise
Description Returns a flag saying whether the context's data encoding is "simple", i.e. single-byte per character, like ASCII or EBCDIC.

isUnicode

Name isUnicode
Interface TCtx
Purpose Get a flag saying if data encoding is Unicode
Prototype
Arguments void
Returns (boolean) TRUE if data encoding is Unicode, FALSE otherwise
Description Returns a flag saying whether the context's data encoding is Unicode, i.e. UTF-16, with two-byte per character.

~TCtx

Name ~TCtx
Interface TCtx
Purpose Destructor - clears space and destroys the implementation
Prototype
Arguments void
Returns (void)
Description Destructor - should be called by the user the context object is no longer needed