- Timestamp:
- 04/17/12 17:56:20 (13 months ago)
- Branches:
- master, 0.4.0, 0.4.1, 0.4.2
- Children:
- 308ae18
- Parents:
- 682ccd2
- Location:
- include
- Files:
-
- 4 edited
-
nsclient/base_logger_impl.hpp (modified) (2 diffs)
-
settings/client/settings_client.hpp (modified) (5 diffs)
-
settings/settings_handler_impl.hpp (modified) (1 diff)
-
settings/settings_interface_impl.hpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
include/nsclient/base_logger_impl.hpp
r440c0cb r6533c1a 16 16 NSCAPI::log_level::level level_; 17 17 bool console_log_; 18 bool is_running_; 18 19 public: 19 logging_interface_impl() : level_(NSCAPI::log_level::info), console_log_(false) {} 20 logging_interface_impl() : level_(NSCAPI::log_level::info), console_log_(false), is_running_(false) {} 21 virtual ~logging_interface_impl() {} 20 22 21 23 … … 66 68 virtual void do_log(const std::string &data) = 0; 67 69 virtual void configure() = 0; 68 virtual bool shutdown() = 0; 69 virtual bool startup() = 0; 70 virtual bool shutdown() { 71 is_running_ = false; 72 return true; 73 } 74 virtual bool startup() { 75 is_running_ = true; 76 return true; 77 } 78 79 bool is_started() const { 80 return is_running_; 81 } 82 70 83 }; 71 84 typedef boost::shared_ptr<nsclient::logging::logging_interface_impl> log_impl_type; -
include/settings/client/settings_client.hpp
r83c2453 r6533c1a 65 65 std::wstring data = core_->get_string(path, key, dummy); 66 66 if (typed_key<T>::has_default_ || data != dummy) { 67 T value = boost::lexical_cast<T>(data); 68 update_target(&value); 67 try { 68 T value = boost::lexical_cast<T>(data); 69 update_target(&value); 70 } catch (const std::exception &e) { 71 core_->err(__FILE__, __LINE__, _T("Failed to parse key: ") + path + _T("/") + key + _T(": ") + utf8::to_unicode(e.what())); 72 } 69 73 } 70 74 } … … 78 82 data = core_->get_string(path, key, dummy); 79 83 if (typed_key<T>::has_default_ || data != dummy) { 80 T value = boost::lexical_cast<T>(data); 81 update_target(&value); 84 try { 85 T value = boost::lexical_cast<T>(data); 86 update_target(&value); 87 } catch (const std::exception &e) { 88 core_->err(__FILE__, __LINE__, _T("Failed to parse key: ") + path + _T("/") + key + _T(": ") + utf8::to_unicode(e.what())); 89 } 82 90 } 83 91 } … … 96 104 std::wstring data = core_->get_string(path, key, dummy); 97 105 if (typed_key<T>::has_default_ || data != dummy) { 98 T value = boost::lexical_cast<T>(core_->expand_path(data)); 99 update_target(&value); 106 try { 107 T value = boost::lexical_cast<T>(core_->expand_path(data)); 108 update_target(&value); 109 } catch (const std::exception &e) { 110 core_->err(__FILE__, __LINE__, _T("Failed to parse key: ") + path + _T("/") + key + _T(": ") + utf8::to_unicode(e.what())); 111 } 100 112 } 101 113 } … … 109 121 data = core_->get_string(path, key, dummy); 110 122 if (typed_key<T>::has_default_ || data != dummy) { 111 T value = boost::lexical_cast<T>(core_->expand_path(data)); 112 update_target(&value); 123 try { 124 T value = boost::lexical_cast<T>(core_->expand_path(data)); 125 update_target(&value); 126 } catch (const std::exception &e) { 127 core_->err(__FILE__, __LINE__, _T("Failed to parse key: ") + path + _T("/") + key + _T(": ") + utf8::to_unicode(e.what())); 128 } 113 129 } 114 130 } … … 676 692 if (v->key) { 677 693 //std::wcout << _T("Setting: ") << v->key_name << _T(" ===> ") << v->parent << std::endl; 678 std::wstring desc = v->description.description;679 694 if (v->has_parent()) { 680 desc += _T(" Parent element can be found under: ") + v->parent; 681 core_->register_key(v->parent, v->key_name, v->key->get_type(), v->description.title, desc, v->key->get_default_as_string(), v->description.advanced); 695 core_->register_key(v->parent, v->key_name, v->key->get_type(), v->description.title, v->description.description, v->key->get_default_as_string(), v->description.advanced); 696 std::wstring desc = v->description.description + _T(" parent for this key is found under: ") + v->parent + _T(" this is marked as advanced in favour of the parent."); 697 core_->register_key(v->path, v->key_name, v->key->get_type(), v->description.title, desc, v->key->get_default_as_string(), true); 698 } else { 699 core_->register_key(v->path, v->key_name, v->key->get_type(), v->description.title, v->description.description, v->key->get_default_as_string(), v->description.advanced); 682 700 } 683 core_->register_key(v->path, v->key_name, v->key->get_type(), v->description.title, desc, v->key->get_default_as_string(), v->description.advanced);684 701 } 685 702 } -
include/settings/settings_handler_impl.hpp
r8d89d7a r6533c1a 125 125 else if (desc.type == key_bool) 126 126 get()->set_bool(path, key, settings::settings_interface::string_to_bool(desc.defValue)); 127 else if (desc.type == key_integer) 128 get()->set_int(path, key, strEx::stoi(desc.defValue)); 129 else 127 else if (desc.type == key_integer) { 128 try { 129 get()->set_int(path, key, strEx::stoi(desc.defValue)); 130 } catch (const std::exception &e) { 131 get_logger()->error(__FILE__, __LINE__, _T("invalid default value for: ") + path + _T(".") + key); 132 } 133 } else 130 134 get_logger()->error(__FILE__, __LINE__, _T("Unknown keytype for: ") + path + _T(".") + key); 131 135 } else { -
include/settings/settings_interface_impl.hpp
r8d89d7a r6533c1a 68 68 } 69 69 int get_int() const { 70 if (type==settings_core::key_string) 71 return strEx::stoi(string_val); 72 if (type==settings_core::key_integer) 73 return int_val; 74 if (type==settings_core::key_bool) 75 return int_val==1?1:0; 76 return -1; 70 try { 71 if (type==settings_core::key_string) 72 return strEx::stoi(string_val); 73 if (type==settings_core::key_integer) 74 return int_val; 75 if (type==settings_core::key_bool) 76 return int_val==1?1:0; 77 return -1; 78 } catch (std::exception &e) { 79 return -1; 80 } 77 81 } 78 82 bool get_bool() const { … … 388 392 virtual string_list get_sections(std::wstring path) { 389 393 MUTEX_GUARD(); 390 nsclient::logging::logger::get_logger()->debug(__FILE__, __LINE__, std::wstring(_T("Get sections for: ")) + path);394 //nsclient::logging::logger::get_logger()->debug(__FILE__, __LINE__, std::wstring(_T("Get sections for: ")) + path); 391 395 string_list ret; 392 396 get_cached_sections_unsafe(path, ret);
Note: See TracChangeset
for help on using the changeset viewer.








