@@ -9,25 +9,20 @@ namespace xplrules
99 namespace rfxLanXpl
1010 {
1111 DECLARE_ENUM_IMPLEMENTATION_NESTED (CAcBasic::EState, EState,
12- ((Off))
13- ((On))
14- ((Dim))
12+ ((Off))
13+ ((On))
14+ ((Dim))
1515 );
1616
1717 std::string CAcBasic::m_keywordAddress = " address" ;
1818 std::string CAcBasic::m_keywordUnit = " unit" ;
1919 std::string CAcBasic::m_keywordCommand = " command" ;
20- std::string CAcBasic::m_keywordCommandValues = " { \ " values\ " : [\ " on\ " , \ " off\ " , \ " preset\ " ] }" ;
20+ std::string CAcBasic::m_keywordCommandValues = R"( { "values" : ["on", "off", "preset"] }) " ;
2121 std::string CAcBasic::m_keywordLevel = " level" ;
2222 xplcore::CXplMessageSchemaIdentifier CAcBasic::m_protocol = xplcore::CXplMessageSchemaIdentifier::parse(" ac.basic" );
2323
24- CAcBasic::CAcBasic ()
25- {
26- }
27-
28- CAcBasic::~CAcBasic ()
29- {
30- }
24+ CAcBasic::CAcBasic () = default;
25+ CAcBasic::~CAcBasic () = default ;
3126
3227 // IRule implementation
3328 xplcore::CXplMessageSchemaIdentifier CAcBasic::getProtocol ()
@@ -39,13 +34,13 @@ namespace xplrules
3934 {
4035 std::string deviceId = msg.getBodyValue (m_keywordAddress) + " -" + msg.getBodyValue (m_keywordUnit);
4136 std::string commercialName (" ANSLUT, Chacon, DI.O, KlikAanKlikUit, NEXA, Proove, Intertechno, Düwi, HomeEasy UK/EU" );
42- return CDeviceIdentifier ( deviceId, commercialName, m_protocol, m_protocol) ;
37+ return { deviceId, commercialName, m_protocol, m_protocol} ;
4338 }
4439
4540 KeywordList CAcBasic::identifyKeywords (xplcore::CXplMessage& msg)
4641 {
4742 KeywordList keywords;
48- keywords.push_back (boost::make_shared<shared::plugin::yPluginApi::historization::CDimmable>(m_keywordCommand));
43+ keywords.emplace_back (boost::make_shared<shared::plugin::yPluginApi::historization::CDimmable>(m_keywordCommand));
4944 return keywords;
5045 }
5146
@@ -61,6 +56,7 @@ namespace xplrules
6156 EState valFromEquipment (msg.getBodyValue (m_keywordCommand));
6257
6358 auto sw (boost::make_shared<shared::plugin::yPluginApi::historization::CDimmable>(m_keywordCommand));
59+ // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
6460 switch (valFromEquipment)
6561 {
6662 case EState::kOnValue :
@@ -73,9 +69,9 @@ namespace xplrules
7369 sw->set (boost::lexical_cast<int >(msg.getBodyValue (m_keywordLevel)));
7470 break ;
7571 }
76- data.push_back (sw);
72+ data.emplace_back (sw);
7773 }
78- catch (...)
74+ catch (...) // NOLINT(bugprone-empty-catch)
7975 {
8076 }
8177
@@ -96,8 +92,7 @@ namespace xplrules
9692
9793 // check the device address is valid
9894 std::string address = commandData->getDevice ();
99- std::vector<std::string> splittedAddress;
100- boost::split (splittedAddress, address, boost::is_any_of (" -" ), boost::token_compress_on);
95+ std::vector<std::string> splittedAddress = shared::CStringExtension::splitAnyOfAndCompress (address, " -" );
10196
10297 if (splittedAddress.size () != 2 )
10398 {
@@ -149,7 +144,7 @@ namespace xplrules
149144 // set the command
150145 auto s = EState::kDim ;
151146 newMessage->addToBody (m_keywordCommand, s);
152- newMessage->addToBody (m_keywordLevel, boost::lexical_cast< std::string> (commandDetails.switchLevel ()));
147+ newMessage->addToBody (m_keywordLevel, std::to_string (commandDetails.switchLevel ()));
153148 }
154149
155150 return newMessage;
@@ -177,5 +172,3 @@ namespace xplrules
177172 }
178173 } // namespace rfxLanXpl
179174} // namespace xplrules
180-
181-
0 commit comments