domnode.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* $Id$
  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. #ifndef __sd_domnode_h
  7. #define __sd_domnode_h
  8. /**
  9. * @file domnode.h @ingroup sd
  10. *
  11. * @brief Generic DOM object.
  12. */
  13. #include <stdio.h>
  14. #include <sd/list.h>
  15. __SD_BEGIN_DECLS
  16. typedef struct {
  17. const char* name;
  18. const char* value;
  19. sd_list_t* children;
  20. sd_list_t* attrs;
  21. } sd_domnode_t;
  22. extern sd_domnode_t* sd_domnode_new(const char* a_name,const char* a_value);
  23. extern void sd_domnode_delete(sd_domnode_t* this);
  24. extern int sd_domnode_read(sd_domnode_t* this,const char* a_buffer, size_t asize);
  25. extern int sd_domnode_write(sd_domnode_t* this, char** a_buffer,size_t* asize);
  26. extern int sd_domnode_fread(sd_domnode_t* this, FILE* a_stream);
  27. extern int sd_domnode_fwrite(const sd_domnode_t* this,FILE* a_stream);
  28. extern int sd_domnode_load(sd_domnode_t* this,const char* a_filename);
  29. extern int sd_domnode_store(const sd_domnode_t* this, const char* a_filename);
  30. extern sd_domnode_t* sd_domnode_search(const sd_domnode_t* this,const char* a_name);
  31. extern sd_domnode_t* sd_domnode_attrs_put(sd_domnode_t* this,sd_domnode_t* a_attr);
  32. extern sd_domnode_t* sd_domnode_attrs_get(const sd_domnode_t* this,const char* a_name);
  33. extern sd_domnode_t* sd_domnode_attrs_remove(sd_domnode_t* this,const char* a_name);
  34. /** Creates a new node. */
  35. extern sd_domnode_t* __sd_domnode_new(const char* name, const char* a_value,int is_elem);
  36. __SD_END_DECLS
  37. #endif