YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
ParseName.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
8
9#include <string>
10
11using namespace yarp::serversql::impl;
12
13void ParseName::apply(const std::string& s) {
14 std::string name = s;
15 carrier = "";
16 networkChoice = "";
17 portName = "";
18 int mid = name.find(":/");
19 if (mid>0) {
20 carrier = name.substr(0,mid);
21 std::string tail = name.substr(mid+2);
22 if (carrier.length()>0 && carrier[0]=='/') {
23 carrier = carrier.substr(1);
24 }
25 name = tail;
26 }
27 if (name.find("/net=") == 0 || name.find("/NET=") == 0) {
28 int patStart = 5;
29 int patEnd = name.find('/',patStart);
30 if (patEnd>=patStart) {
31 networkChoice = name.substr(patStart,patEnd-patStart);
32 name = name.substr(patEnd);
33 }
34 }
35 portName = name;
36}
void apply(const std::string &str)
Definition ParseName.cpp:13