Add a blank heading to the tree. No article so the _navitem only has the article title
| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | hdsNavtree::AddHead | (hzString&,hzString&,hzString&,bool,) |
Declared in file: hzDissemino.h
Defined in file : hdsNavtree.cpp
Function Logic:
Function body:
hzEcode hdsNavtree::AddHead (hzString& parent)hzString& refname, hzString& title, bool bSlct,
{
// Add a blank heading to the tree. No article so the _navitem only has the article title
//
// Arguments: 1) parent The parent node to this blank heading
// 2) refname Unique name of heading
// 3) title Heading title as visible to user
// 4) bSlct Show the heading as open/closed in the navtree
//
// Returns: E_ARGUMENT if either the refname or title is not supplied
// E_DUPLICATE if the refname already exists as a tree item (exits)
// E_OK Operation successful
_hzfunc("hdsNavtree::AddHead(1)") ;
_navitem item ; // New tree item
_navitem parItem ; // Parent item
// Qualify item
if (!refname) return hzerr(E_ARGUMENT, "%s: No item refname supplied", *m_Groupname) ;
if (!title) return hzerr(E_ARGUMENT, "%s: No item title supplied", *m_Groupname) ;
if (m_ItemsByName.Exists(refname))
hzexit(E_DUPLICATE, "%s: Heading %s (%s) already exists", *m_Groupname, *refname, *title) ;
if (parent)
{
if (!m_ItemsByName.Exists(parent))
return hzerr(E_NOTFOUND, "%s: Heading %s (%s): Stated parent (%s) does not exist", *m_Groupname, *refname, *title, *parent) ;
parItem = m_ItemsByName[parent] ;
}
item.m_Title = title ;
if (bSlct)
item.m_bFlags |= HZ_TREEITEM_OPEN ;
item.m_bFlags |= HZ_TREEITEM_LINK ;
if (!parent)
item.m_nLevel = 0;
else
item.m_nLevel = parItem.m_nLevel + 1;
m_ItemsByParent.Insert(parent, refname) ;
m_ItemsByName.Insert(refname, item) ;
return E_OK ;
}