github.com/256dpi/max-go@v0.7.0/lib/max/ext_xmltree.h (about)

     1  #ifndef _EXT_XMLTREE_H_
     2  #define _EXT_XMLTREE_H_
     3  
     4  #include "ext_prefix.h"
     5  #include "ext_mess.h"
     6  #include "ext_linklist.h"
     7  #include "ext_sysfile.h"
     8  
     9  #ifdef __cplusplus
    10  extern "C" {
    11  #endif
    12  
    13  // opaque type definitions
    14  
    15  typedef struct _xmltree_node t_xmltree_node;
    16  typedef struct _xmltree_charnode t_xmltree_charnode ;
    17  typedef struct _xmltree_text t_xmltree_text;
    18  typedef struct _xmltree_comment t_xmltree_comment;
    19  typedef struct _xmltree_cdata t_xmltree_cdata;
    20  typedef struct _xmltree_attribute t_xmltree_attribute;
    21  typedef struct _xmltree_element t_xmltree_element;
    22  typedef struct _xmltree_document t_xmltree_document;
    23  
    24  // prototypes
    25  
    26  // xmltree_node
    27  t_max_err xmltree_node_addinterface(t_class *c);
    28  t_max_err xmltree_node_sortchildlist(t_xmltree_node *x, long cmpfn(void *, void *));
    29  t_max_err xmltree_node_insertbefore(t_xmltree_node *x, t_xmltree_node *newchild, t_xmltree_node *refchild);
    30  t_max_err xmltree_node_replacechild(t_xmltree_node *x, t_xmltree_node *newchild, t_xmltree_node *refchild);
    31  t_max_err xmltree_node_removechild(t_xmltree_node *x, t_xmltree_node *refchild);
    32  t_max_err xmltree_node_appendchild(t_xmltree_node *x, t_xmltree_node *newchild);
    33  t_atom_long xmltree_node_haschildnodes(t_xmltree_node *x);
    34  t_xmltree_node *xmltree_node_clonenode(t_xmltree_node *x, long deep);
    35  t_max_err xmltree_node_removeallchildren(t_xmltree_node *x);
    36  t_max_err xmltree_node_nodevalue(t_xmltree_node *x, void *attr, long ac, t_atom *av);
    37  t_max_err xmltree_node_getnodevalue(t_xmltree_node *x, void *attr, long *ac, t_atom **av);
    38  t_max_err xmltree_node_setnodevalasstring(t_xmltree_node *x, char *s);
    39  t_max_err xmltree_node_getnodevalasstring(t_xmltree_node *x, long *len, char **s);
    40  t_max_err xmltree_node_new(t_xmltree_node *x, t_symbol *nodetype);
    41  t_max_err xmltree_node_free(t_xmltree_node *x);
    42  // utils
    43  t_symbol *xmltree_node_getnodevalue_sym(t_xmltree_node *x);
    44  t_max_err xmltree_node_nodevalue_sym(t_xmltree_node *x, t_symbol *s);
    45  t_atom_long xmltree_node_getnodevalue_long(t_xmltree_node *x);
    46  t_max_err xmltree_node_nodevalue_long(t_xmltree_node *x, long c);
    47  float xmltree_node_getnodevalue_float(t_xmltree_node *x);
    48  t_max_err xmltree_node_nodevalue_float(t_xmltree_node *x, float f);
    49  long xmltree_node_getnodevalue_sym_array(t_xmltree_node *x, long max, t_symbol **vals);
    50  t_max_err xmltree_node_nodevalue_sym_array(void *x, long count, t_symbol **vals);
    51  long xmltree_node_getnodevalue_long_array(t_xmltree_node *x, long max, t_atom_long *vals);
    52  t_max_err xmltree_node_nodevalue_long_array(void *x, long count, long *vals);
    53  long xmltree_node_getnodevalue_float_array(t_xmltree_node *x, long max, float *vals);
    54  t_max_err xmltree_node_nodevalue_float_array(void *x, long count, float *vals);
    55  
    56  
    57  // xmltree_charnode
    58  t_max_err xmltree_charnode_addinterface(t_class *c);
    59  char *xmltree_charnode_substringdata(t_xmltree_charnode *x, long offset, long count);
    60  t_max_err xmltree_charnode_appenddata(t_xmltree_charnode *x, char *data);
    61  t_max_err xmltree_charnode_insertdata(t_xmltree_charnode *x, long offset, char *data);
    62  t_max_err xmltree_charnode_deletedata(t_xmltree_charnode *x, long offset, long count);
    63  t_max_err xmltree_charnode_replacedata(t_xmltree_charnode *x, long offset, long count, char *data);
    64  t_max_err xmltree_charnode_new(t_xmltree_charnode *x, t_symbol *nodetype);
    65  t_max_err xmltree_charnode_free(t_xmltree_charnode *x);
    66  
    67  // xmltree_document
    68  void xmltree_document_filename(t_xmltree_document *x, t_object *attr, long argc, t_atom *argv);
    69  t_max_err xmltree_document_read(t_xmltree_document *x, t_symbol *s, long ac, t_atom *av);
    70  t_max_err xmltree_document_write(t_xmltree_document *x, t_symbol *s, long ac, t_atom *av);
    71  void xmltree_node_write(t_xmltree_node *x, t_filehandle fh, long depth);
    72  void xmltree_document_print(t_xmltree_document *x);
    73  t_xmltree_element *xmltree_document_createelement(t_xmltree_document *x, t_symbol *tagname);
    74  t_xmltree_text *xmltree_document_createtextnode(t_xmltree_document *x, char *data);
    75  t_xmltree_comment *xmltree_document_createcomment(t_xmltree_document *x, char *data);
    76  t_xmltree_cdata *xmltree_document_createcdatasection(t_xmltree_document *x, char *data);
    77  t_xmltree_attribute *xmltree_document_createattribute(t_xmltree_document *x, t_symbol *name);
    78  t_linklist *xmltree_document_getelementsbytagname(t_xmltree_document *x, t_symbol *tagname);
    79  void xmltree_document_xmlparse_element_start(t_xmltree_document *x, const char *el, const char **attr);
    80  void xmltree_document_xmlparse_element_end(t_xmltree_document *x, const char *el);
    81  void xmltree_document_xmlparse_default(t_xmltree_document *x, const char *s, int len);
    82  void xmltree_document_xmlparse_characterdata(t_xmltree_document *x, const char *s, int len);
    83  void xmltree_document_xmlparse_cdata_start(t_xmltree_document *x);
    84  void xmltree_document_xmlparse_cdata_end(t_xmltree_document *x);
    85  void xmltree_document_xmlparse_comment(t_xmltree_document *x, const char *s);
    86  void xmltree_document_xmlparse_doctype_start(t_xmltree_document *x, const char *s);
    87  void xmltree_document_xmlparse_doctype_end(t_xmltree_document *x);
    88  void xmltree_document_createheader(t_xmltree_document *x, t_symbol *encoding);
    89  void xmltree_document_createprocessinginstruction(t_xmltree_document *x, t_symbol *target, t_symbol *data);
    90  void *xmltree_document_new(t_symbol *s, long argc, t_atom *argv);
    91  void xmltree_document_free(t_xmltree_document *x);
    92  
    93  // xmltree_element
    94  t_max_err xmltree_element_getattribute(t_xmltree_element *x, t_symbol *attrname, long *ac, t_atom **av);
    95  t_max_err xmltree_element_setattribute(t_xmltree_element *x, t_symbol *attrname, long ac, t_atom *av);
    96  t_max_err xmltree_element_removeattribute(t_xmltree_element *x, t_symbol *attrname);
    97  t_xmltree_attribute *xmltree_element_getattributenode(t_xmltree_element *x, t_symbol *attrname);
    98  t_xmltree_attribute *xmltree_element_setattributenode(t_xmltree_element *x, t_xmltree_attribute *attr);
    99  t_xmltree_attribute * xmltree_element_removeattributenode(t_xmltree_element *x, t_xmltree_attribute *attr);
   100  t_linklist *xmltree_element_getelementsbytagname(t_xmltree_element *x, t_symbol *tagname);
   101  long xmltree_element_symcompare(t_xmltree_attribute *x,t_symbol *name);
   102  void *xmltree_element_new(t_symbol *s, long argc, t_atom *argv);
   103  void xmltree_element_free(t_xmltree_element *x);
   104  // utils
   105  t_symbol *xmltree_element_getattribute_sym(t_xmltree_element *x, t_symbol *attrname);
   106  t_max_err xmltree_element_setattribute_sym(t_xmltree_element *x, t_symbol *attrname, t_symbol *s);
   107  t_atom_long xmltree_element_getattribute_long(t_xmltree_element *x, t_symbol *attrname);
   108  t_max_err xmltree_element_setattribute_long(t_xmltree_element *x, t_symbol *attrname, t_atom_long c);
   109  float xmltree_element_getattribute_float(t_xmltree_element *x, t_symbol *attrname);
   110  t_max_err xmltree_element_setattribute_float(t_xmltree_element *x, t_symbol *attrname, float f);
   111  long xmltree_element_getattribute_sym_array(t_xmltree_element *x, t_symbol *attrname, long max, t_symbol **vals);
   112  t_max_err xmltree_element_setattribute_sym_array(void *x, t_symbol *attrname, long count, t_symbol **vals);
   113  long xmltree_element_getattribute_long_array(t_xmltree_element *x, t_symbol *attrname, long max, t_atom_long *vals);
   114  t_max_err xmltree_element_setattribute_long_array(void *x, t_symbol *attrname, long count, long *vals);
   115  long xmltree_element_getattribute_float_array(t_xmltree_element *x, t_symbol *attrname, long max, float *vals);
   116  t_max_err xmltree_element_setattribute_float_array(void *x, t_symbol *attrname, long count, float *vals);
   117  
   118  // xmltree_attribute
   119  long xmltree_attr_symcompare(t_xmltree_attribute *x,t_symbol *name);
   120  void *xmltree_attribute_new(t_symbol *s, long argc, t_atom *argv);
   121  void xmltree_attribute_free(t_xmltree_attribute *x);
   122  
   123  // xmltree_text
   124  void *xmltree_text_new(t_symbol *s, long argc, t_atom *argv);
   125  t_xmltree_text *xmltree_text_splittext(t_xmltree_text *x, long offset);
   126  void xmltree_text_free(t_xmltree_text *x);
   127  
   128  // xmltree_comment
   129  void *xmltree_comment_new(t_symbol *s, long argc, t_atom *argv);
   130  void xmltree_comment_free(t_xmltree_comment *x);
   131  
   132  // xmltree_cdata
   133  void *xmltree_cdata_new(t_symbol *s, long argc, t_atom *argv);
   134  t_xmltree_cdata *xmltree_cdata_splittext(t_xmltree_cdata *x, long offset);
   135  void xmltree_cdata_free(t_xmltree_cdata *x);
   136  
   137  #ifdef __cplusplus
   138  }
   139  #endif
   140  	
   141  #endif //_EXT_XMLTREE_H_