| XMP Toolkit SDK 6.0.0

IConfigurable.h
Go to the documentation of this file.
1
5 #ifndef IConfigurable_h__
6 #define IConfigurable_h__ 1
7
8 // =================================================================================================
9 // Copyright Adobe
10 // Copyright 2014 Adobe
11 // All Rights Reserved
12 //
13 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms
14 // of the Adobe license agreement accompanying it. If you have received this file from a source other
15 // than Adobe, then your use, modification, or distribution of it requires the prior written permission
16 // of Adobe.
17 // =================================================================================================
18
19 #include "XMPCommon/XMPCommonFwdDeclarations.h"
20
21 namespace AdobeXMPCommon {
22
32 class XMP_PUBLIC IConfigurable
33 {
34 public:
35
39 typedef enum {
41 kDTNone = 0,
43 kDTBool = 1 << 0,
45 kDTUint64 = 1 << 1,
47 kDTInt64 = 1 << 2,
49 kDTChar = 1 << 3,
51 kDTDouble = 1 << 4,
53 kDTConstCharBuffer = 1 << 5,
55 kDTConstVoidPtr = 1 << 6,
56
58 kDTAll = 0xFFFFFFFF
59 } eDataType;
60
70 virtual void APICALL SetParameter( const uint64 & key, bool value ) = 0;
71 virtual void APICALL SetParameter( const uint64 & key, uint64 value ) = 0;
72 virtual void APICALL SetParameter( const uint64 & key, int64 value ) = 0;
73 virtual void APICALL SetParameter( const uint64 & key, double value ) = 0;
74 virtual void APICALL SetParameter( const uint64 & key, char value ) = 0;
75 virtual void APICALL SetParameter( const uint64 & key, const char * value ) = 0;
76 virtual void APICALL SetParameter( const uint64 & key, const void * value ) = 0;
78
86 virtual bool APICALL RemoveParameter( const uint64 & key ) = 0;
87
97 virtual bool APICALL GetParameter( const uint64 & key, bool & value ) const = 0;
98 virtual bool APICALL GetParameter( const uint64 & key, uint64 & value ) const = 0;
99 virtual bool APICALL GetParameter( const uint64 & key, int64 & value ) const = 0;
100 virtual bool APICALL GetParameter( const uint64 & key, double & value ) const = 0;
101 virtual bool APICALL GetParameter( const uint64 & key, char & value ) const = 0;
102 virtual bool APICALL GetParameter( const uint64 & key, const char * & value ) const = 0;
103 virtual bool APICALL GetParameter( const uint64 & key, const void * & value ) const = 0;
105
111 virtual std::vector< uint64 > APICALL GetAllParameters() const = 0;
112
116 virtual sizet APICALL Size() const __NOTHROW__ = 0;
117
124 virtual eDataType APICALL GetDataType( const uint64 & key ) const = 0;
125
134 static uint64 ConvertCharBufferToUint64( const char * key ) {
135 uint64 keyAsuint64 = 0;
136 if ( key ) {
137 for ( int i = 0; i < 8 && key[ i ] != '\0'; i++ ) {
138 keyAsuint64 = keyAsuint64 << 8;
139 keyAsuint64 += ( unsigned char ) key[ i ];
140 }
141 }
142 return keyAsuint64;
143 }
144
148 union CombinedDataValue {
149 bool boolValue;
150 uint32 uint32Value;
151 uint64 uint64Value;
152 int64 int64Value;
153 double doubleValue;
154 char charValue;
155 const char * constCharPtrValue;
156 const void * constVoidPtrValue;
157 };
158
159 protected:
161 // all safe functions
162 virtual void APICALL setParameter( const uint64 & key, uint32 dataType, const CombinedDataValue & dataValue, pcIError_base & error ) __NOTHROW__ = 0;
163 virtual uint32 APICALL removeParameter( const uint64 & key, pcIError_base & error ) __NOTHROW__ = 0;
164 virtual uint32 APICALL getParameter( const uint64 & key, uint32 dataType, CombinedDataValue & value, pcIError_base & error ) const __NOTHROW__ = 0;
165 virtual void APICALL getAllParameters( uint64 * array, sizet count ) const __NOTHROW__ = 0;
166 virtual uint32 APICALL getDataType( const uint64 & key, pcIError_base & error ) const __NOTHROW__ = 0;
168
169 protected:
173 virtual ~IConfigurable() __NOTHROW__ {};
174
175 friend class IConfigurableProxy;
176 #ifdef FRIEND_CLASS_DECLARATION
177 FRIEND_CLASS_DECLARATION();
178 #endif
179 REQ_FRIEND_CLASS_DECLARATION();
180 };
181
183 #if !BUILDING_XMPCOMMON_LIB && !SOURCE_COMPILING_XMP_ALL
184
185 class IConfigurableProxy
186 : public virtual IConfigurable {
187 public:
188 IConfigurableProxy( pIConfigurable configurable );
189 virtual void APICALL SetParameter( const uint64 & key, bool value );
190 virtual void APICALL SetParameter( const uint64 & key, uint64 value );
191 virtual void APICALL SetParameter( const uint64 & key, int64 value );
192 virtual void APICALL SetParameter( const uint64 & key, double value );
193 virtual void APICALL SetParameter( const uint64 & key, char value );
194 virtual void APICALL SetParameter( const uint64 & key, const char * value );
195 virtual void APICALL SetParameter( const uint64 & key, const void * value );
196 virtual void APICALL setParameter( const uint64 & key, uint32 dataType, const CombinedDataValue & dataValue, pcIError_base & error ) __NOTHROW__;
197
198 virtual bool APICALL RemoveParameter( const uint64 & key );
199 virtual uint32 APICALL removeParameter( const uint64 & key, pcIError_base & error ) __NOTHROW__;
200
201 virtual bool APICALL GetParameter( const uint64 & key, bool & value ) const;
202 virtual bool APICALL GetParameter( const uint64 & key, uint64 & value ) const;
203 virtual bool APICALL GetParameter( const uint64 & key, int64 & value ) const;
204 virtual bool APICALL GetParameter( const uint64 & key, double & value ) const;
205 virtual bool APICALL GetParameter( const uint64 & key, char & value ) const;
206 virtual bool APICALL GetParameter( const uint64 & key, const char * & value ) const;
207 virtual bool APICALL GetParameter( const uint64 & key, const void * & value ) const;
208 virtual uint32 APICALL getParameter( const uint64 & key, uint32 dataType, CombinedDataValue & value, pcIError_base & error ) const __NOTHROW__;
209
210 virtual std::vector< uint64 > APICALL GetAllParameters() const;
211 virtual void APICALL getAllParameters( uint64 * array, sizet count ) const __NOTHROW__;
212
213 virtual sizet APICALL Size() const __NOTHROW__;
214
215 virtual eDataType APICALL GetDataType( const uint64 & key ) const;
216 virtual uint32 APICALL getDataType( const uint64 & key, pcIError_base & error ) const __NOTHROW__;
217
218 protected:
219 pIConfigurable mConfigurableRawPtr;
220 };
221
222 #endif // !BUILDING_XMPCOMMON_LIB && !SOURCE_COMPILING_XMP_ALL
223
225 }
226
227 #endif // IConfigurable_h__
AdobeXMPCommon::IConfigurable
Interface that allows to attach various key-value parameters to the underlying object.
Definition: IConfigurable.h:32
AdobeXMPCommon::IConfigurable::CombinedDataValue::boolValue
bool boolValue
Definition: IConfigurable.h:149
__NOTHROW__
#define __NOTHROW__
Definition: XMPCommonDefines.h:147
AdobeXMPCommon::pIConfigurable
IConfigurable * pIConfigurable
Definition: XMPCommonFwdDeclarations.h:116
XMP_PUBLIC
#define XMP_PUBLIC
Definition: XMP_Environment.h:221
AdobeXMPCommon::IConfigurable::CombinedDataValue::constVoidPtrValue
const void * constVoidPtrValue
Definition: IConfigurable.h:156
AdobeXMPCommon::IConfigurable::CombinedDataValue
A union data type to store all kind of values.
Definition: IConfigurable.h:148
AdobeXMPCommon::IConfigurable::CombinedDataValue::charValue
char charValue
Definition: IConfigurable.h:154
AdobeXMPCommon
Definition: IConfigurable.h:21
XMPCommonFwdDeclarations.h
AdobeXMPCommon::uint32
XMP_Uns32 uint32
Definition: XMPCommonDefines.h:174
AdobeXMPCommon::IConfigurable::CombinedDataValue::constCharPtrValue
const char * constCharPtrValue
Definition: IConfigurable.h:155
AdobeXMPCommon::IConfigurable::~IConfigurable
virtual ~IConfigurable() __NOTHROW__
Definition: IConfigurable.h:173
AdobeXMPCommon::IConfigurable::CombinedDataValue::int64Value
int64 int64Value
Definition: IConfigurable.h:152
AdobeXMPCommon::sizet
uint32 sizet
Definition: XMPCommonDefines.h:176
AdobeXMPCommon::IConfigurable::CombinedDataValue::uint64Value
uint64 uint64Value
Definition: IConfigurable.h:151
REQ_FRIEND_CLASS_DECLARATION
#define REQ_FRIEND_CLASS_DECLARATION()
Definition: XMPCommonDefines.h:137
AdobeXMPCommon::IConfigurable::CombinedDataValue::uint32Value
uint32 uint32Value
Definition: IConfigurable.h:150
AdobeXMPCommon::int64
XMP_Int64 int64
Definition: XMPCommonDefines.h:171
AdobeXMPCommon::IConfigurable::CombinedDataValue::doubleValue
double doubleValue
Definition: IConfigurable.h:153
AdobeXMPCommon::pcIError_base
const typedef IError_v1 * pcIError_base
Definition: XMPCommonFwdDeclarations.h:64
AdobeXMPCommon::uint64
XMP_Uns64 uint64
Definition: XMPCommonDefines.h:172