Version 1.0, Copyright ã1996 by Daniel Bðhringer.  All Rights Reserved.
Daniel Bðhringer  --  Fri Apr 12 14:33:37 MET DST 1996

MiscTree(Search)

Declared In:	<misckit/MiscTree.Search.h>

Category Description

The MiscTree Search category adds seach capabilities to the MiscTree class by comparing each of a MiscTree's nodes to either a MiscString or an id. You can specify whether comparing is done against the the label or value. Furthermore convenience methods are provided to select the corresponding cell of a NXBrowser ± given the case that the receiver is used as a browser-loader (set the delegate of e.g. MiscSplitBrowser or NXBrowser). Note that (of course) only those objects are found that lay below the receiver in the MiscTree hierarchy. It is therefore recommended to send the methods listed below only to the root MiscTree node.

Note that the selection-methods listed below will work improperly when labels contain the character '/'. This is due to the fact that the pathSeparator is hard coded in MiscTree and we are a category here (no ivars).

Method Types

Finding nodes in a tree	-listOfOccurence:
	-listOfOccurence: useLabel: regex:
	-listOfOccurence: useLabel: cmp:

Selecting cells in a Browser	-selectNode: inBrowser:
	-selectString: inBrowser:
	-selectValueId: inBrowser:

Category Methods

listOfOccurence:
listOfOccurence: useLabel: regex:
listOfOccurence: useLabel: cmp:
±(MiscList *) listOfOccurence:(MiscString *)search
useLabel:(BOOL)useIt
cmp:(MiscTreeCmpMode_t)compareToken
±(MiscList *) listOfOccurence:(MiscString *)search
useLabel:(BOOL)useLabel
regex:(BOOL)useRegex

These methods traverse the tree hierarchy below the receiving MiscTree and put every matching node into a MiscList. If no match is found nil is returned; a MiscList containing the matching tokens otherwise. If useLabel is given as YES then comparing is done against the nodes' labels; otherwise the values are compared. useLabel defaults to NO and cmp defaults to MiscTreeCmp_strcmp in the degenerate methods. 

See Constants and Defined types below for a listing of supported compare modes for compareToken.

Note that e.g.  MiscTreeCmp_idcmp can not be applied to labels and MiscTreeCmp_regex assumes the node's value is a MiscString. So unless you are careful to match the comparingToken to your MiscTree-configuration your code may crash.
Note that since the MiscList does not contain copys but the original nodes you are not responsible for freeing the nodes but only for freeing the returned MiscList. 

See also:   ± selectValueId: inBrowser:

selectNode: inBrowser:
± selectNode:(MiscTree *)searchNode inBrowser:theBrowser

This method tries to select the browserCell representing searchNode in theBrowser. This method assumes that searchNode  is below the receiver in the tree hierarchy and that the receiver is theBrowser's delegate.

Note that due to a known bug in MiscTree this method may work improperly when multiple nodes in the same hierarchy-level have identically spelling lables. 

See also:   ± selectString: inBrowser:

selectString: inBrowser:
± selectString:(const char *)search inBrowser:theBrowser

This method tries to select the first browserCell in theBrowser whose stringValue is identical to search. This method assumes that the receiver is theBrowser's delegate.

See also:   ± selectNode:inBrowser:

selectValueId: inBrowser:
± selectValueId: searchId inBrowser: theBrowser

This method tries to select the first browserCell in theBrowser whose representing node's value is identical to searchId. This method assumes that the receiver is theBrowser's delegate.

Note that although discouraged it is possible whith some casting to hook ints as  values for MiscTrees and then use them as tags for searching with selectNode:inBrowser:.

See also:   ± selectNode:inBrowser:

Constants and Defined Types

typedef enum {
	MiscTreeCmp_strcmp=0,				// same as strcmp()
	MiscTreeCmp_regex,							// regular expression
	MiscTreeCmp_idcmp,							// pointer comparison
	MiscTreeCmp_casestrcmp,		// case-insensitive strcmp
	MiscTreeCmp_caseregex				// case-insensitive regular expression
} MiscTreeCmpMode_t;