summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/plib/pstrutil.h
diff options
context:
space:
mode:
author couriersud <couriersud@gmx.org>2019-10-18 17:57:55 +0200
committer couriersud <couriersud@gmx.org>2019-10-18 17:57:55 +0200
commitb09fa00cca1a9baa0327a33d865fc970f77d4db0 (patch)
tree47dd943368aa43a0c0cf4256f88e590960c1e99f /src/lib/netlist/plib/pstrutil.h
parentad27643c07d54fc2cc3e56327fe07335e7763d52 (diff)
Netlist: code maintenance and improvements. [Couriersud]
- Added support for line markers to the preprocessor and parser. - Added support for include processing to the preprocessor. - Moved sources base type to plib to be used for preprocessor includes. This enables to include e.g. from rom memory regions. - Renamed some defines
Diffstat (limited to 'src/lib/netlist/plib/pstrutil.h')
-rw-r--r--src/lib/netlist/plib/pstrutil.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/lib/netlist/plib/pstrutil.h b/src/lib/netlist/plib/pstrutil.h
index 94ecccca09e..d3e62d06af7 100644
--- a/src/lib/netlist/plib/pstrutil.h
+++ b/src/lib/netlist/plib/pstrutil.h
@@ -88,6 +88,28 @@ namespace plib
}
template<typename T>
+ typename T::size_type find_last_of(const T &str, const T &no)
+ {
+ typename T::size_type last_found = T::npos;
+ typename T::size_type pos = 0;
+ for (auto it = str.begin(); it != str.end(); ++it, ++pos)
+ {
+ bool f = false;
+ for (typename T::value_type const jt : no)
+ {
+ if (*it == jt)
+ {
+ f = true;
+ break;
+ }
+ }
+ if (f)
+ last_found = pos;
+ }
+ return last_found;
+ }
+
+ template<typename T>
T ltrim(const T &str, const T &ws = T(" \t\n\r"))
{
auto f = find_first_not_of(str, ws);