Natural Docs Version 1.2 |
NaturalDocs:: ClassHierarchy:: ClassAn object that stores information about a class in the hierarchy. It does not store its name; it assumes that it will be stored in a hashref where the key is the name. Summary
ArchitectureThis class is designed to handle multiple definitions of classes, even though that shouldn’t be typical. Some language may allow a package to be defined in one file and continued in another. It’s also possible that a class may be predeclared somewhere, or there is an interface/header declaration and a later source definition. The end result is that all of these definitions are coalesced into one simply by adding each’s parents to the list. This is why the functions AddParent() and DeleteParent() return whether they resulted in an actual change to the list of parents. The answer is not always yes. The class will handle all of the parent definitions internally. However, the same is not true for the children. Since every language defines the hierarchy via each class declaring its parents, that’s where all the internal management is focused. Doing the same for the children would be redundant and can be avoided if the calling code handles everything correctly. Important: The calling code is responsible for detecting when AddParent() and DeleteParent() return true, and adjusting the parent’s children list accordingly. The parent will not keep track of how many times it is declared the parent of the child. Note that it’s possible for these objects to exist, and even have children, without any definitions defined. This is because a class may be found to have a parent before that parent has been found in the source. Also, it’s possible that some parents simply won’t be in the documentation, such as those inherent to the language or in frameworks not documented with Natural Docs. MembersThe class is implemented as a blessed arrayref. The keys are the constants below.
DeleteDefinition
Removes the file definition of this class and returns true if there are no more definitions. Note that if there are no more definitions, you may still want to keep the object around if HasChildren() returns true. AddChild
Adds a child to the class. This only keeps track of if it has the child, not of the definitions. See Architecture. DeleteChild
Deletes a child from the class. This only keeps track of if it has the child, not of the definitions. See Architecture. |
sub New |
sub AddDefinition #(file) |
sub DeleteDefinition #(file) |
| ||||||||||
| ||||||||||
sub AddChild #(child) |
sub DeleteChild #(child) |
sub Parents |
sub HasParents |
sub ParentDefinitions #(parent) |
sub Children |
sub HasChildren |
sub Definitions |
sub IsDefinedIn #(file) |
sub IsDefined |