Return TypeFunction nameArguments
hzEcodehzFileset::Export(const char*,)

Declared in file: hzDirectory.h
Defined in file : hzDirectory.cpp

Function Logic:

0:START 1:!filepath||!filepath[0] 2:Return E_ARGUMENT 3:ofstream::open ofstream::fail 4:os.fail() 5:Return E_OPENFAIL 6:hzMapS::Count FormalNumber hzChain::Printf hzMapM::Count FormalNumber hzChain::Printf items ofstream::fail 7:os.fail() 8:Return E_WRITEFAIL 9:nD 10:hzMapS::GetObj pDX hzDirent::Inode hzDirent::Mode hzDirent::Size hzDirent::Ctime hzDirent::Mtime hzDirent::Owner hzDirent::Group hzDirent::txtName sprintf items hzDirent::strName hzMapM::First fileLo 11:fileLo<0 12:hzDirent::strName hzMapM::Last fileHi nF 13:nF<=fileHi; 14:hzMapM::GetObj pFX hzDirent::IsDir 15:pFX->IsDir() 16:hzDirent::Size totSize hzDirent::Inode hzDirent::Mode hzDirent::Size hzDirent::Ctime hzDirent::Mtime hzDirent::Owner hzDirent::Group hzDirent::txtName sprintf items 17:os.fail() 18:Return E_WRITEFAIL 19:FormalNumber close 20:Return E_OK

Function body:

hzEcode hzFileset::Export (const char* filepath)
{
   _hzfunc("hzFileset::Export()") ;
   hzList<hzDirent*>::Iter I ;
   std::ofstream   os ;
   hzChain     Z ;
   hzDirent*   pDX ;
   hzDirent*   pFX ;
   uint32_t    totSize = 0;
   uint32_t    nD ;
   uint32_t    nF ;
   uint32_t    fileLo ;
   uint32_t    fileHi ;
   char        cvLine  [512];
   if (!filepath || !filepath[0])
       return E_ARGUMENT ;
   os.open(filepath) ;
   if (os.fail())
       return E_OPENFAIL ;
   Z.Printf("# Export: %s Directories\n", FormalNumber(m_dirs.Count(),0));
   Z.Printf("# Export: %s Files\n", FormalNumber(m_file.Count(),0));
   os << Z ;
   if (os.fail())
       return E_WRITEFAIL ;
   for (nD = 0; nD < m_dirs.Count() ; nD++)
   {
       pDX = m_dirs.GetObj(nD) ;
       sprintf(cvLine, "D %010d %08x %010u %010u %010u %05d %05d %s\n",
           pDX->Inode(), pDX->Mode(), pDX->Size(), pDX->Ctime(), pDX->Mtime(), pDX->Owner(), pDX->Group(), pDX->txtName()) ;
       os << cvLine ;
       fileLo = m_file.First(pDX->strName()) ;
       if (fileLo < 0)
           continue ;
       fileHi = m_file.Last(pDX->strName()) ;
       for (nF = fileLo ; nF <&eq; fileHi ; nF++)
       {
           pFX = m_file.GetObj(nF) ;
           if (pFX->IsDir())
               continue ;
           totSize += pFX->Size() ;
           sprintf(cvLine, "F %010d %08x %010u %010u %010u %05d %05d %s\n",
               pFX->Inode(), pFX->Mode(), pFX->Size(), pFX->Ctime(), pFX->Mtime(), pFX->Owner(), pFX->Group(), pFX->txtName()) ;
           os << cvLine ;
       }
   }
   if (os.fail())
       return E_WRITEFAIL ;
   os << "# Export Complete - total " << FormalNumber(totSize,0)<< " bytes\n" ;
   os.close() ;
   return E_OK ;
}