1 #pragma once 2 3 #include <wayfire/nonstd/optional.hpp> 4 #include <string> 5 6 namespace wf 7 { 8 namespace option_type 9 { 10 /** 11 * To create an option of a given type, from_string must be specialized for 12 * parsing the type. 13 * 14 * @param string The string representation of the value. 15 * @return The parsed value, if the string was valid. 16 */ 17 template<class Type> 18 stdx::optional<Type> from_string( 19 const std::string& string); 20 21 /** 22 * To create an option of a given type, to_string must be specialized for 23 * converting the type to string. 24 * @return The string representation of a value. 25 * It is expected that from_string(to_string(value)) == value. 26 */ 27 template<class Type> 28 std::string to_string(const Type& value); 29 } 30 } 31