]> granicus.if.org Git - icinga2/commitdiff
Renamed Dictionary::{Set,Get}Property -> Dictionary::{Set,Get}
authorGunnar Beutner <gunnar.beutner@netways.de>
Mon, 9 Jul 2012 14:19:56 +0000 (16:19 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Mon, 9 Jul 2012 14:19:56 +0000 (16:19 +0200)
23 files changed:
base/configobject.cpp
base/configobject.h
base/dictionary.cpp
base/dictionary.h
cib/checkresult.cpp
cib/macroprocessor.cpp
cib/service.cpp
cib/servicestatusmessage.cpp
components/checker/checkercomponent.cpp
components/cibsync/cibsynccomponent.cpp
components/convenience/conveniencecomponent.cpp
components/delegation/delegationcomponent.cpp
components/discovery/discoverycomponent.cpp
components/discovery/discoverymessage.cpp
dyn/config_parser.cc
dyn/config_parser.yy
dyn/expression.cpp
icinga/jsonrpcendpoint.cpp
jsonrpc/messagepart.cpp
jsonrpc/messagepart.h
jsonrpc/requestmessage.h
jsonrpc/responsemessage.h
test/base-dictionary.cpp

index 61e1a05c6fa471a2bf012a2fa1209a5a3d56565d..fea51e131d225db3eedd79bf2a5de1c100b735c0 100644 (file)
@@ -52,62 +52,62 @@ Dictionary::Ptr ConfigObject::GetTags(void) const
 string ConfigObject::GetType(void) const
 {
        string type;
-       GetProperties()->GetProperty("__type", &type);
+       GetProperties()->Get("__type", &type);
        return type;
 }
 
 string ConfigObject::GetName(void) const
 {
        string name;
-       GetProperties()->GetProperty("__name", &name);
+       GetProperties()->Get("__name", &name);
        return name;
 }
 
 void ConfigObject::SetLocal(bool value)
 {
-       GetProperties()->SetProperty("__local", value ? 1 : 0);
+       GetProperties()->Set("__local", value ? 1 : 0);
 }
 
 bool ConfigObject::IsLocal(void) const
 {
        bool value = false;
-       GetProperties()->GetProperty("__local", &value);
+       GetProperties()->Get("__local", &value);
        return value;
 }
 
 void ConfigObject::SetAbstract(bool value)
 {
-       GetProperties()->SetProperty("__abstract", value ? 1 : 0);
+       GetProperties()->Set("__abstract", value ? 1 : 0);
 }
 
 bool ConfigObject::IsAbstract(void) const
 {
        bool value = false;
-       GetProperties()->GetProperty("__abstract", &value);
+       GetProperties()->Get("__abstract", &value);
        return value;
 }
 
 void ConfigObject::SetSource(const string& value)
 {
-       GetProperties()->SetProperty("__source", value);
+       GetProperties()->Set("__source", value);
 }
 
 string ConfigObject::GetSource(void) const
 {
        string value;
-       GetProperties()->GetProperty("__source", &value);
+       GetProperties()->Get("__source", &value);
        return value;
 }
 
 void ConfigObject::SetCommitTimestamp(time_t ts)
 {
-       GetProperties()->SetProperty("__tx", static_cast<long>(ts));
+       GetProperties()->Set("__tx", static_cast<long>(ts));
 }
 
 time_t ConfigObject::GetCommitTimestamp(void) const
 {
        long value = false;
-       GetProperties()->GetProperty("__tx", &value);
+       GetProperties()->Get("__tx", &value);
        return value;
 }
 
index 82cb13136c7b755959e55bbe63f4290c6cd1f80c..ca8975d6acc3d843d29e35679b4e5bbd7475c011 100644 (file)
@@ -47,13 +47,13 @@ public:
        template<typename T>
        void SetProperty(const string& key, const T& value)
        {
-               GetProperties()->SetProperty(key, value);
+               GetProperties()->Set(key, value);
        }
 
        template<typename T>
        bool GetProperty(const string& key, T *value) const
        {
-               return GetProperties()->GetProperty(key, value);
+               return GetProperties()->Get(key, value);
        }
 
        Dictionary::Ptr GetTags(void) const;
@@ -61,13 +61,13 @@ public:
        template<typename T>
        void SetTag(const string& key, const T& value)
        {
-               GetTags()->SetProperty(key, value);
+               GetTags()->Set(key, value);
        }
 
        template<typename T>
        bool GetTag(const string& key, T *value) const
        {
-               return GetTags()->GetProperty(key, value);
+               return GetTags()->Get(key, value);
        }
 
        string GetType(void) const;
index a83fa3bd1125a9594fbb89a529da942d41a4c03d..8626916bb060fc2c20c31a0ead9b8ce985f056f4 100644 (file)
@@ -67,7 +67,7 @@ bool Dictionary::Contains(const string& key) const
  *
  * @param key The key.
  */
-void Dictionary::RemoveProperty(const string& key)
+void Dictionary::Remove(const string& key)
 {
        Dictionary::Iterator it;
        it = m_Data.find(key);
index 561b14510e4026b2751f350ff5c63dc74bd4989e..4aa17f9872d04c1ba05b603737c74665614e9ebe 100644 (file)
@@ -45,7 +45,7 @@ public:
         * @returns true if the value was retrieved, false otherwise.
         */
        template<typename T>
-       bool GetProperty(const string& key, T *value) const
+       bool Get(const string& key, T *value) const
        {
                ConstIterator i = m_Data.find(key);
 
@@ -64,11 +64,11 @@ public:
         * @param[out] value Pointer to the value.
         * @returns true if the value was retrieved, false otherwise.
         */
-       bool GetProperty(const string& key, Dictionary::Ptr *value)
+       bool Get(const string& key, Dictionary::Ptr *value)
        {
                Object::Ptr object;
 
-               if (!GetProperty(key, &object))
+               if (!Get(key, &object))
                        return false;
 
                *value = dynamic_pointer_cast<Dictionary>(object);
@@ -85,7 +85,7 @@ public:
         * @param value The value.
         */
        template<typename T>
-       void SetProperty(const string& key, const T& value)
+       void Set(const string& key, const T& value)
        {
                pair<typename map<string, Variant>::iterator, bool> ret;
                ret = m_Data.insert(make_pair(key, value));
@@ -99,7 +99,7 @@ public:
         * @param value The value.
         */
        template<typename T>
-       void AddUnnamedProperty(const T& value)
+       void Add(const T& value)
        {
                Iterator it;
                string key;
@@ -113,7 +113,7 @@ public:
                        it = m_Data.find(key);
                } while (it != m_Data.end());
 
-               SetProperty(key, value);
+               Set(key, value);
        }
 
        bool Contains(const string& key) const;
@@ -123,7 +123,7 @@ public:
 
        long GetLength(void) const;
 
-       void RemoveProperty(const string& key);
+       void Remove(const string& key);
 
 private:
        map<string, Variant> m_Data;
index 92adcdc13a3747fc4fc8a0b3b7e8136e073d7679..0b6fef00b454ffafaf23f53dd5d01dd175593ae0 100644 (file)
@@ -12,96 +12,96 @@ CheckResult::CheckResult(const MessagePart& message)
 
 void CheckResult::SetScheduleStart(time_t ts)
 {
-       SetProperty("schedule_start", static_cast<long>(ts));
+       Set("schedule_start", static_cast<long>(ts));
 }
 
 time_t CheckResult::GetScheduleStart(void) const
 {
        long value = 0;
-       GetProperty("schedule_start", &value);
+       Get("schedule_start", &value);
        return static_cast<time_t>(value);
 }
 
 void CheckResult::SetScheduleEnd(time_t ts)
 {
-       SetProperty("schedule_end", static_cast<long>(ts));
+       Set("schedule_end", static_cast<long>(ts));
 }
 
 time_t CheckResult::GetScheduleEnd(void) const
 {
        long value = 0;
-       GetProperty("schedule_end", &value);
+       Get("schedule_end", &value);
        return static_cast<time_t>(value);
 }
 
 void CheckResult::SetExecutionStart(time_t ts)
 {
-       SetProperty("execution_start", static_cast<long>(ts));
+       Set("execution_start", static_cast<long>(ts));
 }
 
 time_t CheckResult::GetExecutionStart(void) const
 {
        long value = 0;
-       GetProperty("execution_start", &value);
+       Get("execution_start", &value);
        return static_cast<time_t>(value);
 }
 
 void CheckResult::SetExecutionEnd(time_t ts)
 {
-       SetProperty("execution_end", static_cast<long>(ts));
+       Set("execution_end", static_cast<long>(ts));
 }
 
 time_t CheckResult::GetExecutionEnd(void) const
 {
        long value = 0;
-       GetProperty("execution_end", &value);
+       Get("execution_end", &value);
        return value;
 }
 
 void CheckResult::SetState(ServiceState state)
 {
-       SetProperty("state", static_cast<long>(state));
+       Set("state", static_cast<long>(state));
 }
 
 ServiceState CheckResult::GetState(void) const
 {
        long value = StateUnknown;
-       GetProperty("state", &value);
+       Get("state", &value);
        return static_cast<ServiceState>(value);
 }
 
 void CheckResult::SetOutput(string output)
 {
-       SetProperty("output", output);
+       Set("output", output);
 }
 
 string CheckResult::GetOutput(void) const
 {
        string value;
-       GetProperty("output", &value);
+       Get("output", &value);
        return value;
 }
 
 void CheckResult::SetPerformanceDataRaw(const string& pd)
 {
-       SetProperty("performance_data_raw", pd);
+       Set("performance_data_raw", pd);
 }
 
 string CheckResult::GetPerformanceDataRaw(void) const
 {
        string value;
-       GetProperty("performance_data_raw", &value);
+       Get("performance_data_raw", &value);
        return value;
 }
 
 void CheckResult::SetPerformanceData(const Dictionary::Ptr& pd)
 {
-       SetProperty("performance_data", pd);
+       Set("performance_data", pd);
 }
 
 Dictionary::Ptr CheckResult::GetPerformanceData(void) const
 {
        Dictionary::Ptr value;
-       GetProperty("performance_data", &value);
+       Get("performance_data", &value);
        return value;
 }
index 7a699585f5786504f05ab3a8fb9d882d485cc00e..75865a7f6d72c25d32f011122ec065f50c18f412 100644 (file)
@@ -17,7 +17,7 @@ string MacroProcessor::ResolveMacros(const string& str, const Dictionary::Ptr& m
 
                string name = result.substr(pos_first + 1, pos_second - pos_first - 1);
                string value;
-               if (!macros || !macros->GetProperty(name, &value))
+               if (!macros || !macros->Get(name, &value))
                        throw runtime_error("Macro '" + name + "' is not defined.");
 
                result.replace(pos_first, pos_second - pos_first + 1, value);
index 595256fd21ffd4f4f5ef70bc3a85b49fd9467b01..ba9c4d68d85a8d047471c2bbf897a2e18f6f9d28 100644 (file)
@@ -106,7 +106,7 @@ void Service::GetDependenciesRecursive(const Dictionary::Ptr& result) const {
                if (result->Contains(it->second))
                        continue;
 
-               result->SetProperty(it->second, it->second);
+               result->Set(it->second, it->second);
 
                Service service = Service::GetByName(it->second);
                service.GetDependenciesRecursive(result);
@@ -383,7 +383,7 @@ Dictionary::Ptr Service::ResolveDependencies(Host host, const Dictionary::Ptr& d
                else
                        name = it->first;
 
-               result->SetProperty(name, name);
+               result->Set(name, name);
        }
 
         return result;
index c05134b48a6d50b5c2c70fba70722a488d8adca1..80a800fb837416df0ff76ca97e83c2603051c2ce 100644 (file)
@@ -4,18 +4,18 @@ using namespace icinga;
 
 bool ServiceStatusMessage::GetService(string *service) const
 {
-       return GetProperty("service", service);
+       return Get("service", service);
 }
 
 void ServiceStatusMessage::SetService(const string& service)
 {
-       SetProperty("service", service);
+       Set("service", service);
 }
 
 bool ServiceStatusMessage::GetState(ServiceState *state) const
 {
        long value;
-       if (GetProperty("state", &value)) {
+       if (Get("state", &value)) {
                *state = static_cast<ServiceState>(value);
                return true;
        }
@@ -24,13 +24,13 @@ bool ServiceStatusMessage::GetState(ServiceState *state) const
 
 void ServiceStatusMessage::SetState(ServiceState state)
 {
-       SetProperty("state", static_cast<long>(state));
+       Set("state", static_cast<long>(state));
 }
 
 bool ServiceStatusMessage::GetStateType(ServiceStateType *type) const
 {
        long value;
-       if (GetProperty("state_type", &value)) {
+       if (Get("state_type", &value)) {
                *type = static_cast<ServiceStateType>(value);
                return true;
        }
@@ -39,23 +39,23 @@ bool ServiceStatusMessage::GetStateType(ServiceStateType *type) const
 
 void ServiceStatusMessage::SetStateType(ServiceStateType type)
 {
-       SetProperty("state_type", static_cast<long>(type));
+       Set("state_type", static_cast<long>(type));
 }
 
 bool ServiceStatusMessage::GetCurrentCheckAttempt(long *attempt) const
 {
-       return GetProperty("current_attempt", attempt);
+       return Get("current_attempt", attempt);
 }
 
 void ServiceStatusMessage::SetCurrentCheckAttempt(long attempt)
 {
-       SetProperty("current_attempt", attempt);
+       Set("current_attempt", attempt);
 }
 
 bool ServiceStatusMessage::GetNextCheck(time_t *ts) const
 {
        long value;
-       if (GetProperty("next_check", &value)) {
+       if (Get("next_check", &value)) {
                *ts = value;
                return true;
        }
@@ -64,13 +64,13 @@ bool ServiceStatusMessage::GetNextCheck(time_t *ts) const
 
 void ServiceStatusMessage::SetNextCheck(time_t ts)
 {
-       SetProperty("next_check", static_cast<long>(ts));
+       Set("next_check", static_cast<long>(ts));
 }
 
 bool ServiceStatusMessage::GetCheckResult(CheckResult *cr) const
 {
        Dictionary::Ptr obj;
-       if (GetProperty("result", &obj)) {
+       if (Get("result", &obj)) {
                *cr = CheckResult(MessagePart(obj));
                return true;
        }
@@ -79,5 +79,5 @@ bool ServiceStatusMessage::GetCheckResult(CheckResult *cr) const
 
 void ServiceStatusMessage::SetCheckResult(CheckResult cr)
 {
-       SetProperty("result", cr.GetDictionary());
-}
\ No newline at end of file
+       Set("result", cr.GetDictionary());
+}
index e1dbb1bf05cdde63f556d82cb0da81f3551f88e1..b5165fd944d92859a498bfc7fab53a7b5d0f4b30 100644 (file)
@@ -184,7 +184,7 @@ void CheckerComponent::AssignServiceRequestHandler(const Endpoint::Ptr& sender,
                return;
 
        MessagePart serviceMsg;
-       if (!params.GetProperty("service", &serviceMsg))
+       if (!params.Get("service", &serviceMsg))
                return;
 
        ConfigObject::Ptr object = boost::make_shared<ConfigObject>(serviceMsg.GetDictionary());
index abda6c13404f938f1d57abfa4498970a9dfcd1bc..a962fec159f9b29c101e2cbc4b22b6bcf725d6f2 100644 (file)
@@ -153,11 +153,11 @@ RequestMessage CIBSyncComponent::MakeObjectMessage(const ConfigObject::Ptr& obje
        MessagePart params;
        msg.SetParams(params);
 
-       params.SetProperty("name", object->GetName());
-       params.SetProperty("type", object->GetType());
+       params.Set("name", object->GetName());
+       params.Set("type", object->GetType());
 
        if (includeProperties)
-               params.SetProperty("properties", object->GetProperties());
+               params.Set("properties", object->GetProperties());
 
        return msg;
 }
@@ -216,15 +216,15 @@ void CIBSyncComponent::RemoteObjectCommittedHandler(const Endpoint::Ptr& sender,
                return;
 
        string name;
-       if (!params.GetProperty("name", &name))
+       if (!params.Get("name", &name))
                return;
 
        string type;
-       if (!params.GetProperty("type", &type))
+       if (!params.Get("type", &type))
                return;
 
        MessagePart properties;
-       if (!params.GetProperty("properties", &properties))
+       if (!params.Get("properties", &properties))
                return;
 
        ConfigObject::Ptr object = ConfigObject::GetObject(type, name);
@@ -276,11 +276,11 @@ void CIBSyncComponent::RemoteObjectRemovedHandler(const RequestMessage& request)
                return;
 
        string name;
-       if (!params.GetProperty("name", &name))
+       if (!params.Get("name", &name))
                return;
 
        string type;
-       if (!params.GetProperty("type", &type))
+       if (!params.Get("type", &type))
                return;
 
        ConfigObject::Ptr object = ConfigObject::GetObject(type, name);
index 4e6d5f59f1b0c75858a209d1f499414352472338..733fe29aa8f8abf94f1eb4d7efea5b2d689f6588 100644 (file)
@@ -57,32 +57,32 @@ void ConvenienceComponent::HostAddedHandler(const ConfigItem::Ptr& item)
 void ConvenienceComponent::CopyServiceAttributes(const ConfigObject::Ptr& host, const Dictionary::Ptr& service, const ConfigItemBuilder::Ptr& builder)
 {
        Dictionary::Ptr macros; 
-       if (service->GetProperty("macros", &macros))
+       if (service->Get("macros", &macros))
                builder->AddExpression("macros", OperatorPlus, macros);
 
        long checkInterval;
-       if (service->GetProperty("check_interval", &checkInterval))
+       if (service->Get("check_interval", &checkInterval))
                builder->AddExpression("check_interval", OperatorSet, checkInterval);
 
        long retryInterval;
-       if (service->GetProperty("retry_interval", &retryInterval))
+       if (service->Get("retry_interval", &retryInterval))
                builder->AddExpression("retry_interval", OperatorSet, retryInterval);
 
        Dictionary::Ptr sgroups;
-       if (service->GetProperty("servicegroups", &sgroups))
+       if (service->Get("servicegroups", &sgroups))
                builder->AddExpression("servicegroups", OperatorPlus, sgroups);
 
        Dictionary::Ptr checkers;
-       if (service->GetProperty("checkers", &checkers))
+       if (service->Get("checkers", &checkers))
                builder->AddExpression("checkers", OperatorSet, checkers);
 
        Dictionary::Ptr dependencies;
-       if (service->GetProperty("dependencies", &dependencies))
+       if (service->Get("dependencies", &dependencies))
                builder->AddExpression("dependencies", OperatorPlus,
                    Service::ResolveDependencies(host, dependencies));
 
        Dictionary::Ptr hostchecks;
-       if (service->GetProperty("hostchecks", &hostchecks))
+       if (service->Get("hostchecks", &hostchecks))
                builder->AddExpression("dependencies", OperatorPlus,
                    Service::ResolveDependencies(host, hostchecks));
 }
@@ -134,7 +134,7 @@ void ConvenienceComponent::HostCommittedHandler(const ConfigItem::Ptr& item)
                                        throw invalid_argument("Service description invalid.");
 
                                string parent;
-                               if (!service->GetProperty("service", &parent))
+                               if (!service->Get("service", &parent))
                                        parent = svcname;
 
                                builder->AddParent(parent);
@@ -147,7 +147,7 @@ void ConvenienceComponent::HostCommittedHandler(const ConfigItem::Ptr& item)
                        ConfigItem::Ptr serviceItem = builder->Compile();
                        serviceItem->Commit();
 
-                       newServices->SetProperty(name, serviceItem);
+                       newServices->Set(name, serviceItem);
                }
        }
 
index e0b92d9de439401ad6a66c2947d47dbb62dae3c7..84aa545d038fb3a96266d852565bf5bfdf2784ee 100644 (file)
@@ -96,7 +96,7 @@ void DelegationComponent::AssignService(const Endpoint::Ptr& checker, const Serv
        request.SetMethod("checker::AssignService");
 
        MessagePart params;
-       params.SetProperty("service", service.GetConfigObject()->GetProperties());
+       params.Set("service", service.GetConfigObject()->GetProperties());
        request.SetParams(params);
 
        Application::Log(LogDebug, "delegation", "Trying to delegate service '" + service.GetName() + "'");
index a1f598e0f2444887503d19bfd9874e113cff2f26..2b6080da78e6069923acf20c306c67596f43fbeb 100644 (file)
@@ -301,13 +301,13 @@ void DiscoveryComponent::SendDiscoveryMessage(const string& method, const string
        set<string>::iterator i;
        MessagePart subscriptions;
        for (i = info->Subscriptions.begin(); i != info->Subscriptions.end(); i++)
-               subscriptions.AddUnnamedProperty(*i);
+               subscriptions.Add(*i);
 
        params.SetSubscriptions(subscriptions);
 
        MessagePart publications;
        for (i = info->Publications.begin(); i != info->Publications.end(); i++)
-               publications.AddUnnamedProperty(*i);
+               publications.Add(*i);
 
        params.SetPublications(publications);
 
index a509885572ad7f961c51dd84336b3b023d291036..475b9cfc198f93c6be0f59ed217815d9e88e9545 100644 (file)
@@ -12,50 +12,50 @@ DiscoveryMessage::DiscoveryMessage(const MessagePart& message)
 
 bool DiscoveryMessage::GetIdentity(string *value) const
 {
-       return GetProperty("identity", value);
+       return Get("identity", value);
 }
 
 void DiscoveryMessage::SetIdentity(const string& value)
 {
-       SetProperty("identity", value);
+       Set("identity", value);
 }
 
 bool DiscoveryMessage::GetNode(string *value) const
 {
-       return GetProperty("node", value);
+       return Get("node", value);
 }
 
 void DiscoveryMessage::SetNode(const string& value)
 {
-       SetProperty("node", value);
+       Set("node", value);
 }
 
 bool DiscoveryMessage::GetService(string *value) const
 {
-       return GetProperty("service", value);
+       return Get("service", value);
 }
 
 void DiscoveryMessage::SetService(const string& value)
 {
-       SetProperty("service", value);
+       Set("service", value);
 }
 
 bool DiscoveryMessage::GetSubscriptions(MessagePart *value) const
 {
-       return GetProperty("subscriptions", value);
+       return Get("subscriptions", value);
 }
 
 void DiscoveryMessage::SetSubscriptions(MessagePart value)
 {
-       SetProperty("subscriptions", value);
+       Set("subscriptions", value);
 }
 
 bool DiscoveryMessage::GetPublications(MessagePart *value) const
 {
-       return GetProperty("publications", value);
+       return Get("publications", value);
 }
 
 void DiscoveryMessage::SetPublications(MessagePart value)
 {
-       SetProperty("publications", value);
-}
\ No newline at end of file
+       Set("publications", value);
+}
index 1ea713bbcf2c0afe09499dd7f74744ded1e2451a..911b4c68c8f6736a669ff6d04669af69fd180252 100644 (file)
@@ -1768,7 +1768,7 @@ yyreduce:
 /* Line 1806 of yacc.c  */
 #line 259 "config_parser.yy"
     {
-               m_Array->AddUnnamedProperty(*(yyvsp[(1) - (1)].variant));
+               m_Array->Add(*(yyvsp[(1) - (1)].variant));
                delete (yyvsp[(1) - (1)].variant);
        }
     break;
index 6bf6e9aee85a3400f2c9729fac40ccdf27518eed..4e3a1962886949365ebec92c832f923da9c4bbbd 100644 (file)
@@ -257,7 +257,7 @@ tuple: '('
 
 tupleitem: simplevalue
        {
-               m_Array->AddUnnamedProperty(*$1);
+               m_Array->Add(*$1);
                delete $1;
        }
 
index d6740bd7745bd26a66a5ac0b6d5abae1d3b1b5fc..cbca7eb428e47b803e1f6473e5663b459dfaa95f 100644 (file)
@@ -60,7 +60,7 @@ void Expression::Execute(const Dictionary::Ptr& dictionary) const
                        break;
 
                case OperatorPlus:
-                       dictionary->GetProperty(m_Key, &oldValue);
+                       dictionary->Get(m_Key, &oldValue);
 
                        if (oldValue.GetType() == VariantObject)
                                dict = dynamic_pointer_cast<Dictionary>(oldValue.GetObject());
@@ -82,7 +82,7 @@ void Expression::Execute(const Dictionary::Ptr& dictionary) const
                        } else if (valueDict) {
                                Dictionary::Iterator it;
                                for (it = valueDict->Begin(); it != valueDict->End(); it++) {
-                                       dict->SetProperty(it->first, it->second);
+                                       dict->Set(it->first, it->second);
                                }
                        } else {
                                stringstream message;
@@ -96,5 +96,5 @@ void Expression::Execute(const Dictionary::Ptr& dictionary) const
                        throw runtime_error("Not yet implemented.");
        }
 
-       dictionary->SetProperty(m_Key, newValue);
+       dictionary->Set(m_Key, newValue);
 }
index 8815164519d570b7c6231e0d1ea63f0f7580b0e3..9dcc123eb706742a508b96b3b4e6c7af89d0b0ec 100644 (file)
@@ -91,15 +91,15 @@ void JsonRpcEndpoint::NewMessageHandler(const MessagePart& message)
                return;
        }
 
+       RequestMessage request = message;
+
        string method;
-       if (!message.GetProperty("method", &method))
+       if (!request.GetMethod(&method))
                return;
 
        if (!HasPublication(method))
                return;
 
-       RequestMessage request = message;
-
        string id;
        if (request.GetID(&id))
                GetEndpointManager()->SendAnycastMessage(sender, request);
index d2cb6881ef133562cd37cbd8395c1eaf5e17ef6f..7b3a2ef7ed48236a8a0eb4eb35da4d1c0906efd7 100644 (file)
@@ -81,13 +81,13 @@ Dictionary::Ptr MessagePart::GetDictionaryFromJson(json_t *json)
        for (cJSON *i = json->child; i != NULL; i = i->next) {
                switch (i->type) {
                        case cJSON_Number:
-                               dictionary->SetProperty(i->string, i->valueint);
+                               dictionary->Set(i->string, i->valueint);
                                break;
                        case cJSON_String:
-                               dictionary->SetProperty(i->string, i->valuestring);
+                               dictionary->Set(i->string, i->valuestring);
                                break;
                        case cJSON_Object:
-                               dictionary->SetProperty(i->string, GetDictionaryFromJson(i));
+                               dictionary->Set(i->string, GetDictionaryFromJson(i));
                                break;
                        default:
                                break;
@@ -176,10 +176,10 @@ Dictionary::Ptr MessagePart::GetDictionary(void) const
  * @param[out] The value.
  * @returns true if the value was retrieved, false otherwise.
  */
-bool MessagePart::GetProperty(string key, MessagePart *value) const
+bool MessagePart::Get(string key, MessagePart *value) const
 {
        Object::Ptr object;
-       if (!GetDictionary()->GetProperty(key, &object))
+       if (!GetDictionary()->Get(key, &object))
                return false;
 
        Dictionary::Ptr dictionary = dynamic_pointer_cast<Dictionary>(object);
@@ -196,9 +196,9 @@ bool MessagePart::GetProperty(string key, MessagePart *value) const
  * @param key The name of the property.
  * @param value The value.
  */
-void MessagePart::SetProperty(string key, const MessagePart& value)
+void MessagePart::Set(string key, const MessagePart& value)
 {
-       GetDictionary()->SetProperty(key, value.GetDictionary());
+       GetDictionary()->Set(key, value.GetDictionary());
 }
 
 /**
@@ -206,9 +206,9 @@ void MessagePart::SetProperty(string key, const MessagePart& value)
  *
  * @param value The value.
  */
-void MessagePart::AddUnnamedProperty(const MessagePart& value)
+void MessagePart::Add(const MessagePart& value)
 {
-       GetDictionary()->AddUnnamedProperty(value.GetDictionary());
+       GetDictionary()->Add(value.GetDictionary());
 }
 
 /**
index 80554cabfb87d1fa1432948a6edce525ced84bc1..276d3e92879a07111c9062f26d3ba7a5376670d7 100644 (file)
@@ -52,9 +52,9 @@ public:
         * @returns true if the value was retrieved, false otherwise.
         */
        template<typename T>
-       bool GetProperty(string key, T *value) const
+       bool Get(string key, T *value) const
        {
-               return GetDictionary()->GetProperty(key, value);
+               return GetDictionary()->Get(key, value);
        }
 
        /**
@@ -64,13 +64,13 @@ public:
         * @param value The value.
         */
        template<typename T>
-       void SetProperty(string key, const T& value)
+       void Set(string key, const T& value)
        {
-               GetDictionary()->SetProperty(key, value);
+               GetDictionary()->Set(key, value);
        }
 
-       bool GetProperty(string key, MessagePart *value) const;
-       void SetProperty(string key, const MessagePart& value);
+       bool Get(string key, MessagePart *value) const;
+       void Set(string key, const MessagePart& value);
 
        /**
         * Adds an item to the message using an automatically generated property name.
@@ -78,12 +78,12 @@ public:
         * @param value The value.
         */
        template<typename T>
-       void AddUnnamedProperty(const T& value)
+       void Add(const T& value)
        {
-               GetDictionary()->AddUnnamedProperty(value);
+               GetDictionary()->Add(value);
        }
 
-       void AddUnnamedProperty(const MessagePart& value);
+       void Add(const MessagePart& value);
 
        bool Contains(const string& key) const;
 
index 868e2c8bc75518a33466a587a9d1c0351129361a..6f571c5e060de126a58fb84497a6d414a6a48ae6 100644 (file)
@@ -53,7 +53,7 @@ public:
         */
        inline bool GetVersion(string *value) const
        {
-               return GetProperty("jsonrpc", value);
+               return Get("jsonrpc", value);
        }
 
        /**
@@ -63,7 +63,7 @@ public:
         */
        inline void SetVersion(const string& value)
        {
-               SetProperty("jsonrpc", value);
+               Set("jsonrpc", value);
        }
 
        /**
@@ -74,7 +74,7 @@ public:
         */
        inline bool GetMethod(string *value) const
        {
-               return GetProperty("method", value);
+               return Get("method", value);
        }
 
        /**
@@ -84,7 +84,7 @@ public:
         */
        inline void SetMethod(const string& value)
        {
-               SetProperty("method", value);
+               Set("method", value);
        }
 
        /**
@@ -95,7 +95,7 @@ public:
         */
        inline bool GetParams(MessagePart *value) const
        {
-               return GetProperty("params", value);
+               return Get("params", value);
        }
 
        /**
@@ -105,7 +105,7 @@ public:
         */
        inline void SetParams(const MessagePart& value)
        {
-               SetProperty("params", value);
+               Set("params", value);
        }
 
        /**
@@ -116,7 +116,7 @@ public:
         */
        inline bool GetID(string *value) const
        {
-               return GetProperty("id", value);
+               return Get("id", value);
        }
 
        /**
@@ -126,7 +126,7 @@ public:
         */
        inline void SetID(const string& value)
        {
-               SetProperty("id", value);
+               Set("id", value);
        }
 };
 
index 8a6431085be70e5631a004397604f17933e090a5..39466409b2620cb27675c9aaf9aa778d80ff4a3f 100644 (file)
@@ -53,7 +53,7 @@ public:
         */
        inline bool GetVersion(string *value) const
        {
-               return GetProperty("jsonrpc", value);
+               return Get("jsonrpc", value);
        }
 
        /**
@@ -63,7 +63,7 @@ public:
         */
        inline void SetVersion(const string& value)
        {
-               SetProperty("jsonrpc", value);
+               Set("jsonrpc", value);
        }
 
        /**
@@ -74,7 +74,7 @@ public:
         */
        bool GetResult(MessagePart *value) const
        {
-               return GetProperty("result", value);
+               return Get("result", value);
        }
 
        /**
@@ -84,7 +84,7 @@ public:
         */
        void SetResult(const MessagePart& value)
        {
-               SetProperty("result", value);
+               Set("result", value);
        }
 
        /**
@@ -95,7 +95,7 @@ public:
         */
        bool GetError(string *value) const
        {
-               return GetProperty("error", value);
+               return Get("error", value);
        }
 
        /**
@@ -105,7 +105,7 @@ public:
         */
        void SetError(const string& value)
        {
-               SetProperty("error", value);
+               Set("error", value);
        }
 
        /**
@@ -116,7 +116,7 @@ public:
         */
        bool GetID(string *value) const
        {
-               return GetProperty("id", value);
+               return Get("id", value);
        }
 
        /**
@@ -126,7 +126,7 @@ public:
         */
        void SetID(const string& value)
        {
-               SetProperty("id", value);
+               Set("id", value);
        }
 
        /**
index 071e745eec0cff1eae6f991f842b844df8bb608e..2c56f8fa1d1e0c5cd19798fb747e6508c61945b6 100644 (file)
@@ -14,19 +14,19 @@ BOOST_AUTO_TEST_CASE(construct)
 BOOST_AUTO_TEST_CASE(getproperty)
 {
        Dictionary::Ptr dictionary = make_shared<Dictionary>();
-       dictionary->SetProperty("test1", 7);
-       dictionary->SetProperty("test2", "hello world");
+       dictionary->Set("test1", 7);
+       dictionary->Set("test2", "hello world");
 
        long test1;
-       BOOST_REQUIRE(dictionary->GetProperty("test1", &test1));
+       BOOST_REQUIRE(dictionary->Get("test1", &test1));
        BOOST_REQUIRE(test1 == 7);
 
        string test2;
-       BOOST_REQUIRE(dictionary->GetProperty("test2", &test2));
+       BOOST_REQUIRE(dictionary->Get("test2", &test2));
        BOOST_REQUIRE(test2 == "hello world");
 
        long test3;
-       BOOST_REQUIRE(!dictionary->GetProperty("test3", &test3));
+       BOOST_REQUIRE(!dictionary->Get("test3", &test3));
 }
 
 BOOST_AUTO_TEST_CASE(getproperty_dict)
@@ -34,22 +34,22 @@ BOOST_AUTO_TEST_CASE(getproperty_dict)
        Dictionary::Ptr dictionary = make_shared<Dictionary>();
        Dictionary::Ptr other = make_shared<Dictionary>();
 
-       dictionary->SetProperty("test1", other);
+       dictionary->Set("test1", other);
 
        Dictionary::Ptr test1;
-       BOOST_REQUIRE(dictionary->GetProperty("test1", &test1));
+       BOOST_REQUIRE(dictionary->Get("test1", &test1));
        BOOST_REQUIRE(other == test1);
 
        Dictionary::Ptr test2;
-       BOOST_REQUIRE(!dictionary->GetProperty("test2", &test2));
+       BOOST_REQUIRE(!dictionary->Get("test2", &test2));
 }
 
 BOOST_AUTO_TEST_CASE(unnamed)
 {
        Dictionary::Ptr dictionary = make_shared<Dictionary>();
-       dictionary->AddUnnamedProperty("test1");
-       dictionary->AddUnnamedProperty("test2");
-       dictionary->AddUnnamedProperty("test3");
+       dictionary->Add("test1");
+       dictionary->Add("test2");
+       dictionary->Add("test3");
 
        BOOST_REQUIRE(distance(dictionary->Begin(), dictionary->End()) == 3);
 }