properties.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*
  2. Copyright (c) 2010, Florian Reuter
  3. All rights reserved.
  4. Redistribution and use in source and binary forms, with or without
  5. modification, are permitted provided that the following conditions
  6. are met:
  7. * Redistributions of source code must retain the above copyright
  8. notice, this list of conditions and the following disclaimer.
  9. * Redistributions in binary form must reproduce the above copyright
  10. notice, this list of conditions and the following disclaimer in
  11. the documentation and/or other materials provided with the
  12. distribution.
  13. * Neither the name of Florian Reuter nor the names of its contributors
  14. may be used to endorse or promote products derived from this
  15. software without specific prior written permission.
  16. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  17. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  18. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  19. FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  20. COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  21. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  22. BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  23. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  24. CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  25. STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  26. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  27. OF THE POSSIBILITY OF SUCH DAMAGE.
  28. */
  29. /** @file opc/properties.h
  30. */
  31. #include <opc/config.h>
  32. #include <opc/container.h>
  33. #ifndef OPC_PROPERTIES_H
  34. #define OPC_PROPERTIES_H
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38. /**
  39. Represents a simple Dublin Core type.
  40. */
  41. typedef struct OPC_DC_SIMPLE_TYPE {
  42. xmlChar *str;
  43. xmlChar *lang;
  44. } opcDCSimpleType_t;
  45. /**
  46. Represents the core properties of an OPC container.
  47. */
  48. typedef struct OPC_PROPERTIES_STRUCT {
  49. xmlChar *category; /* xsd:string */
  50. xmlChar *contentStatus; /* xsd:string */
  51. xmlChar *created; /* dc:date */
  52. opcDCSimpleType_t creator; /* dc:any */
  53. opcDCSimpleType_t description; /* dc:any */
  54. opcDCSimpleType_t identifier; /* dc:any */
  55. opcDCSimpleType_t *keyword_array; /* cp:CT_Keywords */
  56. opc_uint32_t keyword_items;
  57. opcDCSimpleType_t language; /* dc:any */
  58. xmlChar *lastModifiedBy; /* xsd:string */
  59. xmlChar *lastPrinted; /* xsd:dateTime */
  60. xmlChar *modified; /* dc:date */
  61. xmlChar *revision; /* xsd:string */
  62. opcDCSimpleType_t subject; /* dc:any */
  63. opcDCSimpleType_t title; /* dc:any */
  64. xmlChar *version; /* xsd:string */
  65. } opcProperties_t;
  66. /**
  67. Initialize the core properties \c cp.
  68. \see opcCorePropertiesSetString
  69. */
  70. opc_error_t opcCorePropertiesInit(opcProperties_t *cp);
  71. /**
  72. Cleanup the core properties \c cp, i.e. release all resources.
  73. \see opcCorePropertiesSetString
  74. */
  75. opc_error_t opcCorePropertiesCleanup(opcProperties_t *cp);
  76. /**
  77. Rease the core properties \c cp from the container \c.
  78. */
  79. opc_error_t opcCorePropertiesRead(opcProperties_t *cp, opcContainer *c);
  80. /**
  81. Write/Update the core properties \c cp in the container \c.
  82. */
  83. opc_error_t opcCorePropertiesWrite(opcProperties_t *cp, opcContainer *c);
  84. /**
  85. Update a string in the core properties the right way.
  86. \code
  87. opcProperties_t cp;
  88. opcCorePropertiesInit(&cp);
  89. opcCorePropertiesSetString(&cp.revision, "1");
  90. opcCorePropertiesSetStringLang(&cp.creator, "Florian Reuter", NULL);
  91. opcCorePropertiesCleanup(&cp);
  92. \endcode
  93. */
  94. opc_error_t opcCorePropertiesSetString(xmlChar **prop, const xmlChar *str);
  95. /**
  96. Update a core properties the right way.
  97. \see opcCorePropertiesSetString
  98. */
  99. opc_error_t opcCorePropertiesSetStringLang(opcDCSimpleType_t *prop, const xmlChar *str, const xmlChar *lang);
  100. #ifdef __cplusplus
  101. } /* extern "C" */
  102. #endif
  103. #endif /* OPC_PROPERTIES_H */