internal package Foswiki::Configure::Item

See PublishedAPI for packages intended to be used by Plugin and Contrib authors, or browse all packages.
See also Developing plugins, Developer's Bible, Technical Overview

package Foswiki::Configure::Item

Abstract base class of all configuration components. A configuration component may be a collection item (a ConfigSection), an individual Value, or a checker associated with a value (or a node in a checker tree).

Objects of this class are intended to form a tree with references in both directions, circular references ahead. But configure isn't supposed to be run in a persistent environment anyway.

ObjectMethod getDepth() → $integer

Get the depth of the item in the item tree, where the root is at depth 0, it's children at depth 1, etc.

ObjectMethod addToDesc($str)

Concatenate $str to the description of this item.

ObjectMethod isExpertsOnly() → $boolean

Is the item tagged EXPERT?

By default, no node is expert.

ObjectMethod set(%params)

Accept an attribute setting for this item (e.g. a key name). Sort of a generic write accessor.

ObjectMethod inc($key)

Increment a numeric value identified by $key, recursing up the tree to the root.

Assumptions
  • All item levels have $key defined and initialized
  • Parents of items are items (or more precisely: can inc())

This is used for counting the numbers of warnings, errors etc found in subtrees of the configuration structure.

ObjectMethod getSectionObject($head, $depth) → $item

This gets the section object that has the heading $head and getDepth() == $depth below this item.

Subclasses must provide an implementation.

ObjectMethod getValueObject($keys) → $value

Get the first Value object associated with this item. The default implementation is the tree node implementation; it just queries children. Keys are only present on leaf items.

Subclasses must define this method.

ObjectMethod needsSaving() → $integer

Return the number of items in this subtree that need saving.

The default implementation always returns 0

ObjectMethod visit($visitor) → $boolean

Start a visit over this item.

The default implementation just visits this item, and returns 1 if both the startVisit and the endVisit returned true.

Topic revision: r1 - 19 Apr 2011, ProjectContributor
 
This site is powered by FoswikiCopyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding FAIR Wiki? Send feedback