Exports a HTML page to a file named as per the supplied file path.

Return TypeFunction nameArguments
hzEcodehzDocHtml::Export(hzString&,)

Declared in file: hzDocument.h
Defined in file : hzDocHtml.cpp

Function Logic:

0:START 1:unknown 2:Return hzerr(E_ARGUMENT,No pathname supplied) 3:unknown 4:unknown 5:Return hzerr(E_NODATA,Empty page (no root node). Nothing written to file %s\n,*filepath) 6:items items 7:unknown 8:Return hzerr(E_OPENFAIL,Could not open file %s\n,*filepath) 9:unknown 10:items 11:unknown 12:items 13:items 14:unknown 15:rc 16:items 17:unknown 18:unknown 19:rc 20:Z 21:items 22:unknown 23:rc 24:items 25:Return rc

Function body:

hzEcode hzDocHtml::Export (hzString& filepath)
{
   //  Exports a HTML page to a file named as per the supplied file path.
   //  
   //  Arguments: 1) filepath The file to export the HTML document to
   //  
   //  Returns: E_ARGUMENT If no export file path is supplied
   //     E_NODATA If there is no HTML elements in the document
   //     E_OPENFAIL If the supplied 
   //     E_WRITEFAIL If a write file occurs during export
   //     E_OK  If the export ran to completion
   _hzfunc("hzDocHtml::Export") ;
   ofstream    os ;        //  Output stream
   hzChain     Z ;         //  Working chain for output construction
   hzEcode     rc = E_OK ; //  Return code
   if (!filepath)
       return hzerr(E_ARGUMENT, "No pathname supplied") ;
   if (!m_pRoot)
   {
       if (!m_Content.Size())
           return hzerr(E_NODATA, "Empty page (no root node). Nothing written to file %s\n", *filepath) ;
   }
   //  Dump out to file
   os.clear() ;
   os.open(*filepath) ;
   if (os.fail())
       return hzerr(E_OPENFAIL, "Could not open file %s\n", *filepath) ;
   if (m_Info.m_urlReq)
       Z.Printf("URL (req): %s\n", *m_Info.m_urlReq) ;
   if (*m_Info.m_urlAct)
       Z.Printf("URL (act): %s\n", *m_Info.m_urlAct) ;
   os << Z ;
   if (os.fail())
       rc = E_WRITEFAIL ;
   Z.Clear() ;
   if (rc == E_OK)
   {
       if (m_pRoot)
           rc = _xport(Z, m_pRoot) ;
       else
           Z = m_Content ;
       os << Z ;
       if (os.fail())
           rc = E_WRITEFAIL ;
   }
   os.close() ;
   return rc ;
}