My Project
ContentType.h
1 /*-----------------------------------------------------------------------
2 Copyright F2I-CONSULTING, (2014-2017)
3 
4 philippe.verney@f2i-consulting.com
5 
6 This software is a computer program whose purpose is to access to data formatted using Energistics standards.
7 
8 This software is governed by the CeCILL-B license under French law and
9 abiding by the rules of distribution of free software. You can use,
10 modify and/ or redistribute the software under the terms of the CeCILL-B
11 license as circulated by CEA, CNRS and INRIA at the following URL
12 "http://www.cecill.info".
13 
14 As a counterpart to the access to the source code and rights to copy,
15 modify and redistribute granted by the license, users are provided only
16 with a limited warranty and the software's author, the holder of the
17 economic rights, and the successive licensors have only limited
18 liability.
19 
20 In this respect, the user's attention is drawn to the risks associated
21 with loading, using, modifying and/or developing or reproducing the
22 software by the user in light of its specific status of free software,
23 that may mean that it is complicated to manipulate, and that also
24 therefore means that it is reserved for developers and experienced
25 professionals having in-depth computer knowledge. Users are therefore
26 encouraged to load and test the software's suitability as regards their
27 requirements in conditions enabling the security of their systems and/or
28 data to be ensured and, more generally, to use and operate it in the
29 same conditions as regards security.
30 
31 The fact that you are presently reading this means that you have had
32 knowledge of the CeCILL-B license and that you accept its terms.
33 -----------------------------------------------------------------------*/
34 #ifndef CONTENT_TYPE_H
35 #define CONTENT_TYPE_H
36 
37 #include <string>
38 
39 namespace epc
40 {
42  {
43  private:
44  std::string contentTypeString;
45  std::string extensionOrPartName;
46 
47  public:
48  bool isAssociatedToAnExtension;
49 
50  // The part URI grammar is defined as follows:
51  // part-URI = 1*( "/" segment )
52  // segment = 1*( pchar )
53  // pchar is defined in RFC 3986
54  //
55  // The part URI grammar implies the following constraints. The package implementer shall neither create any part
56  // that violates these constraints nor retrieve any data from a package as a part if the purported part URI violates
57  // these constraints.
58  // * A part URI shall not be empty. [Note: The Mx.x notation is discussed in ?2. end note]
59  // * A part URI shall not have empty segments.
60  // * A part URI shall start with a forward slash (?/?) character.
61  // * A part URI shall not have a forward slash as the last character.
62  // * A segment shall not hold any characters other than pchar characters.
63  // Part URI segments have the following additional constraints. The package implementer shall neither create any
64  // part with a part URI comprised of a segment that violates these constraints nor retrieve any data from a package
65  // as a part if the purported part URI contains a segment that violates these constraints.
66  // * A segment shall not contain percent-encoded forward slash (?/?), or backward slash (?\?) characters.
67  // * A segment shall not contain percent-encoded unreserved characters.
68  // * A segment shall not end with a dot (?.?) character.
69  // * A segment shall include at least one non-dot character.
70 
72  ContentType(const bool & isAssociatedToAnExtension, const std::string & contentType, const std::string & extensionOrPartName);
73  ~ContentType() {};
74 
75  // GETTTERS
76  const std::string & getContentTypeString() const;
77  const std::string & getExtensionOrPartName() const;
78 
79  // SETTERS
80  void setContentTypeString(const std::string & ctString) {contentTypeString = ctString;}
81  void setExtensionOrPartName(const std::string & extensionOrPartName) {this->extensionOrPartName = extensionOrPartName;}
82 
83  std::string toString() const;
84  };
85 }
86 
87 #endif
ContentType()
if false, the content type is associated to a part and overrides another content type.
Definition: ContentType.h:71
Definition: ContentType.h:41
Definition: ContentType.h:39