module entity { /* Entity node type - usually 'ENode' */ typedef entity::node ENode; /* List of nodes */ typedef sequence ENode_List; /* List of attributes */ typedef sequence 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); } }