home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
CLASS.ZIP
/
TREE.CC
< prev
next >
Wrap
Text File
|
1993-02-16
|
2KB
|
86 lines
#include "tree.h"
#ifdef INCLUDESOURCE
#include "chain.cc"
#endif
int tree::toBeCalledForeachElement(unsigned int iMsg, void *pDummy)
{ int ret;
#ifdef SHOWCALLS
fprintf(stderr, "Calling tree::toBeCalledForeachElement(%x)!\n", this);
#endif
switch (ret = toBeCalledPre(iMsg, pDummy))
{ case 0:
break;
case -1:
return 0;
default:
return ret;
}
if (ret = foreach(iMsg, pDummy))
return ret;
return toBeCalledPost(iMsg, pDummy);
}
int tree::toBeCalledPre(unsigned int iMsg, void *pDummy)
{
#ifdef SHOWCALLS
fprintf(stderr, "Calling tree::toBeCalledPre(%x)!\n", this);
#endif
switch (iMsg)
{ case idForeachTreeDeletePreChilds:
delete this;
return -1;
case idForeachTreeDeletePostChilds:
return 0;
default:
return 0;
case idForeachTreeSearchPreChilds:
return chainElement::toBeCalledForeachElement(
idForeachChainElementSearch, pDummy);
case idForeachTreeSearchPostChilds:
return 0;
}
return 0;
}
int tree::toBeCalledPost(unsigned int iMsg, void *pDummy)
{
#ifdef SHOWCALLS
fprintf(stderr, "Calling tree::toBeCalledPost(%x)!\n", this);
#endif
switch (iMsg)
{ case idForeachTreeDeletePreChilds:
abort();
return -1;
case idForeachTreeDeletePostChilds:
delete this;
return 0;
case idForeachTreeSearchPostChilds:
return chainElement::toBeCalledForeachElement(
idForeachChainElementSearch, pDummy);
case idForeachTreeSearchPreChilds:
return 0;
default:
return chainElement::toBeCalledForeachElement(iMsg, pDummy);
}
}
tree::~tree(void)
{
#ifdef SHOWCALLS
fprintf(stderr, "Calling ~tree(%x)!\n", this);
#endif
}
tree::tree(chain *pParent):chainElement(pParent), chain()
{
#ifdef SHOWCALLS
fprintf(stderr, "Calling tree(%x)!\n", this);
#endif
}