Fesapi  0.13.0.0
This project provides C++ classes which allow an easy access in import and export to the Energistics standards.
FileContentType.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 
22 #ifndef FILE_CONTENT_TYPE_H
23 #define FILE_CONTENT_TYPE_H
24 
25 #if defined(_WIN32) || defined(__APPLE__)
26 #include <unordered_map>
27 #else
28 #include <tr1/unordered_map>
29 #endif
30 
31 #include "ContentType.h"
32 
33 namespace epc
34 {
35 
37  {
38  public:
39 
40 #if (defined(_WIN32) && _MSC_VER >= 1600) || defined(__APPLE__)
41  typedef std::unordered_map<std::string, ContentType> ContentTypeMap;
42 #else
43  typedef std::tr1::unordered_map<std::string, ContentType> ContentTypeMap;
44 #endif
45 
46  private:
47  static const char* header;
48  ContentTypeMap contentTypeMap;
49  static const char* footer;
50 
51  public:
52  // CONSTRUCTORS
54  ~FileContentType() {};
55 
56  // ACCESSORS
57  ContentType getContentType(const std::string& extensionOrPartName) const;
58  const ContentTypeMap& getAllContentType() const;
59  std::string toString() const;
60 
61  void addContentType(const ContentType & contentType);
62 
66  void readFromString(const std::string & textInput);
67  };
68 }
69 
70 #endif
71 
72 
73 
74 
75 
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
void readFromString(const std::string &textInput)
Definition: FileContentType.cpp:76
Definition: ContentType.h:28
Definition: ContentType.h:26
Definition: FileContentType.h:36