source: filezilla/trunk/fuentes/src/dbus/wxdbusmessage.h @ 130

Last change on this file since 130 was 130, checked in by jrpelegrina, 4 years ago

First release to xenial

File size: 3.5 KB
Line 
1/****************************************************************************
2
3Copyright (c) 2007 Andrei Borovsky <anb@symmetrica.net>
4
5Permission is hereby granted, free of charge, to any person obtaining a
6copy of this software and associated documentation files (the "Software"),
7to deal in the Software without restriction, including without limitation
8the rights to use, copy, modify, merge, publish, distribute, sublicense,
9and/or sell copies of the Software, and to permit persons to whom the
10Software is furnished to do so, subject to the following conditions:
11
12The above copyright notice and this permission notice shall be included in
13all copies or substantial portions of the Software.
14
15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21DEALINGS IN THE SOFTWARE.
22
23****************************************************************************/
24
25#ifndef WX_DBUS_MESSAGE
26#define WX_DBUS_MESSAGE
27
28#include "wxdbusconnection.h"
29
30class wxDBusMessage : public wxObject
31{
32public:
33        wxDBusMessage(DBusMessage * message);
34        virtual ~wxDBusMessage();
35
36        wxDBusMessage(wxDBusMessage const&) = delete;
37        wxDBusMessage& operator=(wxDBusMessage const&) = delete;
38
39        static wxDBusMessage * ExtractFromEvent(wxDBusConnectionEvent * event);
40        unsigned int GetSerial();
41        unsigned int GetReplySerial();
42        void SetReplySerial(unsigned int serial);
43        const char * GetPath();
44        const char * GetInterface();
45        const char * GetMember();
46        int GetType();
47        DBusMessage * GetMessage();
48        bool MoveToNextArg();
49        int GetAgrType();
50        void GetArgValue(void * value);
51        const char * GetString();
52        const char * GetObjectPath();
53        bool GetUInt(wxUint32& u);
54        int GetArrayElementType();
55        //int GetArrayLength(); uses deprecated function
56        void GetFixedArray(void * value, int * n_elements);
57        bool AddArg(int type, void * value);
58        bool AddArrayOfString(const char **value, int n_elements);
59        bool AddArrayOfByte(int element_type, const void *value, int n_elements);
60        bool AddString(const char * value);
61        bool AddInt(int value);
62        bool AddUnsignedInt(unsigned int value);
63        bool AddBool(bool value);
64        bool AddObjectPath(const char* value);
65        bool AddDict(const char** value, int n_elements); // Call with null to add empty dictionary. n_elements needs to be divisible by 2
66        bool Send(wxDBusConnection * connection, unsigned int * serial);
67
68private:
69        DBusMessage * m_message{};
70        DBusMessageIter m_iter{};
71        bool m_get_iter_initialized{};
72        bool m_add_iter_initialized{};
73        void init_add_iter();
74};
75
76class wxDBusMethodCall : public wxDBusMessage
77{
78public:
79        wxDBusMethodCall(const char *destination, const char *path, const char *interface, const char *method);
80        wxDBusMessage * Call(wxDBusConnection * connection, int timeout);
81        bool CallAsync(wxDBusConnection * connection, int timeout);
82};
83
84class wxDBusSignal : public wxDBusMessage
85{
86public:
87        wxDBusSignal(const char *path, const char *interface, const char *name);
88};
89
90class wxDBusMethodReturn : public wxDBusMessage
91{
92        wxDBusMethodReturn(wxDBusMessage * method_call);
93        bool Return(wxDBusConnection * connection, unsigned int * serial);
94};
95
96class wxDBusErrorMessage : public wxDBusMessage
97{
98        wxDBusErrorMessage(wxDBusMessage * reply_to, const char * error_name, const char * error_message);
99};
100
101#endif
Note: See TracBrowser for help on using the repository browser.