activemq-cpp-3.8.2
ActiveMQProperties.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 _ACTIVEMQ_UTIL_ACTIVEMQPROPERTIES_H_
19 #define _ACTIVEMQ_UTIL_ACTIVEMQPROPERTIES_H_
20 
21 #include <map>
22 #include <string>
23 #include <sstream>
24 #include <activemq/util/Config.h>
25 #include <cms/CMSProperties.h>
26 #include <decaf/util/Properties.h>
27 
28 namespace activemq {
29 namespace util {
30 
38  private:
39 
40  decaf::util::Properties properties;
41 
42  public:
43 
45 
46  virtual ~ActiveMQProperties();
47 
49  return this->properties;
50  }
51 
52  virtual const decaf::util::Properties& getProperties() const {
53  return this->properties;
54  }
55 
56  virtual void setProperties(decaf::util::Properties& props) {
57  this->properties = props;
58  }
59 
60  virtual int size() const {
61  return properties.size();
62  }
63 
64  virtual bool isEmpty() const {
65  return properties.isEmpty();
66  }
67 
68  virtual const char* getProperty(const std::string& name) const {
69  return properties.getProperty(name);
70  }
71 
72  virtual std::string getProperty(const std::string& name, const std::string& defaultValue) const {
73  return properties.getProperty(name, defaultValue);
74  }
75 
76  virtual void setProperty(const std::string& name, const std::string& value) {
77  properties.setProperty(name, value);
78  }
79 
80  virtual bool hasProperty(const std::string& name) const {
81  return properties.hasProperty(name);
82  }
83 
84  virtual std::string remove(const std::string& name) {
85  return properties.remove(name);
86  }
87 
88  virtual std::vector<std::string> propertyNames() const {
89  return properties.propertyNames();
90  }
91 
92  virtual std::vector<std::pair<std::string, std::string> > toArray() const {
93  return properties.toArray();
94  }
95 
96  virtual void copy(const CMSProperties* source);
97 
98  virtual CMSProperties* clone() const;
99 
100  virtual void clear() {
101  properties.clear();
102  }
103 
104  virtual std::string toString() const {
105  return properties.toString();
106  }
107 
108  };
109 
110 }}
111 
112 #endif /*_ACTIVEMQ_UTIL_ACTIVEMQPROPERTIES_H_*/
virtual const decaf::util::Properties & getProperties() const
Definition: ActiveMQProperties.h:52
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 toString() const
Formats the contents of the Properties Object into a string that can be logged, etc.
#define AMQCPP_API
Definition: Config.h:30
virtual std::vector< std::string > propertyNames() const
Returns a vector containing all the names of the properties currently stored in the Properties object...
Definition: ActiveMQProperties.h:88
virtual void setProperties(decaf::util::Properties &props)
Definition: ActiveMQProperties.h:56
virtual int size() const
Returns the current count of all the Properties that are currently stored in the Properties object...
Definition: ActiveMQProperties.h:60
virtual const char * getProperty(const std::string &name) const
Looks up the value for the given property.
Definition: ActiveMQProperties.h:68
virtual bool hasProperty(const std::string &name) const
Check to see if the Property exists in the set.
Definition: ActiveMQProperties.h:80
virtual void setProperty(const std::string &name, const std::string &value)
Sets the value for a given property.
Definition: ActiveMQProperties.h:76
virtual void clear()
Clears all properties from the map.
Definition: ActiveMQProperties.h:100
virtual std::vector< std::pair< std::string, std::string > > toArray() const
Method that serializes the contents of the property map to an array.
Definition: ActiveMQProperties.h:92
std::vector< std::pair< std::string, std::string > > toArray() const
Method that serializes the contents of the property map to an array.
void clear()
Clears all properties from the map.
Interface for a Java-like properties object.
Definition: CMSProperties.h:34
std::vector< std::string > propertyNames() const
Returns an enumeration of all the keys in this property list, including distinct keys in the default ...
virtual std::string getProperty(const std::string &name, const std::string &defaultValue) const
Looks up the value for the given property.
Definition: ActiveMQProperties.h:72
std::string setProperty(const std::string &name, const std::string &value)
Sets the value for a given property.
virtual decaf::util::Properties & getProperties()
Definition: ActiveMQProperties.h:48
std::string remove(const std::string &name)
Removes the property with the given name.
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: CachedConsumer.h:24
Java-like properties class for mapping string names to string values.
Definition: Properties.h:53
virtual std::string toString() const
Formats the contents of the Properties Object into a string that can be logged, etc.
Definition: ActiveMQProperties.h:104
bool hasProperty(const std::string &name) const
Check to see if the Property exists in the set.
Implementation of the CMSProperties interface that delegates to a decaf::util::Properties object...
Definition: ActiveMQProperties.h:37
virtual bool isEmpty() const
Returns true if the properties object is empty.
Definition: ActiveMQProperties.h:64