@@ -42,48 +42,30 @@ namespace COMMON_NS
4242 /* *
4343 * Constructor
4444 *
45- * @param fileName Full pathname of the EPC document.
45+ * @param fileName Full pathname of the EPC document in UTF-8 encoding .
4646 */
47- DLL_IMPORT_OR_EXPORT EpcDocument (const std::string & fileName) { open (fileName); }
47+ DLL_IMPORT_OR_EXPORT EpcDocument (const std::string& fileName) { open (fileName); }
4848
4949 /* * The destructor frees all allocated ressources. */
50- DLL_IMPORT_OR_EXPORT ~EpcDocument () { close (); }
50+ DLL_IMPORT_OR_EXPORT ~EpcDocument () = default ;
5151
5252 /* *
53- * Opens an EPC document. If one is already opened, it must be closed before to open a new one.
54- * Don't forget to call {@link close()} before to destroy this object.
53+ * Opens an EPC document.
5554 *
56- * @exception std::invalid_argument if the name of the EPC document is empty or if there is
57- * already an opened EPC document.
58- *
59- * @param fileName Full pathname of the EPC document.
55+ * @param fileName Full pathname of the EPC document in UTF-8 encoding.
6056 */
61- DLL_IMPORT_OR_EXPORT void open (const std::string & fileName);
62-
63- /* * Free all ressources contained in this package. */
64- DLL_IMPORT_OR_EXPORT void close () {
65- package.reset ();
66- filePath = " " ;
57+ DLL_IMPORT_OR_EXPORT void open (const std::string& fileName)
58+ {
59+ setFilePath (fileName);
60+ package.reset (new epc::Package ());
6761 }
6862
69- /* *
70- * Sets the EPC document file path which will be used for future serialization and
71- * deserialization. This method will add the standard @c .epc extension if it is not already
72- * present.
73- *
74- * @exception std::invalid_argument if the HDF5 file error handling cannot be disabled.
75- *
76- * @param fp Full pathname of the EPC document.
77- */
78- DLL_IMPORT_OR_EXPORT void setFilePath (const std::string & fp);
79-
8063 /* *
8164 * Serializes the content of a data object repository into this EPC document.
8265 *
8366 * @param repo A data object repository (not const because we may create a Fake Property for solivng a RESQML2.0.1 empty PropertySet issue)
84- * @param useZip64 (Optional) True to zip the EPC document using Zip64 format, else (default) simply use Zip format.
8567 */
86- DLL_IMPORT_OR_EXPORT void serializeFrom (DataObjectRepository& repo, bool useZip64 = false );
68+ DLL_IMPORT_OR_EXPORT void serializeFrom (DataObjectRepository& repo);
8769
8870 /* *
8971 * Deserializes this package (data objects and relationships) into a data object repository
@@ -118,42 +100,56 @@ namespace COMMON_NS
118100
119101 /* *
120102 * Gets the extended core properties of this package
103+ * The EpcDocument must have been deserialized at least once to get the extended core proeprties information.
121104 *
122105 * @returns A map which associates keys and values of the extended core properties.
123106 */
124- DLL_IMPORT_OR_EXPORT std::unordered_map< std::string, std::string > & getExtendedCoreProperty ();
107+ DLL_IMPORT_OR_EXPORT std::unordered_map< std::string, std::string >& getExtendedCoreProperty ();
125108
126109 /* *
127110 * Sets or adds an extended core property
128111 *
129112 * @param key The key of the property.
130113 * @param value The value of the property.
131114 */
132- DLL_IMPORT_OR_EXPORT void setExtendedCoreProperty (const std::string & key, const std::string & value);
115+ DLL_IMPORT_OR_EXPORT void setExtendedCoreProperty (const std::string& key, const std::string& value);
133116
134117 /* *
135118 * Gets extended core property count.
119+ * The EpcDocument must have been deserialized at least once to get the extended core proeprties information.
136120 *
137121 * @returns The count of extended core properties in this EPC document
138122 */
139123 DLL_IMPORT_OR_EXPORT uint64_t getExtendedCorePropertyCount () const ;
140124
141125 /* *
142126 * Gets an extended core property value according to its key.
127+ * The EpcDocument must have been deserialized at least once to get the extended core proeprties information.
143128 *
144129 * @param key The key of the property.
145130 *
146131 * @returns An empty string if the extended core property does not exist. Or the extended core
147132 * property value if it exists.
148133 */
149- DLL_IMPORT_OR_EXPORT std::string getExtendedCoreProperty (const std::string & key);
134+ DLL_IMPORT_OR_EXPORT std::string getExtendedCoreProperty (const std::string& key) const ;
150135
151- DLL_IMPORT_OR_EXPORT std::string resolvePartial (AbstractObject const * partialObj) const ;
136+ DLL_IMPORT_OR_EXPORT std::string resolvePartial (AbstractObject const * partialObj) const ;
152137
153138 private :
154- static constexpr char const * DOCUMENT_EXTENSION = " .epc" ;
139+ /* *
140+ * Sets the EPC document file path which will be used for future serialization and
141+ * deserialization. This method will add the standard @c .epc extension if it is not already
142+ * present.
143+ *
144+ * @exception std::invalid_argument if the HDF5 file error handling cannot be disabled.
145+ *
146+ * @param fp Full pathname of the EPC document.
147+ */
148+ void setFilePath (const std::string& fp);
155149
156- void deserializeRelFiles (DataObjectRepository & repo);
150+ void deserializeRelFiles (DataObjectRepository& repo);
151+
152+ static constexpr char const * DOCUMENT_EXTENSION = " .epc" ;
157153
158154 /* * The package */
159155 std::unique_ptr<epc::Package> package;
0 commit comments