OSB_LIB::BillingXmlBase Class Reference

Inheritance diagram for OSB_LIB::BillingXmlBase:

Inheritance graph
[legend]
Collaboration diagram for OSB_LIB::BillingXmlBase:

Collaboration graph
[legend]
List of all members.

Detailed Description

Enables various invoice items and their details to be written in XML format.

Class BillingXml provides XML writer functions needed to create OSB XML invoices. Such writers exist for the invoice itself, each type of invoice item and all basic billing classes that need to be written to the invoice. The invoice XML writer is the entry point and should be called by the billing application to print an invoice. All XML writers are collected in a class so that you can easily store thread specific data as members of this class.

Class BillingXml contains default implementations of XML writers for commonly used billing classes. It can be extended by inheritance. In order to overload functions of this class, e.g., BillingXml::writeInfo(), remember to use a using-declaration in the derived class:

      class MyBillingXml : public OSB_LIB::BillingXml {
      public:
          // Make writeInfo() functions of the base class visible
          using OSB_LIB::BillingXml::writeInfo;

          // ...
      }

Furthermore, note how we use dynamic_cast in connection with template functions. This seems necessary because template functions cannot be virtual.

Definition at line 113 of file billingxml.h.

Public Member Functions

Public Attributes

Protected Attributes


Constructor & Destructor Documentation

OSB_LIB::BillingXmlBase::BillingXmlBase ( std::ostream &  o  )  [inline]

Constructor.

Parameters:
o Output stream for the generated XML.

Definition at line 120 of file billingxml.h.

virtual OSB_LIB::BillingXmlBase::~BillingXmlBase (  )  [inline, virtual]

Destructor.

Definition at line 127 of file billingxml.h.


Member Function Documentation

virtual void OSB_LIB::BillingXmlBase::writeInvoice ( Invoice invoice,
const Contract contract,
const AssociateList associates 
) [pure virtual]

XML writer for an OSB invoice.

This is the starting point to write an OSB XML invoice. Its main task is to invoke the writeXml() method of each invoice item on the invoice. In addition, it prints an XML header and footer and before each invoice item is written, it prints its section.

This method should not need to be overwritten except if you want to change the basic structure of an XML invoice. Instead, changes to the contents of XML invoices can be made by adding new invoice items and corresponding XML writers or customizing existing XML writers.

Here is the default implementation of writeInvoice():

          void BillingXml::writeInvoice(Invoice& invoice,
                                        const Contract& contract,
                                        const AssociateList& associates)
          {
              writeXmlHeader();
              for (Invoice::ItemListI i=invoice.itemListBegin();
                   i != invoice.itemListEnd(); ++i) {
                  writeSection((*i)->section(), contract, associates);
                  (*i)->writeXml(*this);
              }
              writeXmlFooter();
          }

Parameters:
invoice The invoice to be written.
contract Contract for which the invoice is generated.
associates List of all associates (owner and all product users) related to the contract.

Implemented in OSB_LIB::BillingXml.

virtual void OSB_LIB::BillingXmlBase::writeXmlFooter (  )  [pure virtual]

Write XML invoice footer.

Implemented in OSB_LIB::BillingXml.

virtual void OSB_LIB::BillingXmlBase::writeXmlHeader (  )  [pure virtual]

Write XML invoice header.

Implemented in OSB_LIB::BillingXml.


Member Data Documentation

bool OSB_LIB::BillingXmlBase::globalSectionWritten_ [protected]

Flag that indicates if the global section string was written. (Also needed by the section XML writer.).

Definition at line 203 of file billingxml.h.

Section OSB_LIB::BillingXmlBase::last_ [protected]

Previous section.

The Section XML writer needs to know the previous section. We store it in an object and, to be thread-safe, it must be a local object in the thread.

Definition at line 197 of file billingxml.h.

OsbXml OSB_LIB::BillingXmlBase::xml

This object provides general XML write support.

Definition at line 187 of file billingxml.h.


The documentation for this class was generated from the following file:
Generated on Sat Sep 2 14:09:53 2006 for OSB Library by  doxygen 1.4.7