activemq-cpp-3.9.5
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>
27#include <decaf/lang/Pointer.h>
31
32namespace decaf{
33namespace io{
34 class Reader;
35 class Writer;
36}
37namespace util{
38
39 class PropertiesInternal;
40
54 private:
55
56 PropertiesInternal* internal;
57
58 protected:
59
65
66 public:
67
69
71
72 virtual ~Properties();
73
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
186
190 void clear();
191
204 bool equals(const Properties& source) const;
205
211 std::string toString() const;
212
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_*/
A base class that must be implemented by all classes wishing to provide a class that reads in a strea...
Definition InputStream.h:39
Base interface for any class that wants to represent an output stream of bytes.
Definition OutputStream.h:39
Definition Reader.h:40
Definition Writer.h:41
Decaf's implementation of a Smart Pointer that is a template on a Type and is Thread Safe if the defa...
Definition Pointer.h:53
bool equals(const Properties &source) const
Test whether two Properties objects are equivalent.
void store(decaf::io::Writer *writer, const std::string &comments)
Writes this property list (key and element pairs) in this Properties table to the output character st...
Properties * clone() const
Clones this object.
bool hasProperty(const std::string &name) const
Check to see if the Property exists in the set.
const char * getProperty(const std::string &name) const
Looks up the value for the given property.
bool isEmpty() const
Returns true if the properties object is empty.
std::string setProperty(const std::string &name, const std::string &value)
Sets the value for a given property.
void clear()
Clears all properties from the map.
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
Properties(const Properties &src)
std::string getProperty(const std::string &name, const std::string &defaultValue) const
Looks up the value for the given property.
std::string toString() const
Formats the contents of the Properties Object into a string that can be logged, etc.
std::vector< std::string > propertyNames() const
Returns an enumeration of all the keys in this property list, including distinct keys in the default ...
void copy(const Properties &source)
Copies the contents of the given properties object to this one, if the given Properties instance in e...
void load(decaf::io::InputStream *stream)
Reads a property list (key and element pairs) from the input byte stream.
std::vector< std::pair< std::string, std::string > > toArray() const
Method that serializes the contents of the property map to an array.
void store(decaf::io::OutputStream *out, const std::string &comment)
Writes this property list (key and element pairs) in this Properties table to the output stream in a ...
void load(decaf::io::Reader *reader)
Reads a property list (key and element pairs) from the input character stream in a simple line-orient...
Properties & operator=(const Properties &src)
Assignment Operator.
std::string remove(const std::string &name)
Removes the property with the given name.
Map template that wraps around a std::map to provide a more user-friendly interface and to provide co...
Definition StlMap.h:48
#define DECAF_API
Definition Config.h:29
Definition BlockingByteArrayInputStream.h:25
Definition AbstractCollection.h:33
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition AprPool.h:25