Changeset 96c1461 in nscp for include/nscapi/targets.hpp
- Timestamp:
- 11/27/11 22:04:35 (18 months ago)
- Branches:
- master, 0.4.0, 0.4.1, 0.4.2
- Children:
- 9853bc3
- Parents:
- 16198e3
- File:
-
- 1 edited
-
include/nscapi/targets.hpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
include/nscapi/targets.hpp
r7515d00 r96c1461 11 11 #include <nscapi/settings_proxy.hpp> 12 12 13 #include <net/net.hpp> 14 13 15 namespace nscapi { 14 16 struct target_handler { … … 17 19 std::wstring host; 18 20 std::wstring alias; 19 std::wstring protocol; 21 //std::wstring protocol; 22 std::wstring address; 20 23 std::wstring parent; 21 24 typedef std::map<std::wstring,std::wstring> options_type; … … 26 29 ss << _T("Target: ") << alias; 27 30 ss << _T(", host: ") << host; 28 ss << _T(", protocol: ") << protocol; 31 // ss << _T(", protocol: ") << protocol; 32 ss << _T(", address: ") << address; 29 33 ss << _T(", parent: ") << parent; 30 34 BOOST_FOREACH(options_type::value_type o, options) { … … 32 36 } 33 37 return ss.str(); 38 } 39 40 bool has_protocol() { 41 return !address.empty(); 42 } 43 std::wstring get_protocol() { 44 net::wurl url = net::parse(address); 45 return url.protocol; 46 } 47 bool has_option(std::wstring key) { 48 return options.find(key) != options.end(); 49 } 50 bool has_option(std::string key) { 51 return has_option(utf8::cvt<std::wstring>(key)); 34 52 } 35 53 … … 40 58 target_list_type target_list; 41 59 target_list_type template_list; 42 void add(boost::shared_ptr<nscapi::settings_proxy> proxy, std::wstring path, std::wstring key, std::wstring value) { 43 add(read_target(proxy, path, key, value)); 60 target add(boost::shared_ptr<nscapi::settings_proxy> proxy, std::wstring path, std::wstring key, std::wstring value) { 61 target t = read_target(proxy, path, key, value); 62 add(t); 63 return t; 44 64 } 45 65 void add(target t) { … … 50 70 } 51 71 target read_target(boost::shared_ptr<nscapi::settings_proxy> proxy, std::wstring path, std::wstring alias, std::wstring host); 72 void rebuild(); 52 73 53 74 optarget find_target(std::wstring alias); 75 bool has_target(std::wstring alias); 54 76 static void apply_parent(target &t, target &p); 55 77 std::wstring to_wstring();
Note: See TracChangeset
for help on using the changeset viewer.








