37#include <Ice/Handle.h>
55 template <
class T,
class =
void>
60 template <
class T,
class =
void>
65 template <
class T,
class =
void>
70 template <
class T,
class =
void>
75 template <
class T,
class =
void>
118 template <
typename PropertyType>
179 std::enable_if_t<std::is_same_v<T, PropertyType> && !std::is_same_v<T, std::string>,
181 map(
const std::map<T, std::string>& values);
184 std::enable_if_t<meta::properties::MapPropertyValuePlugin<T>::value,
246 template <
class T = PropertyType>
262 template <
class T = PropertyType>
287 static void removeQuotes(
const std::string& input, std::string& output);
293 const std::string& value)
override;
323 std::optional<std::function<void(
const PropertyType&)>>
setter;
374 PropertyType getValueRequired(
const std::string& prefix,
Ice::PropertiesPtr iceProperties);
380 PropertyType getValueOptional(
const std::string& prefix,
Ice::PropertiesPtr iceProperties);
390 std::string getPropertyValue(
const std::string& prefix,
398 std::string getRawPropertyValue(
const std::string& prefix,
417 bool matchRegex(
const std::string& value)
const;
420 template <
typename T>
421 T processMappedValue(
const T& value);
424 std::string processMappedValue(
const std::string& value);
434 void checkLimits(
const std::string& prefix, PropertyType numericValue)
const;
448 template <
typename T>
PropertyConstness constness
PropertyDefinitionBase(bool required=true, PropertyConstness constness=eConstant)
PropertyDefinition defines a property that will be available within the PropertyUser.
virtual void writeValueToSetter(const std::string &prefix, Ice::PropertiesPtr) override
PropertyDefinition< PropertyType > & setMin(std::array< T, 1 > min)
PropertyFactoryFunction getFactory() const
PropertyDefinition< PropertyType > & setExpandEnvironmentVariables(bool expand)
Sets whether for string values environment varbiale expanding should be considered.
PropertyValuesMap & getValueMap()
PropertyDefinition< PropertyType > & setCaseInsensitive(bool isCaseInsensitive)
Sets whether the property value matching is case insensitive.
bool isCaseInsensitive() const
std::optional< std::function< void(const PropertyType &)> > setter
PropertyDefinition< PropertyType > & map(const std::string &valueString, PropertyType value)
Maps a string value onto a value of the specified template type.
PropertyDefinition< PropertyType > & setMin(double min)
Sets the min allowed numeric value.
std::pair< std::string, PropertyType > ValueEntry
PropertyDefinition< PropertyType > & setRemoveQuotes(bool removeQuotes)
Sets whether for string values leading and trailing quotes should be removed.
std::string toString(PropertyDefinitionFormatter &formatter, const std::string &value) override
std::function< PropertyType(std::string)> PropertyFactoryFunction
PropertyDefinition< PropertyType > & setMax(std::array< T, 1 > max)
PropertyDefinition< PropertyType > & map(const std::map< std::string, PropertyType > &values)
std::map< std::string, ValueEntry > PropertyValuesMap
PropertyType getDefaultValue()
std::string getDefaultAsString() override
PropertyDefinition< PropertyType > & setFactory(const PropertyFactoryFunction &func)
Sets the factory function that creates the specified template type from the actual string value.
PropertyFactoryFunction factory
bool removeQuotes() const
PropertyValuesMap propertyValuesMap
std::enable_if_t< std::is_same_v< T, PropertyType > &&!std::is_same_v< T, std::string >, PropertyDefinition< T > & > map(const std::map< T, std::string > &values)
PropertyDefinition< PropertyType > & setMax(double max)
Sets the max allowed numeric value.
PropertyDefinition(std::function< void(const PropertyType &)> setter, const std::string &propertyName, PropertyType defaultValue, const std::string &description, PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
PropertyType defaultValue
std::string getPropertyName() const
PropertyDefinition(PropertyType *setterRef, const std::string &propertyName, PropertyType defaultValue, const std::string &description, PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
Constructs a property definition of an optional property.
PropertyType getValue(const std::string &prefix, Ice::PropertiesPtr)
std::enable_if_t< meta::properties::MapPropertyValuePlugin< T >::value, PropertyDefinition< PropertyType > & > map(const T &values)
std::string getDescription() const
static void removeQuotes(const std::string &input, std::string &output)
Checks first and last character of input and in case both are quotes, they are removed and the remain...
bool expandEnvironmentVariables() const
PropertyDefinition(PropertyType *setterRef, const std::string &propertyName, const std::string &description, PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
Constructs a property definition of a required property.
std::shared_ptr< PropertyType > PropertyTypePtr
std::string getMatchRegex() const
bool isSet(const std::string &prefix, Ice::PropertiesPtr iceProperties) const
PropertyDefinition< PropertyType > & setMatchRegex(const std::string &expr)
Sets the regular expression which the value has to be matched with.
::IceInternal::Handle<::Ice::Properties > PropertiesPtr
This file offers overloads of toIce() and fromIce() functions for STL container types.
float PropertyDefinition_lexicalCastTo< float >(std::string const &input)
long PropertyDefinition_lexicalCastTo< long >(std::string const &input)
std::string PropertyDefinition_lexicalCastToString(float input)
unsigned long PropertyDefinition_lexicalCastTo< unsigned long >(std::string const &input)
int PropertyDefinition_lexicalCastTo< int >(std::string const &input)
double PropertyDefinition_lexicalCastTo< double >(std::string const &input)
T PropertyDefinition_lexicalCastTo(std::string const &input)
unsigned char PropertyDefinition_lexicalCastTo< unsigned char >(std::string const &input)
char PropertyDefinition_lexicalCastTo< char >(std::string const &input)
unsigned int PropertyDefinition_lexicalCastTo< unsigned int >(std::string const &input)
bool PropertyDefinition_lexicalCastTo< bool >(std::string const &input)