Fesapi 2.3.0.0
This project provides C++ classes which allow an easy access in import and export to the Energistics standards.
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
55 static const char* CORE_PROP_REL_TYPE;
57 static const char* EXTENDED_CORE_PROP_REL_TYPE;
58
59 public:
62
73 Package(const FileCoreProperties & pkgFileCP, const FileContentType & pkgFileCT, const FileRelationship & pkgFileRS, const PartMap & pkgFileP, const std::string & pkgPathName);
74
77
89 void openForWriting(const std::string & pkgPathName, int append, bool useZip64 = false);
90
94 bool isOpenedForWriting() const;
95
103 std::vector<std::string> openForReading(const std::string & pkgPathName);
104
108 bool isOpenedForReading() const;
109
111 void close();
112
119
126
133
139 const PartMap & getAllFilePart() const;
140
146 const std::string & getPathname() const;
147
154
162 std::unordered_map< std::string, std::string > & getExtendedCoreProperty();
163
170 void addProperty(const CoreProperty::TypeProperty & pkgTypeProperty, const std::string & pkgPropertyValue);
171
177 void setFileContentType(const FileContentType & pkgFileCT);
178
184 void addContentType(const ContentType & contentType);
185
192
198 void addRelationship(const Relationship & relationship);
199
209 FilePart* createPart(const std::string & inputContent, const std::string & outputPartPath);
210
218 const FilePart* findPart(const std::string & outputPartPath) const;
219
227 bool fileExists(const std::string & filename) const;
228
237 std::string extractFile(const std::string & filename);
238
241 };
242}
243
244#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