23tResult visit_property(
const ant::IProperties& oProperties,
24 const char* strPropertyName,
25 const std::function<
tResult(
const IProperty& oProperty)>& fnCallback);
27tResult visit_property_by_path(
const ant::IProperties& oProperties,
28 const char* strPropertyPathAndName,
29 const std::function<
tResult(
const IProperty& oProperty)>& fnCallback);
49template<
typename VALUETYPE>
91 RETURN_IF_FAILED(get_property_value(*oProperty.GetValue(), oFoundValue));
112template<
typename VALUETYPE>
137template <
typename VALUETYPE>
138tResult set_property_by_path(
IProperties& oProperties,
const char* strPathAndName, VALUETYPE oValue)
140 util::cString strHelper(strPathAndName);
141 size_t nLastSlashPosition = strHelper.RFind(
'/');
142 if (nLastSlashPosition == util::cString::InvalidPos)
147 util::cString strParent = strHelper.Mid(0, nLastSlashPosition);
148 return oProperties.SetPropertyByPath(strParent, property<VALUETYPE>(strHelper.Mid(nLastSlashPosition + 1), oValue));
152T get_property_by_path(
const IProperties& oProperties,
const char* strPathAndName,
const T& oDefaultValue)
156 if (
IS_FAILED(spider::visit_property_by_path(oProperties, strPathAndName, [&](
const IProperty& oProperty) ->
tResult
158 RETURN_IF_FAILED(get_property_value(*oProperty.GetValue(), oFoundValue));
162 return oDefaultValue;
168template <
typename VALUETYPE>
169VALUETYPE get_property_by_path(
const IProperties& oProperties,
const char* strPathAndName)
171 return get_property_by_path(oProperties, strPathAndName, VALUETYPE());
203template <
typename PropertyType>
204void call_callback(
const ant::IProperty& oProperty,
const std::function<
void(
const char*, PropertyType)>& fnCallback)
208 fnCallback(strName.
Get(), get_property_value<std::decay_t<PropertyType>>(*oProperty.GetValue()));
215using tPropertyVisitorCallback = std::function<void(
const ant::IProperty& oProperty)>;
223 tPropertyVisitorCallback fnCallback);
231template <
typename SubPropertyType>
233 std::function<
void(
const char*, SubPropertyType)> fnCallback)
235 visit_properties(oProperties, std::bind(detail::call_callback<SubPropertyType>, std::placeholders::_1, fnCallback));
244 tPropertyVisitorCallback fnCallback);
252template <
typename SubPropertyType>
254 std::function<
void(
const char*, SubPropertyType)> fnCallback)
256 visit_sub_properties(oProperty, std::bind(detail::call_callback<SubPropertyType>, std::placeholders::_1, fnCallback));
266 const char* strPropertyName,
267 tPropertyVisitorCallback fnCallback);
276template <
typename SubPropertyType>
278 const char* strPropertyName,
279 std::function<
void(
const char*, SubPropertyType)> fnCallback)
283 std::bind(detail::call_callback<SubPropertyType>, std::placeholders::_1, fnCallback));
291using lucky::tPropertyVisitorCallback;
299 const tPropertyVisitorCallback& fnCallback);
307template <
typename SubPropertyType>
309 const std::function<
void(
const char*, SubPropertyType)>& fnCallback)
311 visit_properties(oProperties, std::bind(lucky::detail::call_callback<SubPropertyType>, std::placeholders::_1, fnCallback));
320 const tPropertyVisitorCallback& fnCallback);
328template <
typename SubPropertyType>
330 const std::function<
void(
const char*, SubPropertyType)>& fnCallback)
332 visit_sub_properties(oProperty, std::bind(lucky::detail::call_callback<SubPropertyType>, std::placeholders::_1, fnCallback));
342 const char* strPropertyName,
343 const tPropertyVisitorCallback& fnCallback);
352template <
typename SubPropertyType>
354 const char* strPropertyName,
355 const std::function<
void(
const char*, SubPropertyType)>& fnCallback)
359 std::bind(lucky::detail::call_callback<SubPropertyType>, std::placeholders::_1, fnCallback));
367using catwo::set_property_by_path;
368using catwo::get_property_by_path;
374using spider::visit_property;
375using spider::visit_property_by_path;
#define IS_FAILED(s)
Check if result is failed.
Definition result.h:20
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
Definition result.h:736
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
Definition result.h:29
Definition property_intf.h:213
Definition property_intf.h:119
Definition string_intf.h:29
virtual const char * Get() const =0
Definition string_intf.h:398
Definition properties_v2.h:283
Namespace for all functionality of the ADTF Base SDK provided since v3.0.
Definition adtf_class_version.h:16
VALUETYPE get_property(const IConfiguration &oConfiguration, const char *strNameOfValue, VALUETYPE oDefaultValue)
Get the property content converted to the VALUETYPE.
Definition configuration.h:291
tResult set_property(IConfiguration &oConfiguration, const char *strNameOfValue, VALUETYPE oValue)
Set the property.
Definition configuration.h:327
Namespace for all functionality of the ADTF Base SDK provided since v3.4.
Definition error_handling_intf.h:15
tResult create_property_tree(ant::IProperties &oProperties, const char *strPath)
std::pair< std::string, std::string > split_parents_and_leaf(const char *strPropertyPathAndName)
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 all functionality of the ADTF Base SDK provided since v3.18.
Definition properties_v2.h:24
void visit_properties(const ant::IProperties &oProperties, const tPropertyVisitorCallback &fnCallback)
void visit_sub_properties(const ant::IProperty &oProperty, const tPropertyVisitorCallback &fnCallback)
Namespace for the ADTF Base SDK.
Definition adtf_base_type_traits.h:13
Namespace for all functionality provided by ADTF and its SDKs.
Definition adtf_client_connector.h:14
void visit_sub_properties(const ant::IProperty &oProperty, tPropertyVisitorCallback fnCallback)
void visit_properties(const ant::IProperties &oProperties, tPropertyVisitorCallback fnCallback)