matchrule.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: LGPL-3.0-or-later OR BSD-3-Clause
2 /***************************************************************************
3  * Copyright (C) 2020 by Robert Middleton *
4  * robert.middleton@rm5248.com *
5  * *
6  * This file is part of the dbus-cxx library. *
7  ***************************************************************************/
8 #ifndef DBUSCXX_MATCH_RULE_H
9 #define DBUSCXX_MATCH_RULE_H
10 
11 #include <string>
12 #include <memory>
14 
15 namespace DBus {
16 
17 class MatchRuleBuilder;
18 class MatchRuleData;
19 
23 class MatchRule {
24 protected:
25  MatchRule( std::string type, const std::shared_ptr<MatchRuleData> );
26 
27 public:
28  std::string match_rule() const;
29 
30  std::string path() const;
31 
32  std::string dbus_interface() const;
33 
34  std::string member() const;
35 
36 private:
37  DBUS_CXX_PROPAGATE_CONST( std::shared_ptr<MatchRuleData> ) m_priv;
38 
39  friend class MatchRuleBuilder;
40 };
41 
45 class SignalMatchRule : public MatchRule {
46 private:
47  SignalMatchRule( std::shared_ptr<MatchRuleData> );
48 
49  friend class MatchRuleBuilder;
50 };
51 
53 private:
54  MethodCallMatchRule( std::shared_ptr<MatchRuleData> );
55 
56  friend class MatchRuleBuilder;
57 };
58 
60 private:
61  MethodReturnMatchRule( std::shared_ptr<MatchRuleData> );
62 
63  friend class MatchRuleBuilder;
64 };
65 
66 class ErrorMatchRule : public MatchRule {
67 private:
68  ErrorMatchRule( std::shared_ptr<MatchRuleData> );
69 
70  friend class MatchRuleBuilder;
71 };
72 
78 protected:
80 
81 public:
82  MatchRuleBuilder& set_path( const std::string& path );
83 
84  MatchRuleBuilder& set_interface( const std::string& interface_name );
85 
86  MatchRuleBuilder& set_member( const std::string& member );
87 
88  MatchRuleBuilder& set_sender( const std::string& sender );
89 
90  MatchRuleBuilder& set_destination( const std::string& destination );
91 
93 
95 
97 
99 
100  static MatchRuleBuilder create();
101 
102 private:
103  std::shared_ptr<MatchRuleData> m_priv;
104 };
105 
106 
107 
108 } /* namespace DBus */
109 
110 #endif /* DBUSCXX_MATCH_RULE_H */
Definition: matchrule.h:66
ErrorMatchRule(std::shared_ptr< MatchRuleData >)
Definition: matchrule.cpp:139
A builder to create match rules.
Definition: matchrule.h:77
MatchRuleBuilder & set_interface(const std::string &interface_name)
Definition: matchrule.cpp:43
MatchRuleBuilder & set_path(const std::string &path)
Definition: matchrule.cpp:38
MatchRuleBuilder & set_destination(const std::string &destination)
Definition: matchrule.cpp:58
SignalMatchRule as_signal_match()
Definition: matchrule.cpp:63
ErrorMatchRule as_error_match()
Definition: matchrule.cpp:81
MatchRuleBuilder & set_sender(const std::string &sender)
Definition: matchrule.cpp:53
static MatchRuleBuilder create()
Definition: matchrule.cpp:87
MethodCallMatchRule as_method_call_match()
Definition: matchrule.cpp:69
MatchRuleBuilder()
Definition: matchrule.cpp:34
std::shared_ptr< MatchRuleData > m_priv
Definition: matchrule.h:103
MatchRuleBuilder & set_member(const std::string &member)
Definition: matchrule.cpp:48
MethodReturnMatchRule as_method_return_match()
Definition: matchrule.cpp:75
Immutable class that represents a match rule for DBus.
Definition: matchrule.h:23
DBUS_CXX_PROPAGATE_CONST(std::shared_ptr< MatchRuleData >) m_priv
std::string match_rule() const
Definition: matchrule.cpp:110
std::string path() const
Definition: matchrule.cpp:98
MatchRule(std::string type, const std::shared_ptr< MatchRuleData >)
Definition: matchrule.cpp:93
std::string member() const
Definition: matchrule.cpp:106
std::string dbus_interface() const
Definition: matchrule.cpp:102
Definition: matchrule.h:52
MethodCallMatchRule(std::shared_ptr< MatchRuleData >)
Definition: matchrule.cpp:131
Definition: matchrule.h:59
MethodReturnMatchRule(std::shared_ptr< MatchRuleData >)
Definition: matchrule.cpp:135
A special MatchRule for signals.
Definition: matchrule.h:45
SignalMatchRule(std::shared_ptr< MatchRuleData >)
Definition: matchrule.cpp:127
Global DBus namespace, where everything happens.
Definition: callmessage.cpp:18
DataType type(const uint8_t &)
Definition: types.h:137