| Return Type | Function name | Arguments |
|---|---|---|
| void | hdsTable::Generate | (hzChain&,hzHttpEvent*,unsigned int&,) |
Declared in file: hzDissemino.h
Defined in file : hdsGenerate.cpp
Function Logic:
Function body:
void hdsTable::Generate (hzChain& C, hzHttpEvent* pE, unsigned int& nLine)
{
_hzfunc("hdsTable::Generate") ;
hzList<hdsCol>::Iter ci ;
hzVect<uint32_t> items ;
hdbObject obj ;
hdbIdset srchResult ;
hdsCol col ;
hdsVE* pVE ;
hzAtom atom ;
hzString value ;
uint32_t nFound ;
uint32_t objId ;
hzEcode rc ;
C.AddByte(CHAR_NL) ;
if (m_Criteria == "all")
nFound = m_pRepos->Count() ;
else
{
m_pRepos->Select(srchResult, *m_Criteria) ;
nFound = srchResult.Count() ;
}
if (nFound == 0)
{
for (pVE = m_pNone ; pVE ; pVE = pVE->Sibling())
pVE->Generate(C, pE, nLine) ;
}
else
{
C.Printf("<table width="%d" align="center" border="0" cellspacing="0" cellpadding="0" class="%s">\n" , m_nWidth, *m_CSS) ;
C.Printf("<tr valign="top" height="20"><td>Listing %d objects</td></tr>\n" , nFound) ;
C.Printf("<tr valign="top" height="%d">\n\t<td>\n" , m_nHeight) ;
C.Printf("\t<table width="%d" align="center" border="1" cellspacing="1" cellpadding="1" class="%s">\n" , m_nWidth, *m_CSS) ;
C << "\t<tr>\n" ;
for (ci = m_Cols ; ci.Valid() ; ci++)
{
col = ci.Element() ;
C.Printf("\t<th width="%d">%s</th>\n" , col.m_nSize, *col.m_Title) ;
}
C << "\t</tr>\n" ;
obj.Init(m_pRepos->Class()) ;
for (objId = 1; objId <&eq; nFound ; objId++)
{
rc = m_pRepos->Fetch(obj, objId) ;
if (rc != E_OK)
break ;
C << "\t<tr>" ;
for (ci = m_Cols ; ci.Valid() ; ci++)
{
col = ci.Element() ;
obj.GetValue(atom, m_pRepos->Class()->GetMember(col.m_mbrNo)) ;
if (atom.IsSet())
value = atom.Str() ;
else
value.Clear() ;
if (col.m_nSize)
C.Printf("<td width="%d">%s</td>" , col.m_nSize, *value) ;
else
C.Printf("<td>%s</td>", *value) ;
}
C << "</tr>\n" ;
}
C << "</table>\n" ;
}
}