errormessage.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) 2009,2010 by Rick L. Vinyard, Jr. *
4  * rvinyard@cs.nmsu.edu *
5  * *
6  * This file is part of the dbus-cxx library. *
7  ***************************************************************************/
8 #include <dbus-cxx/message.h>
9 #include <dbus-cxx/callmessage.h>
10 #include <memory>
11 #include <string>
12 
13 #ifndef DBUSCXX_ERRORMESSAGE_H
14 #define DBUSCXX_ERRORMESSAGE_H
15 
16 namespace DBus {
17 
28 class ErrorMessage : public Message {
29 protected:
30 
31  ErrorMessage();
32 
33  ErrorMessage( std::shared_ptr<const CallMessage> callMessage, const std::string& name, const std::string& message );
34 
35 public:
36  static std::shared_ptr<ErrorMessage> create();
37 
38  static std::shared_ptr<ErrorMessage> create( std::shared_ptr<const CallMessage> callMessage, const std::string& name, const std::string& message );
39 
40  std::string name() const;
41 
42  void set_name( const std::string& n );
43 
44  std::string message() const;
45 
46  void set_message( const std::string& message );
47 
48  bool operator == ( const ErrorMessage& ) const;
49 
50  virtual MessageType type() const;
51 
52  bool set_reply_serial( uint32_t );
53 
54  uint32_t reply_serial() const;
55 
62  [[ noreturn ]] void throw_error();
63 
64 };
65 
66 }
67 
68 #endif
Represents a DBus Error message.
Definition: errormessage.h:28
std::string name() const
Definition: errormessage.cpp:43
std::string message() const
Definition: errormessage.cpp:61
void set_message(const std::string &message)
Definition: errormessage.cpp:76
static std::shared_ptr< ErrorMessage > create()
Definition: errormessage.cpp:31
virtual MessageType type() const
Definition: errormessage.cpp:57
ErrorMessage()
Definition: errormessage.cpp:19
bool set_reply_serial(uint32_t)
Definition: errormessage.cpp:81
uint32_t reply_serial() const
Definition: errormessage.cpp:87
bool operator==(const ErrorMessage &) const
Definition: errormessage.cpp:39
void throw_error()
Throw the error associated with this ErrorMessage.
Definition: errormessage.cpp:97
void set_name(const std::string &n)
Definition: errormessage.cpp:53
This class represents a basic DBus message and also serves as a base class for the specialized messag...
Definition: message.h:43
Global DBus namespace, where everything happens.
Definition: callmessage.cpp:18
MessageType
Definition: enums.h:81