18 if (txt.length() >= 1) {
29 size_t mid = txt.find(
":/");
30 if (mid != std::string::npos && mid > 0) {
31 std::string first = txt.substr(0, mid);
32 std::string second = txt.substr(mid + 2);
33 if (first.length() >= 2) {
34 if (first[0] ==
'/') {
35 first = first.substr(1);
38 return Contact(second, first,
"", -1);
40 return Contact(txt,
"",
"", -1);
47 std::string work = txt;
48 size_t mid = work.find(
":/");
49 if (mid != std::string::npos && mid > 0) {
50 work = work.substr(0, mid);
51 std::string target = std::string(
"+") + mod +
".";
52 size_t modLoc = work.find(target);
53 if (modLoc != std::string::npos) {
54 work = work.substr(modLoc + target.length(), work.length());
55 size_t endLoc = work.find(
'+');
56 if (endLoc != std::string::npos) {
57 work = work.substr(0, endLoc);
62 if (hasModifier !=
nullptr) {
65 return ok ? work :
"";
Contact toAddress() const
Create an address from the name.
Name(const std::string &txt)
Constructor.
bool isRooted() const
Check if port name begins with "/".
std::string getCarrierModifier(const char *mod, bool *hasModifier=nullptr)
An interface to the operating system, including Port based communication.