activemq-cpp-3.8.2
Properties.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef _DECAF_UTIL_PROPERTIES_H_
19 #define _DECAF_UTIL_PROPERTIES_H_
20 
21 #include <vector>
22 #include <string>
23 #include <decaf/util/Config.h>
24 #include <decaf/util/StlMap.h>
25 #include <decaf/io/InputStream.h>
26 #include <decaf/io/OutputStream.h>
27 #include <decaf/lang/Pointer.h>
30 #include <decaf/io/IOException.h>
31 
32 namespace decaf{
33 namespace io{
34  class Reader;
35  class Writer;
36 }
37 namespace util{
38 
39  class PropertiesInternal;
40 
54  private:
55 
56  PropertiesInternal* internal;
57 
58  protected:
59 
65 
66  public:
67 
68  Properties();
69 
70  Properties( const Properties& src );
71 
72  virtual ~Properties();
73 
82  Properties& operator= ( const Properties& src );
83 
89  bool isEmpty() const;
90 
94  int size() const;
95 
105  const char* getProperty( const std::string& name ) const;
106 
118  std::string getProperty( const std::string& name, const std::string& defaultValue ) const;
119 
131  std::string setProperty( const std::string& name, const std::string& value );
132 
141  bool hasProperty( const std::string& name ) const;
142 
151  std::string remove( const std::string& name );
152 
161  std::vector<std::string> propertyNames() const;
162 
169  std::vector< std::pair< std::string, std::string > > toArray() const;
170 
178  void copy( const Properties& source );
179 
185  Properties* clone() const;
186 
190  void clear();
191 
204  bool equals( const Properties& source ) const;
205 
211  std::string toString() const;
212 
227  void load( decaf::io::InputStream* stream );
228 
328  void load( decaf::io::Reader* reader );
329 
358  void store( decaf::io::OutputStream* out, const std::string& comment );
359 
396  void store( decaf::io::Writer* writer, const std::string& comments );
397 
398  private:
399 
400  void selectProperties( decaf::util::StlMap<std::string, std::string>& selectProperties ) const;
401 
402  };
403 
404 }}
405 
406 #endif /*_DECAF_UTIL_PROPERTIES_H_*/
Map template that wraps around a std::map to provide a more user-friendly interface and to provide co...
Definition: StlMap.h:47
A base class that must be implemented by all classes wishing to provide a class that reads in a strea...
Definition: InputStream.h:39
Definition: Reader.h:40
Definition: Writer.h:41
#define DECAF_API
Definition: Config.h:29
Base interface for any class that wants to represent an output stream of bytes.
Definition: OutputStream.h:39
Java-like properties class for mapping string names to string values.
Definition: Properties.h:53
Decaf&#39;s implementation of a Smart Pointer that is a template on a Type and is Thread Safe if the defa...
Definition: Pointer.h:53
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: AprPool.h:25
decaf::lang::Pointer< Properties > defaults
Default list used to answer for any keys not found in the properties list, can be filled in by anothe...
Definition: Properties.h:64