VuoTree implementation.
Definition in file VuoTree.cc.
Go to the source code of this file.
Classes | |
struct | ChildInfo |
Helper for VuoTree_serializeXmlNodeAsJson() . More... | |
Functions | |
static void | VuoTree_freeXmlDoc (void *value) |
Frees an xmlDoc . More... | |
static void | VuoTree_freeJsonObject (void *value) |
Releases a json_object . More... | |
static VuoTree | VuoTree_makeFromXmlNode (xmlNode *node) |
Returns a tree whose root is node. More... | |
static VuoTree | VuoTree_makeFromXmlDoc (xmlDoc *doc) |
Returns a tree whose root is the root node of doc. More... | |
static xmlNodePtr | VuoTree_boilDownPropertyList (xmlNodePtr plist) |
Converts Apple's weird double-encoded Property List XML format into a straightforward XML document. More... | |
static VuoTree | VuoTree_parseXml (const char *xmlString, bool includeWhitespace) |
Converts an XML string to a VuoTree. More... | |
static xmlChar * | VuoTree_serializeXmlNodeAsXml (VuoTree tree, bool indent, int level) |
Converts the tree's root XML node and children to an XML string. More... | |
as an attribute. | |
Returns a new XML node with name as its name if it's a valid element name, otherwise | |
static xmlNode * | createXmlNode (const char *name) |
Converts a JSON string to a VuoTree. More... | |
static VuoTree | VuoTree_parseJson (const char *jsonString) |
Converts a JSON string to a VuoTree. More... | |
static json_object * | createJsonString (const char *s) |
Helper for VuoTree_serializeXmlNodeAsJson() . More... | |
static void | addToContainer (json_object *container, const char *key, json_object *value) |
Helper for VuoTree_serializeXmlNodeAsJson() . More... | |
static json_object * | VuoTree_serializeXmlNodeAsJson (VuoTree tree, bool atRoot) |
Converts an xmlNode partway to a JSON-formatted string. More... | |
VuoTree | VuoTree_makeFromJson (struct json_object *js) |
Decodes the JSON object js to create a new value. More... | |
struct json_object * | VuoTree_getJson (const VuoTree value) |
Encodes value as a JSON object that can only be decoded in the same process. More... | |
struct json_object * | VuoTree_getInterprocessJson (const VuoTree value) |
Encodes value as a JSON object that can be decoded in a separate process. More... | |
char * | VuoTree_getSummary (const VuoTree value) |
Returns a human-readable description of value. More... | |
VuoTree | VuoTree_makeEmpty (void) |
Returns a tree with nothing in it. More... | |
VuoTree | VuoTree_make (VuoText name, VuoDictionary_VuoText_VuoText attributes, VuoText content, VuoList_VuoTree children) |
Returns a tree that consists of the given components. More... | |
VuoTree | VuoTree_makeFromJsonText (VuoText json) |
Returns a tree parsed from json. More... | |
VuoTree | VuoTree_makeFromXmlText (VuoText xml, bool includeWhitespace) |
Returns a tree parsed from xml. More... | |
VuoText | VuoTree_serializeAsXml (VuoTree tree, bool indent) |
Returns an XML-formatted string representation of a tree. More... | |
VuoText | VuoTree_serializeAsJson (VuoTree tree, bool indent) |
Returns an JSON-formatted string representation of a tree. More... | |
void | VuoTree_retain (VuoTree value) |
Replaces the auto-generated function. More... | |
void | VuoTree_release (VuoTree value) |
Replaces the auto-generated function. More... | |
VuoText | VuoTree_getName (VuoTree tree) |
Returns the name of the tree's root item. More... | |
VuoDictionary_VuoText_VuoText | VuoTree_getAttributes (VuoTree tree) |
Returns the attributes of the tree's root item. More... | |
VuoText | VuoTree_getAttribute (VuoTree tree, VuoText attribute) |
Returns the value of the attribute with the given name in the tree's root item, or an empty text if not found. More... | |
static xmlChar * | VuoTree_getContentOfXmlNode (xmlNode *node) |
Returns the content of node, not including content of descendants. More... | |
VuoText | VuoTree_getContent (VuoTree tree, bool includeDescendants) |
Returns the content of the tree's root item and, optionally, of its descendants. More... | |
VuoList_VuoTree | VuoTree_getChildren (VuoTree tree) |
Returns a list of the subtrees that are direct descendants of the tree's root item. More... | |
struct json_object * | VuoTree_getContainedValue (VuoTree tree) |
Interprets the content and children of the tree as a JSON representation of a Vuo data type value. More... | |
VuoList_VuoTree | VuoTree_findItemsUsingXpath (VuoTree tree, VuoText xpath) |
Returns the subtrees found by searching tree with XPath expression xpath, or an empty list if there's an error. More... | |
static bool | compareName (xmlNode *node, VuoText name, VuoTextComparison comparison, VuoText unused) |
Returns true if the subtree's name matches name. More... | |
static bool | compareAttribute (xmlNode *node, VuoText value, VuoTextComparison comparison, VuoText attribute) |
Returns true if the subtree has an attribute called attribute and its value matches value. More... | |
static bool | compareContent (xmlNode *node, VuoText content, VuoTextComparison comparison, VuoText unused) |
Returns true if the subtree's content matches content. More... | |
static VuoList_VuoTree | VuoTree_findItems (VuoTree tree, bool(*compare)(xmlNode *node, VuoText, VuoTextComparison, VuoText), VuoText targetText, VuoTextComparison comparison, VuoText attribute, bool includeDescendants, bool atFindRoot) |
Helper function for the VuoTree_findItemsWith* functions. More... | |
VuoList_VuoTree | VuoTree_findItemsWithName (VuoTree tree, VuoText name, VuoTextComparison comparison, bool includeDescendants) |
Searches tree for subtrees whose name matches name. More... | |
VuoList_VuoTree | VuoTree_findItemsWithAttribute (VuoTree tree, VuoText attribute, VuoText value, VuoTextComparison valueComparison, bool includeDescendants) |
Searches tree for subtrees that have an attribute called attribute (exact match) and its value matches value (based on valueComparison). More... | |
VuoList_VuoTree | VuoTree_findItemsWithContent (VuoTree tree, VuoText content, VuoTextComparison comparison, bool includeDescendants) |
Searches tree for subtrees whose content matches name. More... | |
Variables | |
static const char * | encoding = "UTF-8" |
The character encoding of XML text. More... | |
|
static |
Helper for VuoTree_serializeXmlNodeAsJson()
.
Adds value to container, which may be either an array or an object.
Definition at line 490 of file VuoTree.cc.
|
static |
Returns true if the subtree has an attribute called attribute and its value matches value.
Definition at line 1338 of file VuoTree.cc.
|
static |
Returns true if the subtree's content matches content.
This only checks the content of the tree item itself, not the content of its descendants.
Definition at line 1349 of file VuoTree.cc.
|
static |
Returns true if the subtree's name matches name.
Definition at line 1330 of file VuoTree.cc.
|
static |
Helper for VuoTree_serializeXmlNodeAsJson()
.
Creates a new JSON string from s minus its control characters.
Definition at line 464 of file VuoTree.cc.
|
static |
Converts a JSON string to a VuoTree.
Definition at line 318 of file VuoTree.cc.
|
static |
Converts Apple's weird double-encoded Property List XML format into a straightforward XML document.
Definition at line 104 of file VuoTree.cc.
|
static |
Helper function for the VuoTree_findItemsWith*
functions.
Traverses the eligible subtrees (determined by includeDescendants and atFindRoot) and checks if each matches the search parameters.
Definition at line 1360 of file VuoTree.cc.
|
static |
Releases a json_object
.
Definition at line 61 of file VuoTree.cc.
|
static |
Frees an xmlDoc
.
Definition at line 53 of file VuoTree.cc.
|
static |
Returns the content of node, not including content of descendants.
Definition at line 1057 of file VuoTree.cc.
|
static |
Returns a tree whose root is the root node of doc.
Use this function if this is the first VuoTree
to refer to the XML document. It assumes the XML document has not yet been registered.
If the document lacks a root node, doc is freed and an empty tree is returned.
Definition at line 87 of file VuoTree.cc.
|
static |
Returns a tree whose root is node.
Use this function if the XML node belongs to an existing VuoTree
. It assumes the node's XML document has already been registered.
Definition at line 73 of file VuoTree.cc.
|
static |
Converts a JSON string to a VuoTree.
Definition at line 329 of file VuoTree.cc.
|
static |
Converts an XML string to a VuoTree.
Definition at line 177 of file VuoTree.cc.
|
static |
Converts an xmlNode
partway to a JSON-formatted string.
(Not all the way, to avoid an extra copy.)
Assumes node is an element node.
Definition at line 503 of file VuoTree.cc.
|
static |
Converts the tree's root XML node and children to an XML string.
Definition at line 223 of file VuoTree.cc.
|
static |
The character encoding of XML text.
Definition at line 48 of file VuoTree.cc.