app.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * libxlsxwriter
  3. *
  4. * Copyright 2014-2018, John McNamara, [email protected]. See LICENSE.txt.
  5. *
  6. * app - A libxlsxwriter library for creating Excel XLSX app files.
  7. *
  8. */
  9. #ifndef __LXW_APP_H__
  10. #define __LXW_APP_H__
  11. #include <stdint.h>
  12. #include <string.h>
  13. #include "workbook.h"
  14. #include "common.h"
  15. /* Define the queue.h TAILQ structs for the App structs. */
  16. STAILQ_HEAD(lxw_heading_pairs, lxw_heading_pair);
  17. STAILQ_HEAD(lxw_part_names, lxw_part_name);
  18. typedef struct lxw_heading_pair {
  19. char *key;
  20. char *value;
  21. STAILQ_ENTRY (lxw_heading_pair) list_pointers;
  22. } lxw_heading_pair;
  23. typedef struct lxw_part_name {
  24. char *name;
  25. STAILQ_ENTRY (lxw_part_name) list_pointers;
  26. } lxw_part_name;
  27. /* Struct to represent an App object. */
  28. typedef struct lxw_app {
  29. FILE *file;
  30. struct lxw_heading_pairs *heading_pairs;
  31. struct lxw_part_names *part_names;
  32. lxw_doc_properties *properties;
  33. uint32_t num_heading_pairs;
  34. uint32_t num_part_names;
  35. } lxw_app;
  36. /* *INDENT-OFF* */
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40. /* *INDENT-ON* */
  41. lxw_app *lxw_app_new();
  42. void lxw_app_free(lxw_app *app);
  43. void lxw_app_assemble_xml_file(lxw_app *self);
  44. void lxw_app_add_part_name(lxw_app *self, const char *name);
  45. void lxw_app_add_heading_pair(lxw_app *self, const char *key,
  46. const char *value);
  47. /* Declarations required for unit testing. */
  48. #ifdef TESTING
  49. STATIC void _app_xml_declaration(lxw_app *self);
  50. #endif /* TESTING */
  51. /* *INDENT-OFF* */
  52. #ifdef __cplusplus
  53. }
  54. #endif
  55. /* *INDENT-ON* */
  56. #endif /* __LXW_APP_H__ */