NAVTOR SDK  v.3.0
Software Development Kit for fast and efficient development of ECDIS, ECS and generic marine applications
named_properties_interface.h
Go to the documentation of this file.
1 #ifndef SDK_BASE_NAMED_PROPERTIES_INTERFACE_H_
11 #define SDK_BASE_NAMED_PROPERTIES_INTERFACE_H_
12 
13 #include <base/inc/sdk_results.h>
14 #include <base/inc/base_types.h>
15 #include <base/inc/sdk_ref_ptr.h>
17 
18 namespace sdk {
19 
20 FWD_DECL_INTERFACE(ISDKNamedProperties);
21 typedef ISDKNamedPropertiesSP SDKNamedPropertiesSP;
22 typedef ISDKNamedPropertiesSCP SDKNamedPropertiesSCP;
23 
25 
30 {
31  public:
33  virtual SDKResult SDK_CALLTYPE SetProperty(const SDKString& id,
34  const SDKAny& value) throw() = 0;
36  virtual SDKResult SDK_CALLTYPE GetProperty(const SDKString& id,
37  SDKAny& value) const throw() = 0;
38 
39  template<typename T>
40  SDKResult GetPropertyT(const SDKString& id, T& out_value) const noexcept {
41  sdk::ScopedAny value;
42  SDKResult res = GetProperty(id, value);
43  if (SDK_FAILED(res))
44  return res;
45  return value.GetAs< T >(out_value) ?
47  }
48 
49  template<typename T>
50  SDKResult GetPropertyT(const wchar_t* id, T& out_value) const noexcept {
51  if (nullptr == id)
53  sdk::ScopedAny value;
54  SDKResult res = GetProperty(sdk::ScopedString(id), value);
55  if (SDK_FAILED(res))
56  return res;
57  return value.GetAs< T >(out_value) ?
59  }
60 
61  SDK_IMPLEMENT_IID(ISDKNamedProperties)
62  SDK_END_INTERFACE(ISDKNamedProperties)
63 };
64 SDK_DECLARE_IID(ISDKNamedProperties)
65 
66 } // namespace sdk
67 
68 #endif // SDK_BASE_NAMED_PROPERTIES_INTERFACE_H_
sdk_results.h
A list of SDK error/return results.
base_types.h
SDK base types.
sdk_ref_ptr.h
Interfaces wrapper with reference count control.
kSDKResult_Succeeded
static const SDKResult kSDKResult_Succeeded
Operation completed successfully.
Definition: sdk_results.h:22
sdk::ISDKNamedProperties::SetProperty
virtual SDKResult SDK_CALLTYPE SetProperty(const SDKString &id, const SDKAny &value)=0
Sets a property value.
SDKResult
SDKInt32 SDKResult
Type of all error or return codes which SDK functions can end with.
Definition: sdk_results.h:17
sdk::SDKStringHandler
This class wraps the SDKString type.
Definition: sdk_string_handler.h:100
sdk::ISDKNamedProperties::GetProperty
virtual SDKResult SDK_CALLTYPE GetProperty(const SDKString &id, SDKAny &value) const =0
Retrieves a property value.
sdk::ISDKNamedProperties
Provides access to members that control the named properties.
Definition: named_properties_interface.h:29
SDK_FAILED
#define SDK_FAILED(res)
Checks failed result.
Definition: sdk_results_enum.h:69
ISDKComponent
Base interface for all SDK interfaces.
Definition: sdk_component_interface.h:41
sdk::SDKAnyHandler
This class wraps the SDKAny type.
Definition: sdk_any_handler.h:32
kSDKResult_InvalidArgument
static const SDKResult kSDKResult_InvalidArgument
Wrong argument passed to function.
Definition: sdk_results.h:55
kSDKResult_NULLPointer
static const SDKResult kSDKResult_NULLPointer
NULL pointer passed to function.
Definition: sdk_results.h:58
FWD_DECL_INTERFACE
FWD_DECL_INTERFACE(ILWEParserWrapper)
Provides a wrapper around the message parser to get, add or remove the.
sdk_any_handler.h
Wrappers for work with SDKAny instance.