YARP
Yet Another Robot Platform
ParseName.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * Copyright (C) 2006-2010 RobotCub Consortium
4  * All rights reserved.
5  *
6  * This software may be modified and distributed under the terms of the
7  * BSD-3-Clause license. See the accompanying LICENSE file for details.
8  */
9 
11 
12 #include <string>
13 
14 using namespace yarp::serversql::impl;
15 using namespace std;
16 
17 void ParseName::apply(const std::string& s) {
18  std::string name = s;
19  carrier = "";
20  networkChoice = "";
21  portName = "";
22  int mid = name.find(":/");
23  if (mid>0) {
24  carrier = name.substr(0,mid);
25  std::string tail = name.substr(mid+2);
26  if (carrier.length()>0 && carrier[0]=='/') {
27  carrier = carrier.substr(1);
28  }
29  name = tail;
30  }
31  if (name.find("/net=") == 0 || name.find("/NET=") == 0) {
32  int patStart = 5;
33  int patEnd = name.find('/',patStart);
34  if (patEnd>=patStart) {
35  networkChoice = name.substr(patStart,patEnd-patStart);
36  name = name.substr(patEnd);
37  }
38  }
39  portName = name;
40 }
ParseName.h
yarp::serversql::impl::ParseName::apply
void apply(const std::string &str)
Definition: ParseName.cpp:17
yarp::serversql::impl
Definition: Allocator.h:18