1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
|
module entity
{
/* Entity node type - usually 'ENode' */
typedef entity::node ENode;
/* List of nodes */
typedef sequence<entity::node> ENode_List;
/* List of attributes */
typedef sequence<string> Attrib_List;
/* EBuf, implemented differently in C, but essentially a
* binary-capable string */
typedef string EBuf;
interface node
{
/***********************************************************
* Base Interface
**********************************************************/
/* Create new child node. New attribs can be optionally assigned
during creation. basename argument can be of form type[.name] */
ENode new_child (in string basename,
in Attrib_List attribs);
/* Returns the element type */
EBuf type (void);
/* Returns the path to a node */
EBuf path (void);
/* Return type.name for node */
EBuf basename (void);
/* Return a description of this node type */
string description (void);
/***********************************************************
* Node Search Routines
**********************************************************/
/* Returns immediate parent node if search is NULL, or will search
* upwards if given search string, for type[.name] */
ENode parent (in string search);
/* Search for a child by name[.type] */
/* synonymous with enode (); */
ENode child (in string search);
/* Search for a child given regex on type.name. Returns
* First correct match */
/* synonymous with enode_rx (); */
ENode child_rx (in string regex);
/* Return list of children matching name[.type]
* Giving search as NULL, provides list of immediate,
* 1st level children */
/* synonymous with elist (); */
ENode_List children (in string search);
/* Search through children using regex on type.name, returning
* a list of those that match */
/* synonymous with elist_rx (); */
ENode_List children_rx (in string regex);
/* Search the tree for children who have an attribute that
* matches a specific value. */
ENode_List children_attrib (in string attrib,
in string value);
/* Search the tree for children who have an attribute that
* matches a regex. */
ENode_List children_attrib_rx (in string attrib,
in string regex);
/***********************************************************
* Object Based Utils
**********************************************************/
/* call a subroutine in another object independant of implementation
* language used in that object. The calling node will be inserted
* as the first parameter passed. */
string call (in ENode obj,
in string func_name,
in string args);
/***********************************************************
* Attribute Properties, and Attribute Support Queries
**********************************************************/
/* Get or set a node attribute. If value is left out,
* returns current value, and does not set */
EBuf attrib (in string attribute, in EBuf value);
/* Identical to the above, except the change does not trigger
* an event. This is to be used _inside renderers only_ (!), to avoid
* infinite loops */
EBuf attrib_quiet (string attribute, in EBuf value);
/* Return true/false as to whether attribute is true */
boolean attrib_is_true (in string attrib);
/* Return a list of attributes that are set in this node */
Attrib_List list_set_attribs (void);
/* Return a list of all supported attributes for this node */
Attrib_List supported_attribs (void);
/* Return a description of the attribute */
string attrib_description (in string attribute);
/* Return the common value type for this attribute
* (eg, string, integer etc.) */
string attrib_value_type (in string attribute);
/* Returns more information about the value. A comma
* seperated list of possible values, a range of integer
* values etc. */
string attrib_possible_values (in string attribute);
/* Syncronize attributes to renderer by calling the
* attribute set notify method for each attribute set
* in the node. Should only be used by renderers */
void attribs_sync (void);
/***********************************************************
* Arbitrary key/value Attachment - I dunno about
* this yet. ignore it :)
**********************************************************/
/* This is used to attach arbitrary data to a node for later use.
Data attached in this manner is not saved in any way. I'm pretty
sure this should only be used by renderers. Also note that the
string arguments here are replaced with generic pointers in C
implementation. To be used only if you know what you are doing! */
/* Set a value in a node */
void set_kv (in string key, in string value);
/* Get a set value */
string get_kv (in string key);
/***********************************************************
* Node destruction
**********************************************************/
/* Delete node and all children */
void destroy (void);
/* Delete child nodes */
void destroy_children (void);
/***********************************************************
* Raw XML Interfaces
**********************************************************/
/* Return XML for yourself and all children */
EBuf get_xml (void);
/* Return XML for your children */
EBuf get_child_xml (void);
/* Append xml to children of yourself. This will instantiate
* the ENodes into the tree */
void append_xml (in EBuf xml);
/***********************************************************
* Node Data interface
**********************************************************/
/* Set data to a given value, overriding current */
void set_data (in EBuf data);
EBuf get_data (void);
void append_data (in EBuf data);
void insert_data (in unsigned long offset,
in EBuf data);
void delete_data (in unsigned long offset,
in unsigned long count);
}
}
|