Changeset 4836 for source/ariba/communication
- Timestamp:
- Jul 9, 2009, 1:50:37 PM (15 years ago)
- Location:
- source/ariba/communication
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/communication/EndpointDescriptor.cpp
r3705 r4836 63 63 } 64 64 65 EndpointDescriptor::EndpointDescriptor(const string str) { 66 using namespace boost::xpressive; 67 using namespace ariba::utility::string_format; 68 using namespace ariba::utility::Helper; 69 using namespace std; 70 71 locator = NULL; 72 isUnspec = true; 73 74 smatch match; 75 if (regex_search(str, match, robjects)) { 76 regex_nav nav = match; 77 for (int i=0; i<nav.size(); i++) { 78 string type = nav[i][robject_id].str(); 79 if (type=="ip") { 80 string ip = nav[i][robject_data].str(); 81 ip = ip.substr(1,ip.size()-2); 82 this->locator = new IPv4Locator(); 83 this->locator->setIP(ip); 84 this->isUnspec = false; 85 } else 86 if (type=="tcp") { 87 string port = nav[i][robject_data][rfields][1].str(); 88 port = port.substr(1,port.size()-2); 89 this->locator->setPort(stoi(port)); 90 } 91 } 92 } 93 } 94 65 95 EndpointDescriptor::~EndpointDescriptor() { 66 96 } … … 80 110 81 111 EndpointDescriptor* EndpointDescriptor::fromString( string str ) { 82 using namespace boost::xpressive; 83 using namespace ariba::utility::string_format; 84 using namespace ariba::utility::Helper; 85 using namespace std; 86 87 EndpointDescriptor* ep = NULL; 88 smatch match; 89 if (regex_search(str, match, robjects)) { 90 regex_nav nav = match; 91 for (int i=0; i<nav.size(); i++) { 92 string type = nav[i][robject_id].str(); 93 if (type=="ip") { 94 string ip = nav[i][robject_data].str(); 95 ip = ip.substr(1,ip.size()-2); 96 ep = new EndpointDescriptor(); 97 ep->locator = new IPv4Locator(); 98 ep->locator->setIP(ip); 99 ep->isUnspec = false; 100 } else 101 if (type=="tcp") { 102 string port = nav[i][robject_data][rfields][1].str(); 103 port = port.substr(1,port.size()-2); 104 ep->locator->setPort(stoi(port)); 105 } 106 } 107 } 108 return ep; 112 return new EndpointDescriptor( str ); 109 113 } 110 114 -
source/ariba/communication/EndpointDescriptor.h
r4625 r4836 69 69 EndpointDescriptor(const EndpointDescriptor& rh); 70 70 EndpointDescriptor(const Locator* _locator); 71 EndpointDescriptor(const string str); 71 72 72 73 /**
Note:
See TracChangeset
for help on using the changeset viewer.