| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | hdbADP::Export | (void) |
Declared in file: hzDatabase.h
Defined in file : hdbClass.cpp
Function Logic:
Function body:
hzEcode hdbADP::Export (void)
{
_hzfunc("hdbADP::Export") ;
hzMapS <uint32_t,const hdbClass*> classesById ;
ofstream os ;
ifstream is ;
hzChain Z ;
hzChain Y ;
const hdbEnum* pEnum ;
const hdbClass* pClass ;
hzString fname ;
hzString bkfile ;
uint32_t nC ;
hzEcode rc = E_OK ;
fname = "/etc/hzDelta.d/" + m_appName + ".adp" ;
bkfile = "/etc/hzDelta.d/" + m_appName + ".bak" ;
threadLog("Exporting ADP to %s\n", *fname) ;
if (TestFile(*fname) == E_OK)
{
is.open(*fname) ;
Y << is ;
is.close() ;
}
Z.Printf("<AppDeltaProfile app="%s">\n" , *m_appName) ;
for (nC = 0; nC < m_mapEnums.Count() ; nC++)
{
pEnum = m_mapEnums.GetObj(nC) ;
Z.Printf("\t<enum name="%s"/>\n" , pEnum->txtType()) ;
}
for (nC = 0; nC < m_mapClasses.Count() ; nC++)
{
pClass = m_mapClasses.GetObj(nC) ;
classesById.Insert(pClass->ClassId(), pClass) ;
}
for (nC = 0; nC < classesById.Count() ; nC++)
{
pClass = classesById.GetObj(nC) ;
pClass->DescClass(Z, 1);
}
Z << "</AppDeltaProfile>\n" ;
if (Y.Size())
{
if (Y == Z)
{ threadLog("ADP is an exact match\n") ; return E_OK ; }
threadLog("Backing up ADP\n") ;
Filecopy(*bkfile, *fname) ;
}
threadLog("Exporting current ADP\n") ;
os.open(*fname) ;
os << Z ;
os.close() ;
return rc ;
}