Fesapi  0.13.0.0
This project provides C++ classes which allow an easy access in import and export to the Energistics standards.
ContentType.h
1 /*-----------------------------------------------------------------------
2 Licensed to the Apache Software Foundation (ASF) under one
3 or more contributor license agreements. See the NOTICE file
4 distributed with this work for additional information
5 regarding copyright ownership. The ASF licenses this file
6 to you under the Apache License, Version 2.0 (the
7 "License"; you may not use this file except in compliance
8 with the License. You may obtain a copy of the License at
9 
10  http://www.apache.org/licenses/LICENSE-2.0
11 
12 Unless required by applicable law or agreed to in writing,
13 software distributed under the License is distributed on an
14 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 KIND, either express or implied. See the License for the
16 specific language governing permissions and limitations
17 under the License.
18 -----------------------------------------------------------------------*/
19 
20 
21 #ifndef CONTENT_TYPE_H
22 #define CONTENT_TYPE_H
23 
24 #include <string>
25 
26 namespace epc
27 {
29  {
30  private:
31  std::string contentTypeString;
32  std::string extensionOrPartName;
33 
34  public:
35  bool isAssociatedToAnExtension;
36 
37  // The part URI grammar is defined as follows:
38  // part-URI = 1*( "/" segment )
39  // segment = 1*( pchar )
40  // pchar is defined in RFC 3986
41  //
42  // The part URI grammar implies the following constraints. The package implementer shall neither create any part
43  // that violates these constraints nor retrieve any data from a package as a part if the purported part URI violates
44  // these constraints.
45  // * A part URI shall not be empty. [Note: The Mx.x notation is discussed in ?2. end note]
46  // * A part URI shall not have empty segments.
47  // * A part URI shall start with a forward slash (?/?) character.
48  // * A part URI shall not have a forward slash as the last character.
49  // * A segment shall not hold any characters other than pchar characters.
50  // Part URI segments have the following additional constraints. The package implementer shall neither create any
51  // part with a part URI comprised of a segment that violates these constraints nor retrieve any data from a package
52  // as a part if the purported part URI contains a segment that violates these constraints.
53  // * A segment shall not contain percent-encoded forward slash (?/?), or backward slash (?\?) characters.
54  // * A segment shall not contain percent-encoded unreserved characters.
55  // * A segment shall not end with a dot (?.?) character.
56  // * A segment shall include at least one non-dot character.
57 
59  ContentType(const bool & isAssociatedToAnExtension, const std::string & contentType, const std::string & extensionOrPartName);
60  ~ContentType() {};
61 
62  // GETTTERS
63  const std::string & getContentTypeString() const;
64  const std::string & getExtensionOrPartName() const;
65 
66  // SETTERS
67  void setContentTypeString(const std::string & ctString) {contentTypeString = ctString;}
68  void setExtensionOrPartName(const std::string & extensionOrPartName) {this->extensionOrPartName = extensionOrPartName;}
69 
70  std::string toString() const;
71  };
72 }
73 
74 #endif
75 
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
ContentType()
if false, the content type is associated to a part and overrides another content type.
Definition: ContentType.h:58
Definition: ContentType.h:28
Definition: ContentType.h:26