12         if (&source != 
this) {
    16             for (
const auto &value : source.values_) {
    18                 case option_type::boolean_e: copy_option<boolean_ini_t>(value); 
break;
    19                 case option_type::enum_e: copy_option<enum_ini_t>(value); 
break;
    20                 case option_type::float_e: copy_option<float_ini_t>(value); 
break;
    21                 case option_type::signed_e: copy_option<signed_ini_t>(value); 
break;
    22                 case option_type::string_e: copy_option<string_ini_t>(value); 
break;
    23                 case option_type::unsigned_e: copy_option<unsigned_ini_t>(value); 
break;
    24                 case option_type::invalid_e:
    30             option_schema_ = source.option_schema_;
    39         values_ = std::move(source.values_);
    40         option_schema_ = std::move(source.option_schema_);
    45         if (&source != 
this) {
    48             values_ = std::move(source.values_);
    49             option_schema_ = std::move(source.option_schema_);
    54     option::option(
const std::string &name, 
const std::string &value) : name_(name), type_(option_type::string_e)
    56         add_to_list<string_ini_t>(value);
    59     option::option(
const std::string &name, 
const std::vector<std::string> &values)
    60         : name_(name), type_(option_type::string_e)
    62         for (
const auto &input_value : values) {
    63             add_to_list<string_ini_t>(input_value);
    79         if (position >= values_.size()) {
    82         values_.erase(values_.begin() + position);
    92         if (name_ != other.name_ || type_ != other.type_) {
    96         if (values_.size() != other.values_.size()) {
    99             for (
size_t i = 0; i < values_.size(); ++i) {
   101                 case option_type::boolean_e:
   102                     if (!compare_option<boolean_ini_t>(values_[i], other.values_[i])) {
   106                 case option_type::enum_e:
   107                     if (!compare_option<enum_ini_t>(values_[i], other.values_[i])) {
   111                 case option_type::float_e:
   112                     if (!compare_option<float_ini_t>(values_[i], other.values_[i])) {
   116                 case option_type::signed_e:
   117                     if (!compare_option<signed_ini_t>(values_[i], other.values_[i])) {
   121                 case option_type::string_e:
   122                     if (!compare_option<string_ini_t>(values_[i], other.values_[i])) {
   126                 case option_type::unsigned_e:
   127                     if (!compare_option<unsigned_ini_t>(values_[i], other.values_[i])) {
   140         return !(*
this == other);
   145         return values_.size() > 1;
   151         type_ = option_type::boolean_e;
   152         add_to_list<boolean_ini_t>(arg);
   159         type_ = option_type::signed_e;
   160         add_to_list<signed_ini_t>(arg);
   167         type_ = option_type::unsigned_e;
   168         add_to_list<unsigned_ini_t>(arg);
   175         type_ = option_type::float_e;
   176         add_to_list<float_ini_t>(arg);
   183         type_ = option_type::string_e;
   184         add_to_list<string_ini_t>(arg);
   191         type_ = option_type::string_e;
   192         add_to_list<string_ini_t>(arg);
   199         type_ = option_type::enum_e;
   200         add_to_list<enum_ini_t>(arg);
   207     std::string escape_option_value(
const std::string &str)
   209         std::string result(str);
   210         if (str.length() > 0 && std::isspace(result[0])) {
   211             result.insert(result.begin(), 
'\\');
   213         if (str.length() > 1 && std::isspace(result[result.length() - 1])) {
   214             result.insert(result.end() - 1, 
'\\');
   220     void write_boolean_option(std::vector<boolean_ini_t> values, std::ostream &os)
   227         for (
auto it = values.begin() + 1; it != values.end(); ++it) {
   236     void write_enum_option(std::vector<enum_ini_t> values, std::ostream &os)
   238         os << escape_option_value(static_cast<std::string>(values[0]));
   239         for (
auto it = values.begin() + 1; it != values.end(); ++it) {
   240             os << 
"," << escape_option_value(static_cast<std::string>(*it));
   243     void write_float_option(std::vector<float_ini_t> values, std::ostream &os)
   246         for (
auto it = values.begin() + 1; it != values.end(); ++it) {
   250     void write_signed_option(std::vector<signed_ini_t> values, std::ostream &os)
   253         for (
auto it = values.begin() + 1; it != values.end(); ++it) {
   257     void write_unsigned_option(std::vector<unsigned_ini_t> values, std::ostream &os)
   260         for (
auto it = values.begin() + 1; it != values.end(); ++it) {
   264     void write_string_option(std::vector<string_ini_t> values, std::ostream &os)
   266         os << escape_option_value(values[0]);
   267         for (
auto it = values.begin() + 1; it != values.end(); ++it) {
   268             os << 
"," << escape_option_value(*it);
   274         os << opt.name_ << 
" = ";
   276         case option_type::boolean_e: write_boolean_option(opt.
get_list<boolean_ini_t>(), os); 
break;
   278         case option_type::float_e: write_float_option(opt.
get_list<float_ini_t>(), os); 
break;
   279         case option_type::signed_e: write_signed_option(opt.
get_list<signed_ini_t>(), os); 
break;
   280         case option_type::string_e: write_string_option(opt.
get_list<string_ini_t>(), os); 
break;
   281         case option_type::unsigned_e: write_unsigned_option(opt.
get_list<unsigned_ini_t>(), os); 
break;
   282         case option_type::invalid_e:
 
INICPP_API friend std::ostream & operator<<(std::ostream &os, const option &opt)
 
bool operator!=(const option &other) const 
 
void validate(const option_schema &opt_schema)
 
void validate_option(option &opt) const 
 
option & operator=(const option &source)
 
const std::string & get_name() const 
 
std::vector< ReturnType > get_list() const 
 
bool operator==(const option &other) const 
 
option_type get_type() const 
 
void remove_from_list_pos(size_t position)