Natural Docs Version 0.9 |
NaturalDocs:: SymbolTable:: IndexElementA class representing part of an indexed symbol. Summary
How IndexElements WorkThis is a little tricky, so make sure you understand this. Indexes are sorted by symbol, then class, then file. If there is only one class for a symbol, or one file definition for a class/symbol, they are added inline to the entry. However, if there are multiple classes or definitions, the function for it returns an arrayref of IndexElements instead. Which members are defined and undefined should follow common sense. For example, if a symbol is defined in multiple classes, the symbol’s IndexElement will not define File(), Type(), or Prototype(); those will be defined in child elements. Similarly, the child elements will not define Symbol() since it’s redundant. Diagrams may be clearer. If a member isn’t listed for an element, it isn’t defined. A symbol that only has one class and definiton[Element] - Symbol - Class - File - Type - Prototype A symbol that is defined by multiple classes, each with only one definition[Element] - Symbol - Class [Element] - Class - File - Type - Prototype [Element] - ... A symbol that is defined by one class, but has multiple definitions[Element] - Symbol - Class - File [Element] - File - Type - Protype [Element] - ... A symbol that is defined by multiple classes which have multiple definitions[Element] - Symbol - Class [Element] - Class - File [Element] - File - Type - Prototype [Element] - ... [Element] - ... Why is it done this way?Because it makes it easier to generate nice indexes since all the splitting and combining is done for you. If a symbol has only one class, you just want to link to it, you don’t want to break out a subindex for just one class. However, if it has multiple classes, you do want the subindex and to link to each one individually. Whether Class() or File() returns an array or not determines whether you need to add a subindex for it. MembersThe class is implemented as a blessed arrayref. The following constants are its members.
New
Returns a new object. This should only be used for creating an entirely new symbol. You should not pass arrayrefs as class or file parameters if you are calling this externally. Use Merge() instead. Parameters
Merge
Adds another definition of the same symbol. Perhaps it has a different class or defining file. Parameters
Class
Returns the class of the symbol, if applicable. Will be undef for global, the name if there’s one definiton, or an arrayref of NaturalDocs::SymbolTable::IndexElement objects if there are multiple classes that define the symbol. File
Returns the file the class/symbol is defined in, if applicable. Will be the name if there’s one definition, or an arrayref of NaturalDocs::SymbolTable::IndexElement objects if there are multiple files that define the class/symbol. Type
Returns the type of the class/symbol/file, if applicable. Will be one of the Topic Types. MergeFile
Adds another definition of the same class/symbol. Perhaps the file is different. Parameters
|