1 /* $Id: domnode.h,v 1.4 2003/09/12 21:06:45 legoater Exp $ 2 * 3 * Copyright 2001-2003, Meiosys (www.meiosys.com). All rights reserved. 4 * See the COPYING file for the terms of usage and distribution. 5 */ 6 7 #ifndef __sd_domnode_h 8 #define __sd_domnode_h 9 10 /** 11 * @file domnode.h @ingroup sd 12 * 13 * @brief Generic DOM object. 14 */ 15 16 #include <stdio.h> 17 #include <sd/list.h> 18 19 __SD_BEGIN_DECLS 20 21 typedef struct { 22 const char* name; 23 const char* value; 24 sd_list_t* children; 25 sd_list_t* attrs; 26 } sd_domnode_t; 27 28 extern sd_domnode_t* sd_domnode_new(const char* a_name, 29 const char* a_value); 30 31 extern void sd_domnode_delete(sd_domnode_t* this); 32 33 extern int sd_domnode_read(sd_domnode_t* this, 34 const char* a_buffer, size_t asize); 35 extern int sd_domnode_write(sd_domnode_t* this, char** a_buffer, 36 size_t* asize); 37 38 extern int sd_domnode_fread(sd_domnode_t* this, FILE* a_stream); 39 extern int sd_domnode_fwrite(const sd_domnode_t* this, 40 FILE* a_stream); 41 42 extern int sd_domnode_load(sd_domnode_t* this, 43 const char* a_filename); 44 45 extern int sd_domnode_store(const sd_domnode_t* this, 46 const char* a_filename); 47 48 extern sd_domnode_t* sd_domnode_search(const sd_domnode_t* this, 49 const char* a_name); 50 51 extern sd_domnode_t* sd_domnode_attrs_put(sd_domnode_t* this, 52 sd_domnode_t* a_attr); 53 extern sd_domnode_t* sd_domnode_attrs_get(const sd_domnode_t* this, 54 const char* a_name); 55 extern sd_domnode_t* sd_domnode_attrs_remove(sd_domnode_t* this, 56 const char* a_name); 57 58 /** Creates a new node. */ 59 extern sd_domnode_t* __sd_domnode_new(const char* name, const char* a_value, 60 int is_elem); 61 62 __SD_END_DECLS 63 64 #endif 65 66