2 * Copyright 2006-2015, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
6 * Axel Dörfler, axeld@pinc-software.de
7 * Michael Lotz <mmlr@mlotz.ch>
9 #ifndef DRIVER_SETTINGS_MESSAGE_ADAPTER_H
10 #define DRIVER_SETTINGS_MESSAGE_ADAPTER_H
13 #include <driver_settings.h>
17 class DriverSettingsConverter
{
19 DriverSettingsConverter();
20 virtual ~DriverSettingsConverter();
22 virtual status_t
ConvertFromDriverSettings(
23 const driver_parameter
& parameter
,
24 const char* name
, int32 index
, uint32 type
,
26 virtual status_t
ConvertEmptyFromDriverSettings(
27 const driver_parameter
& parameter
,
28 const char* name
, uint32 type
,
31 virtual status_t
ConvertToDriverSettings(const BMessage
& source
,
32 const char* name
, int32 index
,
33 uint32 type
, BString
& value
);
37 struct settings_template
{
40 const settings_template
* sub_template
;
42 DriverSettingsConverter
* converter
;
46 class DriverSettingsMessageAdapter
{
48 DriverSettingsMessageAdapter();
49 ~DriverSettingsMessageAdapter();
51 status_t
ConvertFromDriverSettings(
52 const driver_settings
& settings
,
53 const settings_template
* settingsTemplate
,
55 status_t
ConvertFromDriverSettings(const char* path
,
56 const settings_template
* settingsTemplate
,
59 status_t
ConvertToDriverSettings(
60 const settings_template
* settingsTemplate
,
61 BString
& settings
, const BMessage
& message
);
62 status_t
ConvertToDriverSettings(const char* path
,
63 const settings_template
* settingsTemplate
,
64 const BMessage
& message
);
67 const settings_template
* _FindSettingsTemplate(
68 const settings_template
* settingsTemplate
,
70 const settings_template
* _FindParentValueTemplate(
71 const settings_template
* settingsTemplate
);
72 status_t
_AddParameter(const driver_parameter
& parameter
,
73 const settings_template
& settingsTemplate
,
76 status_t
_ConvertFromDriverParameter(
77 const driver_parameter
& parameter
,
78 const settings_template
* settingsTemplate
,
81 status_t
_AppendSettings(
82 const settings_template
* settingsTemplate
,
83 BString
& settings
, const BMessage
& message
,
84 const char* name
, type_code type
,
86 const char* settingName
= NULL
);
91 #endif // DRIVER_SETTINGS_MESSAGE_ADAPTER_H