310 | | options.values.reset(); |
311 | | Array<string> true_options; |
312 | | UI::get( true_options, element ); |
313 | | for( int i = 0; i < true_options.length(); i++ ) |
314 | | for( int j = 0; j < options.names().length(); j++ ){ |
315 | | if( true_options(i) == options.names()(j) ) |
| 310 | string raw_log_level; |
| 311 | UI::get( raw_log_level, element ); |
| 312 | Array<string> loaded_log_level = log_level_template<T>::string2Array( raw_log_level ); |
| 313 | |
| 314 | log_level.values.reset(); |
| 315 | |
| 316 | for( int i = 0; i < loaded_log_level.length(); i++ ) |
| 317 | for( int j = 0; j < log_level.names().length(); j++ ){ |
| 318 | if( loaded_log_level(i) == log_level.names()(j) ) |
605 | | // from Setting. Here, we rather add our options into this existig element. This way, it is |
606 | | // possible that more instances of logged_options class (all contained in one wrapping instance of |
607 | | // a particular class!) can be stored in only one line in a configuration file |
608 | | template< class T> static void save ( const logged_options<T> &options, Setting &element, const string &name = "options" ) { |
| 608 | // from Setting. We rather fill the current log_level into this existig element. This way, it is |
| 609 | // possible that more instances of log_level_template class (templated with different classes) |
| 610 | // can be stored in only one line in a configuration file |
| 611 | template< class T> static void save ( const log_level_template<T> &log_level, Setting &element, const string &name = "log_level" ) { |
618 | | list = &element.add ( name, Setting::TypeList ); |
619 | | |
620 | | Array<string> true_options; |
621 | | int true_options_count = 0; |
622 | | true_options.set_length( options.values.size() ); |
623 | | for( unsigned int i = 0; i < options.values.size(); i++ ) |
624 | | if( options.values[i] ) |
625 | | true_options( true_options_count++ ) = options.names()(i); |
626 | | save( true_options, *list, name ); |
| 624 | list = &element.add ( name, Setting::TypeString ); |
| 625 | |
| 626 | for( unsigned int i = 0; i < log_level.values.size(); i++ ) |
| 627 | if( log_level.values[i] ) // a jeste zkontrolovat zda to jmeno uz neni obsazeno? |
| 628 | { |
| 629 | if( string_to_write.length() > 0 ) |
| 630 | string_to_write = string_to_write + ','; |
| 631 | string_to_write = string_to_write + log_level.names()(i); |
| 632 | } |
| 633 | |
| 634 | *list = string_to_write; |