3 #ifndef USERLAND_FS_DRIVER_SETTINGS_H
4 #define USERLAND_FS_DRIVER_SETTINGS_H
6 struct driver_parameter
;
7 struct driver_settings
;
9 namespace UserlandFSUtil
{
11 class DriverParameter
;
12 class DriverParameterContainer
;
14 // DriverParameterIterator
15 class DriverParameterIterator
{
17 DriverParameterIterator();
18 DriverParameterIterator(
19 const DriverParameterIterator
& other
);
20 ~DriverParameterIterator();
23 bool GetNext(DriverParameter
* parameter
);
25 DriverParameterIterator
& operator=(
26 const DriverParameterIterator
& other
);
29 friend class DriverParameterContainer
;
32 DriverParameterIterator(Delegate
* delegate
);
33 void _SetTo(Delegate
* delegate
, bool addReference
);
38 // DriverParameterContainer
39 class DriverParameterContainer
{
41 DriverParameterContainer();
42 virtual ~DriverParameterContainer();
44 int32
CountParameters() const;
45 const driver_parameter
* GetParameters() const;
46 bool GetParameterAt(int32 index
,
47 DriverParameter
* parameter
) const;
48 bool FindParameter(const char* name
,
49 DriverParameter
* parameter
) const;
51 DriverParameterIterator
GetParameterIterator() const;
52 DriverParameterIterator
GetParameterIterator(
53 const char* name
) const;
55 const char* GetParameterValue(const char* name
,
56 const char* unknownValue
= NULL
,
57 const char* noValue
= NULL
) const;
58 bool GetBoolParameterValue(const char* name
,
59 bool unknownValue
= false,
60 bool noValue
= false) const;
61 int32
GetInt32ParameterValue(const char* name
,
62 int32 unknownValue
= 0,
63 int32 noValue
= 0) const;
64 int64
GetInt64ParameterValue(const char* name
,
65 int64 unknownValue
= 0,
66 int64 noValue
= 0) const;
69 virtual const driver_parameter
*
70 GetParametersAndCount(int32
* count
) const = 0;
78 class DriverSettings
: public DriverParameterContainer
{
81 virtual ~DriverSettings();
83 status_t
Load(const char* driverName
);
87 virtual const driver_parameter
*
88 GetParametersAndCount(int32
* count
) const;
91 void* fSettingsHandle
;
92 const driver_settings
* fSettings
;
96 class DriverParameter
: public DriverParameterContainer
{
99 virtual ~DriverParameter();
101 void SetTo(const driver_parameter
* parameter
);
103 const char* GetName() const;
104 int32
CountValues() const;
105 const char* const* GetValues() const;
106 const char* ValueAt(int32 index
,
107 const char* noValue
= NULL
) const;
108 bool BoolValueAt(int32 index
,
109 bool noValue
= false) const;
110 int32
Int32ValueAt(int32 index
,
111 int32 noValue
= 0) const;
112 int64
Int64ValueAt(int32 index
,
113 int64 noValue
= 0) const;
116 virtual const driver_parameter
*
117 GetParametersAndCount(int32
* count
) const;
120 const driver_parameter
* fParameter
;
123 } // namespace UserlandFSUtil
125 using UserlandFSUtil::DriverParameterIterator
;
126 using UserlandFSUtil::DriverParameterContainer
;
127 using UserlandFSUtil::DriverSettings
;
128 using UserlandFSUtil::DriverParameter
;
130 #endif // USERLAND_FS_DRIVER_SETTINGS_H