relationships.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * libxlsxwriter
  3. *
  4. * Copyright 2014-2018, John McNamara, [email protected]. See LICENSE.txt.
  5. *
  6. * relationships - A libxlsxwriter library for creating Excel XLSX
  7. * relationships files.
  8. *
  9. */
  10. #ifndef __LXW_RELATIONSHIPS_H__
  11. #define __LXW_RELATIONSHIPS_H__
  12. #include <stdint.h>
  13. #include "common.h"
  14. /* Define the queue.h STAILQ structs for the generic data structs. */
  15. STAILQ_HEAD(lxw_rel_tuples, lxw_rel_tuple);
  16. typedef struct lxw_rel_tuple {
  17. char *type;
  18. char *target;
  19. char *target_mode;
  20. STAILQ_ENTRY (lxw_rel_tuple) list_pointers;
  21. } lxw_rel_tuple;
  22. /*
  23. * Struct to represent a relationships.
  24. */
  25. typedef struct lxw_relationships {
  26. FILE *file;
  27. uint32_t rel_id;
  28. struct lxw_rel_tuples *relationships;
  29. } lxw_relationships;
  30. /* *INDENT-OFF* */
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. /* *INDENT-ON* */
  35. lxw_relationships *lxw_relationships_new();
  36. void lxw_free_relationships(lxw_relationships *relationships);
  37. void lxw_relationships_assemble_xml_file(lxw_relationships *self);
  38. void lxw_add_document_relationship(lxw_relationships *self, const char *type,
  39. const char *target);
  40. void lxw_add_package_relationship(lxw_relationships *self, const char *type,
  41. const char *target);
  42. void lxw_add_ms_package_relationship(lxw_relationships *self,
  43. const char *type, const char *target);
  44. void lxw_add_worksheet_relationship(lxw_relationships *self, const char *type,
  45. const char *target,
  46. const char *target_mode);
  47. /* Declarations required for unit testing. */
  48. #ifdef TESTING
  49. STATIC void _relationships_xml_declaration(lxw_relationships *self);
  50. #endif /* TESTING */
  51. /* *INDENT-OFF* */
  52. #ifdef __cplusplus
  53. }
  54. #endif
  55. /* *INDENT-ON* */
  56. #endif /* __LXW_RELATIONSHIPS_H__ */