Return to DK Summary

The Classes

HappyLink

Derived from: none

Declared in: HappyLink.h

The HappyLink is the basic class to describe the indexes displayed by BeHappy. A HappyLink is made of two or three things:

You can add children to a HappyLink object using the AddChild() method. The happyList member of an HTMLProject is the top HappyLink. It's name is the name of the add-on, and its children are the different indexes used by BeHappy.


Constructor and Destructor

HappyLink()

                                                         
  

HappyLink()

HappyLink(HTMLProject *proj, const char *name, HTMLLabel *link, const char *info = NULL)

HappyLink(BDataIO *archive)

HappyLink(HappyLink &source)

Creates a new HappyLink. The usual constructor takes four parameters:

Another version extract these informations from a BDataIO object, an archive.

The last version is a copy constructor.


~HappyLink()

                                                         
  

~HappyLink()

Destroys the HappyLink, its brothers, and its children.


Member Functions

AddChild()

                                                         
  

void AddChild(HappyLink *newChild)

Adds a child to the HappyLink. If the HappyLink already has children, newChild will be added at the end. See also AddChildSorted()


AddChildSorted()

                                                         
  

void AddChildSorted(HappyLink *newChild)

Same as AddChild(), exept that newChild will be added at the best place to keep an alphabetical order. If all the children are added with this method, they will be ordered.


Archive()

You shouldn't have to use this
                                                         
  

status_t Archive(BDataIO *archive)

Archive all the contents of the HappyLink in the given archive. A HappyLink can be reconstructed from this archive using the third constructor. All the children are also archived, but not the brothers.


CountItems()

                                                         
  

unsigned int CountItems()

Counts the number of brothers and children, including the current HappyLink.


Dump()

                                                         
  

void Dump()

Prints to the standard output the name of the HappyLink, as well as those of its brothers and children.


Find()

You shouldn't have to use this
                                                         
  

bool Find(HappyLink **father, HappyLink **son, unsigned int linkNum)

Finds a HappyLink among the current HappyLink's children. It searches for the link with the given number linkNum. If the item is found, the function returns true and fill the two pointers father and son with the found HappyLink and its father. If the HappyLink isn't found, the function returns false.


RemoveChild()

                                                         
  

void RemoveChild(HappyLink *child)

Remove child from the HappyLink's children. Returns true if child was successfully removed, and false if it wasn't found.


Search()

                                                         
  

HappyLink *Search(const BString &nameToSearch, unsigned int generation = 1000, BList *list = NULL)

Searches for a specific name among the HappyLink's children: nameToSearch. generation is the number of generations Search() is allowed to search. You can use this method in two different ways:

See also Find()


UpdateLink()

You shouldn't have to use this
                                                         
  

void UpdateLink(HTMLProject *proj, HTMLLabel *link)

Changes the HappyLink's current HTML link, to link in the project proj.
Return to DK Summary