domnode.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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,
  23. const char* a_value);
  24. extern void sd_domnode_delete(sd_domnode_t* ptrThis);
  25. extern int sd_domnode_read(sd_domnode_t* ptrThis,
  26. const char* a_buffer, size_t asize);
  27. extern int sd_domnode_write(sd_domnode_t* ptrThis, char** a_buffer,
  28. size_t* asize);
  29. extern int sd_domnode_fread(sd_domnode_t* ptrThis, FILE* a_stream);
  30. extern int sd_domnode_fwrite(const sd_domnode_t* ptrThis,
  31. FILE* a_stream);
  32. extern int sd_domnode_load(sd_domnode_t* ptrThis,
  33. const char* a_filename);
  34. extern int sd_domnode_store(const sd_domnode_t* ptrThis,
  35. const char* a_filename);
  36. extern sd_domnode_t* sd_domnode_search(const sd_domnode_t* ptrThis,
  37. const char* a_name);
  38. extern sd_domnode_t* sd_domnode_attrs_put(sd_domnode_t* ptrThis,
  39. sd_domnode_t* a_attr);
  40. extern sd_domnode_t* sd_domnode_attrs_get(const sd_domnode_t* ptrThis,
  41. const char* a_name);
  42. extern sd_domnode_t* sd_domnode_attrs_remove(sd_domnode_t* ptrThis,
  43. const char* a_name);
  44. /** Creates a new node. */
  45. extern sd_domnode_t* __sd_domnode_new(const char* name, const char* a_value,
  46. int is_elem);
  47. __SD_END_DECLS
  48. #endif