31 constexpr
static const tChar*
const TYPE_NAME =
"attached_config";
40 typedef ::adtf::base::ant::property_attached_configuration_type
value_type;
42 typedef ::adtf::base::ant::property<::adtf::base::ant::property_attached_configuration_type>
base_type;
56 class cPropertyVariable;
131 const T& operator*()
const
133 return base_type::GetValue();
136 operator const T&()
const
138 return base_type::GetValue();
141 bool operator==(
const T& oVal)
143 return base_type::GetValue() == oVal;
146 bool operator!=(
const T& oVal)
148 return base_type::GetValue() != oVal;
186 tResult Set(
const IProperty& )
override
197 template <
typename Interface = IConfiguration>
208 m_pProperties = adtf::ucom::make_object_ptr < cProperties >();
220 pProperties.
Reset(pConstProps);
230 pProperties.
Reset(pProps);
234 tResult AttachConfiguration(
const char* strName,
245 tResult DetachConfiguration(
const char* strName)
override
251 tResult RegisterPropertyVariable(
const char* strName,
252 cPropertyVariable& oPropertyVariable);
254 tResult UnregisterPropertyVariable(cPropertyVariable& oPropertyVariable)
256 return m_pProperties->UnregisterPropertyObserver(oPropertyVariable);
269 template<
typename VALUETYPE>
275 return get_property<VALUETYPE>(*pProperties, strNameOfValue, oDefaultValue);
279 return oDefaultValue;
290 template<
typename VALUETYPE>
293 return get_property<VALUETYPE>(oConfiguration, strNameOfValue, VALUETYPE());
305 template<
typename VALUETYPE>
310 return set_property<VALUETYPE>(*pProperties, strNameOfValue, oValue);
325 return set_property<adtf_util::cString>(*pProperties, strNameOfValue,
adtf_util::cString(poValue));
334 template <
typename VALUETYPE>
335 tResult set_property_by_path(IConfiguration& oConfiguration,
const char* strPathAndName, VALUETYPE oValue)
339 return set_property_by_path<VALUETYPE>(*pProperties, strPathAndName, oValue);
342 template <
typename VALUETYPE>
343 VALUETYPE get_property_by_path(
const IConfiguration& oConfiguration,
const char* strPathAndName, VALUETYPE oDefaultValue)
346 if (
IS_FAILED(oConfiguration.GetProperties(pProperties)))
348 return oDefaultValue;
350 return get_property_by_path<VALUETYPE>(*pProperties, strPathAndName, oDefaultValue);
353 template <
typename VALUETYPE>
354 VALUETYPE get_property_by_path(
const IConfiguration& oConfiguration,
const char* strPathAndName)
356 return get_property_by_path(oConfiguration, strPathAndName, VALUETYPE());
395 class cImplementation;
396 std::unique_ptr<cImplementation> m_pImplementation;
409 const T* operator->()
411 return &
static_cast<const T&
>(*this);
425 static constexpr
const tChar*
const strReservedPrefix =
"#__";
426 static constexpr
const tChar*
const strDisplayName =
"#__display_name";
427 static constexpr
const tChar*
const strDescription =
"#__description";
428 static constexpr
const tChar*
const strRangeMin =
"#__range_min";
429 static constexpr
const tChar*
const strRangeMax =
"#__range_max";
430 static constexpr
const tChar*
const strValueListCount =
"#__value_list_count";
431 static constexpr
const tChar*
const strValueListValueFormat =
"#__value_list_value_%u";
432 static constexpr
const tChar*
const strValueListNameFormat =
"#__value_list_name_%u";
433 static constexpr
const tChar*
const strValueListRestricted =
"#__value_list_restricted";
434 static constexpr
const tChar*
const strEditorListCount =
"#__editor_list_count";
435 static constexpr
const tChar*
const strEditorListNameFormat =
"#__editor_list_name_%u";
436 static constexpr
const tChar*
const strEditorListUrlFormat =
"#__editor_list_url_%u";
437 static constexpr
const tChar*
const strServiceDefaultRunlevel =
"#__service_default_runlevel";
438 static constexpr
const tChar*
const strFilenameExtensionFilter =
"#__filename_extension_filter";
439 static constexpr
const tChar*
const strFilenameOpenForWriting =
"#__filename_open_for_writing";
440 static constexpr
const tChar*
const strHelpLink =
"#__help_link";
441 static constexpr
const tChar*
const strItemDescriptions =
"#__item_descriptions";
442 static constexpr
const tChar*
const strResolveMacros =
"#__resolve_macros";
445 template <
typename U,
typename Enable =
void>
452 static const type& assign(
const type& value)
458 template <
typename U>
461 typedef typename std::underlying_type<U>::type type;
462 static type assign(
const U& value)
464 return static_cast<type
>(value);
468 template <
typename T,
typename ValueType>
470 const std::vector<std::pair<ValueType, std::string>>& oValueList,
471 bool bRestrictToValues =
true)
473 set_property<unsigned int>(oSubProperties,
474 detail::tReservedProperties::strValueListCount,
475 static_cast<unsigned int>(oValueList.size()));
476 set_property<bool>(oSubProperties,
477 detail::tReservedProperties::strValueListRestricted,
481 for (
const auto& oValue: oValueList)
483 set_property<T>(oSubProperties,
484 util::cString::Format(detail::tReservedProperties::strValueListValueFormat, nIndex),
486 set_property<util::cString>(oSubProperties,
487 util::cString::Format(detail::tReservedProperties::strValueListNameFormat, nIndex),
488 oValue.second.c_str());
493 template <
typename T>
494 void set_valid_range(
IProperties& oSubProperties,
const T& xMin,
const T& xMax)
496 set_property<T>(oSubProperties,
497 detail::tReservedProperties::strRangeMin,
499 set_property<T>(oSubProperties,
500 detail::tReservedProperties::strRangeMax,
592 class cImplementation;
593 std::unique_ptr<cImplementation> m_pImplementation;
599 template <
typename T>
616 m_oValue(giant::detail::storage_type<T>::assign(xValue))
628 m_oValue.
Set(*oProperty.GetValue());
633 return m_oValue.
GetType(std::forward<IString>(strType));
641 const T& operator*()
const
643 return GetReference();
646 operator const T&()
const
648 return GetReference();
651 bool operator==(
const T& oVal)
653 return GetReference() == oVal;
656 bool operator!=(
const T& oVal)
658 return GetReference() != oVal;
661 const T* operator->()
663 return &GetReference();
666 const T* operator->()
const
668 return &GetReference();
676 void SetValueList(
const std::vector<std::pair<T, std::string>>& oValueList,
677 bool bRestrictToValues =
true)
679 detail::set_value_list<property_type>(
GetSubProperties(), oValueList, bRestrictToValues);
698 const T& GetReference()
const
700 return reinterpret_cast<const T&
>(m_oValue.GetValue());
709 template<
typename Interface>
710 tResult configuration<Interface>::RegisterPropertyVariable(
const char* strName, cPropertyVariable& oPropertyVariable)
713 detail::cPropertyVariableHelper oHelper(oParentsAndName.second.c_str(), *oPropertyVariable.GetValue());
717 const auto& oGiantPropertyVariable =
dynamic_cast<const giant::cPropertyVariable&
>(oPropertyVariable);
718 RETURN_IF_FAILED(oHelper.SetProperties(oGiantPropertyVariable.GetSubProperties()));
725 RETURN_IF_FAILED(m_pProperties->SetPropertyByPath(oParentsAndName.first.c_str(), oHelper));
726 RETURN_IF_FAILED(m_pProperties->RegisterPropertyObserver(strName, oPropertyVariable));
727 oPropertyVariable.SetUnregister(*
this);
745 const char* strPropertyPathAndName,
752 template <
typename T>
772 m_fnPropertyChangedCallback = fnCallback;
779 if (m_fnPropertyChangedCallback)
781 m_fnPropertyChangedCallback();
786 std::function<void()> m_fnPropertyChangedCallback;
794 using ant::configuration;
795 using hollow::property_variable;
796 using ant::property_attached_configuration_type;
798 using catwo::set_property_by_path;
799 using catwo::get_property_by_path;
801 using flash::cConfiguration;
A common result class usable as return value throughout.
ucom Interface to a objects configuration.
virtual tResult GetProperties(ucom::ant::iobject_ptr< const IProperties > &pProperties) const =0
Gets the properties with read access.
Defintion of a property set container interface.
The IProperty interface provides methods for getting and setting property values, name of the propert...
Observer Interface to react on property changes.
The IPropertyValue interface provides methods for getting and setting property values.
The IString interface provides methods for getting and setting strings through abstract interfaces.
tResult AttachProperties(const ucom::ant::iobject_ptr< IProperties > &pAttachedProperties) override
will set given properties to be attached
Default implemementation of a property_variable.
virtual const IPropertyValue * GetValue() const =0
virtual tResult GetType(IString &&strType) const =0
Returns the identifier of the type.
Implementation helper template to enriches an implementation with the default implementation of IConf...
adtf::ucom::object_ptr< cProperties > m_pProperties
the current runtiem property set
virtual ~configuration()=default
DTOR.
tResult GetProperties(adtf::ucom::ant::iobject_ptr< const IProperties > &pProperties) const override
Gets the configuration with only read access.
tResult GetProperties(adtf::ucom::ant::iobject_ptr< IProperties > &pProperties) override
Gets the properties of configuration with only read/write access.
Internal class helper to wrap e property variable for the SetProperty call without copy.
cPropertyVariableHelper(const adtf_util::cString &strName, const IPropertyValue &oValue)
CTOR initializer.
cRefConfigProperty(const adtf_util::cString &strConfigurationName, ucom::ant::iobject_ptr< IProperties > &pPropertiesAttach)
initializer CTOR
::adtf::base::ant::property<::adtf::base::ant::property_attached_configuration_type > base_type
internal base type
::adtf::base::ant::property_attached_configuration_type value_type
internal value type
tResult Set(const IPropertyValue &oValue)
Sets the value by a deep copy.
tResult GetType(IString &&strType) const
Retrieves the string for the property value type.
Property Variable template for the given T.
void Notify(const IProperty &oProperty) override
Implements the observer pattern.
tResult GetType(IString &&strType) const override
Returns the identifier of the type.
property_variable(const T &oValue)
type initializing CTOR
const IPropertyValue * GetValue() const override
Property property implementation template.
Implements all functionality required by ant::IConfiguration.
cConfiguration()
Default constructor.
tResult GetProperties(adtf::ucom::ant::iobject_ptr< IProperties > &pProperties)
Gets the properties with read access.
tResult AttachConfiguration(const char *strName, IConfiguration &oAttachedConfiguration)
Attaches the given configuration and its properties as property tree item of this.
tResult DetachConfiguration(const char *strName)
Detaches a configuration with the specified name.
tResult GetProperties(adtf::ucom::ant::iobject_ptr< const IProperties > &pProperties) const
Gets the properties with read access.
tResult RegisterPropertyVariable(const char *strName, ant::cPropertyVariable &oPropertyVariable)
Registers a property variable that always reflects the current value of the property.
virtual ~cConfiguration()
Destructor.
Property Variable template for the given T.
Base class for property_variable.
cPropertyVariable()
The default constructor.
void SetDescription(const char *strDescription)
Sets the description text associated with the Property.
~cPropertyVariable() override
Destructor.
ant::IProperties & GetSubProperties()
void SetFilenameOpenForWriting(bool bWriteMode)
Sets the write mode for the file property.
tVoid SetResolveMacros(tBool bResolveMacros)
Sets whether or not macros should be resolved by the session manager or not.
cPropertyVariable(const cPropertyVariable &oOther)
Copy constructor.
void SetDisplayName(const char *strDisplayName)
Sets the name that tools should display.
cPropertyVariable & operator=(cPropertyVariable &&oOther)
Move assignment operator.
cPropertyVariable & operator=(const cPropertyVariable &oOther)
Assignment operator.
void SetFilenameExtensionFilter(const char *strFilenameExtensionFilter)
Sets optional file filters for Configuration Editor FileDialogs of cFilename and cFilenameList proper...
cPropertyVariable(cPropertyVariable &&oOther)
Move constructor.
const ant::IProperties & GetSubProperties() const
Property Variable template for the given T.
property_variable(const T &xValue)
Initializes the property variable with the given value.
void Notify(const IProperty &oProperty) override
Implements the observer pattern.
property_variable()=default
Initializes the property variable with the default value of T.
tResult GetType(IString &&strType) const override
Returns the identifier of the type.
void SetValidRange(const T &xMin, const T &xMax)
Sets the valid range of values.
const IPropertyValue * GetValue() const override
void SetValueList(const std::vector< std::pair< T, std::string >> &oValueList, bool bRestrictToValues=true)
Sets a value list, that the user can choose from.
Property Variable template for the given T.
void Notify(const IProperty &oProperty) override
Implements the observer pattern.
void SetPropertyChangedCallback(const std::function< void()> &fnCallback)
Set a callback to get notified about property changes.
property_variable & operator=(const T &oVal)
Assignment operator.
virtual tResult Reset(const iobject_ptr< T > &i_oOther)=0
Reset this object_ptr<> with the content of another iobject_ptr<>
Base object pointer to realize binary compatible reference counting in interface methods.
Object pointer implementation used for reference counting on objects of type IObject.
Use this template if you want to implement an ucom::ant::IObject based Interface and/or subclass an e...
Copyright © Audi Electronics Venture GmbH.
string_base< cStackString > cString
cString implementation for a stack string which works on stack if string is lower than A_UTILS_DEFAUL...
VALUETYPE get_property(const IConfiguration &oConfiguration, const char *strNameOfValue, VALUETYPE oDefaultValue)
Get the property content converted to the VALUETYPE.
tResult set_property(IConfiguration &oConfiguration, const char *strNameOfValue, VALUETYPE oValue)
Set the property.
tResult create_property_tree(ant::IProperties &oProperties, const char *strPath)
Creates a property tree structure.
std::pair< std::string, std::string > split_parents_and_leaf(const char *strPropertyPathAndName)
Splits a property path into the parent path and the property name.
tResult get_property_object_by_path(const ant::IConfiguration &oConfiguration, const char *strPropertyPathAndName, ant::IProperty &oProperty)
Retrieves a property reference under the given oConfiguration by path.
Namespace for entire ADTF SDK.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
#define IS_FAILED(s)
Check if result is failed.
#define RETURN_IF_FAILED(s)
Return if expression is failed, which requires the calling function's return type to be tResult.
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
#define RETURN_ERROR(code)
Return specific error code, which requires the calling function's return type to be tResult.
#define IS_OK(s)
Check if result is OK.
char tChar
The tChar defines the type for platform character set (platform and compiler dependent type).
void tVoid
The tVoid is always the definition for the void (non-type).
bool tBool
The tBool defines the type for the Values tTrue and tFalse (platform and compiler dependent).
Concept template to define the Name and the conversion type for the given type TYPE.