OFFIS DCMTK  Version 3.6.0
property.h
Go to the documentation of this file.
1 // Module: Log4CPLUS
2 // File: property.h
3 // Created: 2/2002
4 // Author: Tad E. Smith
5 //
6 //
7 // Copyright 2002-2009 Tad E. Smith
8 //
9 // Licensed under the Apache License, Version 2.0 (the "License");
10 // you may not use this file except in compliance with the License.
11 // You may obtain a copy of the License at
12 //
13 // http://www.apache.org/licenses/LICENSE-2.0
14 //
15 // Unless required by applicable law or agreed to in writing, software
16 // distributed under the License is distributed on an "AS IS" BASIS,
17 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 // See the License for the specific language governing permissions and
19 // limitations under the License.
20 
23 #ifndef LOG4CPLUS_HELPERS_PROPERTY_HEADER_
24 #define LOG4CPLUS_HELPERS_PROPERTY_HEADER_
25 
26 #include "dcmtk/oflog/config.h"
27 #include "dcmtk/oflog/streams.h"
28 #include "dcmtk/oflog/tstring.h"
29 //#include <map>
30 #include "dcmtk/ofstd/ofmap.h"
31 //#include <vector>
32 #include "dcmtk/ofstd/oflist.h"
33 
34 #if (defined(__MWERKS__) && defined(__MACOS__))
35 using STD_NAMESPACE size_t;
36 #endif
37 
38 
39 namespace log4cplus {
40  namespace helpers {
41 
42  class LOG4CPLUS_EXPORT Properties {
43  public:
44  Properties();
45  explicit Properties(log4cplus::tistream& input);
46  explicit Properties(const log4cplus::tstring& inputFile);
47  virtual ~Properties();
48 
49  // constants
50  static const tchar PROPERTIES_COMMENT_CHAR;
51 
52  // methods
56  bool exists(const log4cplus::tstring& key) const {
57  return data.find(key) != data.end();
58  }
59 
60 
64  size_t size() const {
65  return data.size();
66  }
67 
74  log4cplus::tstring getProperty(const log4cplus::tstring& key) const;
75 
83  log4cplus::tstring getProperty(const log4cplus::tstring& key,
84  const log4cplus::tstring& defaultVal) const;
85 
89  OFList<log4cplus::tstring> propertyNames() const;
90 
94  void setProperty(const log4cplus::tstring& key, const log4cplus::tstring& value);
95 
99  bool removeProperty(const log4cplus::tstring& key);
100 
106  Properties getPropertySubset(const log4cplus::tstring& prefix) const;
107 
108  protected:
109  // Types
110 // LOG4CPLUS_EXPIMP_TEMPLATE template class LOG4CPLUS_EXPORT STD_NAMESPACE map<log4cplus::tstring, log4cplus::tstring>;
112 
113  // Methods
114  void init(log4cplus::tistream& input);
115 
116  // Data
117  StringMap data;
118  };
119  } // end namespace helpers
120 
121 }
122 
123 
124 #endif // LOG4CPLUS_HELPERS_PROPERTY_HEADER_
125 


Generated on Thu Dec 20 2012 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.2