Clean code and added a few amendments (if()).
[irreco.git] / irreco / src / core / irreco_backend_device.h
blob9860fb2d95ea13e5f092c1dbf1a06ff3a4166351
1 /*
2 * irreco - Ir Remote Control
3 * Copyright (C) 2007 Arto Karppinen (arto.karppinen@iki.fi)
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 /**
21 * @addtogroup IrrecoBackendDevice
22 * @{
25 /**
26 * @file
27 * Header file of @ref IrrecoBackendDevice.
30 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
31 /* Typedef */
32 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
34 * Make sure that typedefs are available before we include anything elese.
36 * This makes sure that whatever other structures that depend on structures
37 * defined in this file will compile OK recardles of header inclusion order.
39 #ifndef __IRRECO_BACKEND_DEVICE_H_TYPEDEF__
40 #define __IRRECO_BACKEND_DEVICE_H_TYPEDEF__
41 typedef struct _IrrecoBackendDevice IrrecoBackendDevice;
42 #endif /* __IRRECO_BACKEND_DEVICE_H_TYPEDEF__ */
46 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
47 /* Include */
48 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
49 #ifndef __IRRECO_BACKEND_DEVICE_H__
50 #define __IRRECO_BACKEND_DEVICE_H__
51 #include "irreco.h"
52 #include "irreco_backend_instance.h"
53 #include <irreco_string_table.h>
57 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
58 /* Datatypes */
59 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
60 struct _IrrecoBackendDevice {
61 IrrecoBackendInstance *backend_instance;
62 gpointer contex;
63 gchar *name;
64 IrrecoStringTable *command_list;
69 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
70 /* Macro */
71 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
74 * Check if command_list is empty.
76 * Returns: TRUE if empty, FALSE otherwise.
78 #define irreco_backend_device_is_empty(_device) \
79 irreco_string_table_is_empty(_device->command_list)
82 * Iterate through the list of commands the device supports.
84 #define IRRECO_BACKEND_DEVICE_FOREACH(_device, _command_var_name) \
85 IRRECO_STRING_TABLE_FOREACH_KEY(_device->command_list, \
86 _command_var_name)
87 #define IRRECO_BACKEND_DEVICE_FOREACH_END IRRECO_STRING_TABLE_FOREACH_END
91 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
92 /* Prototypes */
93 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
94 IrrecoBackendDevice *
95 irreco_backend_device_create(const gchar *name,
96 IrrecoBackendInstance * backend_instance,
97 gpointer *contex);
98 void irreco_backend_device_destroy(IrrecoBackendDevice *backend_device);
99 gboolean irreco_backend_device_is_editable(IrrecoBackendDevice * device);
100 void irreco_backend_device_edit(IrrecoBackendDevice *backend_device,
101 GtkWindow * parent);
102 void irreco_backend_device_delete(IrrecoBackendDevice *backend_device,
103 GtkWindow * parent);
106 #endif /* __IRRECO_BACKEND_DEVICE_H__ */
108 /** @} */