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:
- A name, displayed by BeHappy.
- A label, which is a specific position in an HTML file:
- A file name
- The label name in the file. The full name of the label will be file name#label name.
- An optional info string.
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(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:
- proj is the HTMLProject who creates the link. Usualy you create the link inside a HTMLProject::Update() method, so this parameter will be this.
- name is its name.
- link is the link (file name and label).
- info (optional) an info string, that can be displayed by BeHappy when the mouse pointer is over the link.
Another version extract these informations from a BDataIO object, an archive.
The last version is a copy constructor.
Destroys the HappyLink, its brothers, and its children.
Member Functions
Adds a child to the HappyLink. If the HappyLink already has children, newChild will be added at the end. See also AddChildSorted()
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.
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.
|
|
|
unsigned int CountItems()
| |
Counts the number of brothers and children, including the current HappyLink.
Prints to the standard output the name of the HappyLink, as well as those of its brothers and children.
You shouldn't have to use this
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.
Remove child from the HappyLink's children. Returns true if child was successfully removed, and false if it wasn't found.
|
|
|
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:
- If list is NULL, the function returns the first HappyLink it finds with the name nameToSearch. If none is found, it returns NULL.
- If it isn't NULL, then the function will fill the supplied list with all the HappyLinks found with the nameToSearch. The function always return NULL in that case. If no HappyLink is found, the list stays empty.
See also Find()
You shouldn't have to use this
Changes the HappyLink's current HTML link, to link in the project proj.