Fesapi 2.10.1.0
This project provides C++ classes which allow an easy access in import and export to the Energistics standards.
Loading...
Searching...
No Matches
Package.h
1/*-----------------------------------------------------------------------
2Licensed to the Apache Software Foundation (ASF) under one
3or more contributor license agreements. See the NOTICE file
4distributed with this work for additional information
5regarding copyright ownership. The ASF licenses this file
6to you under the Apache License, Version 2.0 (the
7"License"; you may not use this file except in compliance
8with the License. You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12Unless required by applicable law or agreed to in writing,
13software distributed under the License is distributed on an
14"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15KIND, either express or implied. See the License for the
16specific language governing permissions and limitations
17under the License.
18-----------------------------------------------------------------------*/
19#ifndef PACKAGE_H
20#define PACKAGE_H
21
22#include <vector>
23#include <string>
24
25#include <unordered_map>
26
27#include "FileCoreProperties.h"
28#include "FileContentType.h"
29#include "FileRelationship.h"
30#include "FilePart.h"
31
32namespace epc
33{
35 class Package
36 {
37
38 private :
39 class CheshireCat; // Not defined here but in the cpp
41 CheshireCat * d_ptr;
43 typedef std::unordered_map<std::string, FilePart> PartMap;
44
52 void writeStringIntoNewPart(const std::string &input, const std::string & partPath);
53
54 static constexpr char const* CORE_PROP_REL_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";
55 static constexpr char const* EXTENDED_CORE_PROP_REL_TYPE = "http://schemas.f2i-consulting.com/package/2014/relationships/extended-core-properties";
56
57 public:
60 Package(const Package&) = delete;
61
62
73 Package(const FileCoreProperties & pkgFileCP, const FileContentType & pkgFileCT, const FileRelationship & pkgFileRS, const PartMap & pkgFileP, const std::string & pkgPathName);
74
75 Package& operator=(const Package&) = delete;
76
79
91 void openForWriting(const std::string & pkgPathName, int append, bool useZip64 = false);
92
96 bool isOpenedForWriting() const;
97
105 std::vector<std::string> openForReading(const std::string & pkgPathName);
106
110 bool isOpenedForReading() const;
111
113 void close();
114
121
128
135
141 const PartMap & getAllFilePart() const;
142
148 const std::string & getPathname() const;
149
156
164 std::unordered_map< std::string, std::string > & getExtendedCoreProperty();
165
172 void addProperty(const CoreProperty::TypeProperty & pkgTypeProperty, const std::string & pkgPropertyValue);
173
179 void setFileContentType(const FileContentType & pkgFileCT);
180
186 void addContentType(const ContentType & contentType);
187
194
200 void addRelationship(const Relationship & relationship);
201
211 FilePart* createPart(const std::string & inputContent, const std::string & outputPartPath);
212
220 const FilePart* findPart(const std::string & outputPartPath) const;
221
229 bool fileExists(const std::string & filename) const;
230
239 std::string extractFile(const std::string & filename);
240
243 };
244}
245
246#endif
Definition ContentType.h:28
TypeProperty
Definition CoreProperty.h:33
Definition FileContentType.h:30
Definition FileCoreProperties.h:28
Definition FilePart.h:29
Definition FileRelationship.h:30
Definition Package.h:36
std::vector< std::string > openForReading(const std::string &pkgPathName)
void setPrincipalRelationship(const FileRelationship &pkgFileRS)
const FileContentType & getFileContentType() const
void writePackage()
void addProperty(const CoreProperty::TypeProperty &pkgTypeProperty, const std::string &pkgPropertyValue)
FilePart * createPart(const std::string &inputContent, const std::string &outputPartPath)
std::unordered_map< std::string, std::string > & getExtendedCoreProperty()
Package(const FileCoreProperties &pkgFileCP, const FileContentType &pkgFileCT, const FileRelationship &pkgFileRS, const PartMap &pkgFileP, const std::string &pkgPathName)
void openForWriting(const std::string &pkgPathName, int append, bool useZip64=false)
const FileRelationship & getPrincipalRelationship() const
void setFileFileCoreProperties(const FileCoreProperties &pkgFileCP)
void addContentType(const ContentType &contentType)
const std::string & getPathname() const
void setFileContentType(const FileContentType &pkgFileCT)
bool isOpenedForReading() const
const PartMap & getAllFilePart() const
std::string extractFile(const std::string &filename)
void addRelationship(const Relationship &relationship)
bool isOpenedForWriting() const
const FilePart * findPart(const std::string &outputPartPath) const
const FileCoreProperties & getFileCoreProperties() const
bool fileExists(const std::string &filename) const
Definition Relationship.h:28
The epc namespace.
Definition ContentType.h:25