summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/plib/putil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/netlist/plib/putil.cpp')
-rw-r--r--src/lib/netlist/plib/putil.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/lib/netlist/plib/putil.cpp b/src/lib/netlist/plib/putil.cpp
index 39e1b444f33..6a24e8c4012 100644
--- a/src/lib/netlist/plib/putil.cpp
+++ b/src/lib/netlist/plib/putil.cpp
@@ -36,13 +36,14 @@ namespace plib
if (getenv(var.c_str()) == nullptr)
return default_val;
else
- return pstring(getenv(var.c_str()));
+ return pstring(getenv(var.c_str()), pstring::UTF8);
}
}
- pstring_vector_t::pstring_vector_t(const pstring &str, const pstring &onstr, bool ignore_empty)
- : std::vector<pstring>()
+ std::vector<pstring> psplit(const pstring &str, const pstring &onstr, bool ignore_empty)
{
+ std::vector<pstring> ret;
+
pstring::iterator p = str.begin();
pstring::iterator pn = str.find(onstr, p);
@@ -50,7 +51,7 @@ namespace plib
{
pstring t = str.substr(p, pn);
if (!ignore_empty || t.len() != 0)
- this->push_back(t);
+ ret.push_back(t);
p = pn + onstr.len();
pn = str.find(onstr, p);
}
@@ -58,14 +59,15 @@ namespace plib
{
pstring t = str.substr(p, str.end());
if (!ignore_empty || t.len() != 0)
- this->push_back(t);
+ ret.push_back(t);
}
+ return ret;
}
- pstring_vector_t::pstring_vector_t(const pstring &str, const pstring_vector_t &onstrl)
- : std::vector<pstring>()
+ std::vector<pstring> psplit(const pstring &str, const std::vector<pstring> &onstrl)
{
pstring col = "";
+ std::vector<pstring> ret;
unsigned i = 0;
while (i<str.blen())
@@ -82,10 +84,10 @@ namespace plib
if (p != static_cast<std::size_t>(-1))
{
if (col != "")
- this->push_back(col);
+ ret.push_back(col);
col = "";
- this->push_back(onstrl[p]);
+ ret.push_back(onstrl[p]);
i += onstrl[p].blen();
}
else
@@ -96,11 +98,13 @@ namespace plib
}
}
if (col != "")
- this->push_back(col);
+ ret.push_back(col);
+
+ return ret;
}
- int enum_base::from_string_int(const char *str, const char *x)
+ int penum_base::from_string_int(const char *str, const char *x)
{
int cnt = 0;
const char *cur = str;
@@ -127,7 +131,7 @@ namespace plib
return cnt;
return -1;
}
- pstring enum_base::nthstr(int n, const char *str)
+ pstring penum_base::nthstr(int n, const char *str)
{
char buf[64];
char *bufp = buf;
@@ -139,7 +143,7 @@ namespace plib
if (*str == ',')
{
*bufp = 0;
- return pstring(buf);
+ return pstring(buf, pstring::UTF8);
}
else if (*str != ' ')
*bufp++ = *str;
@@ -152,6 +156,6 @@ namespace plib
str++;
}
*bufp = 0;
- return pstring(buf);
+ return pstring(buf, pstring::UTF8);
}
} // namespace plib