summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/plib/pstring.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/netlist/plib/pstring.h')
-rw-r--r--src/lib/netlist/plib/pstring.h24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/lib/netlist/plib/pstring.h b/src/lib/netlist/plib/pstring.h
index 9a58e75fbd3..6af155a640c 100644
--- a/src/lib/netlist/plib/pstring.h
+++ b/src/lib/netlist/plib/pstring.h
@@ -178,11 +178,23 @@ public:
const_iterator cend() const noexcept { return const_iterator(m_str.end()); }
// C string conversion helpers
- const mem_t *c_str() const noexcept { return static_cast<const mem_t *>(m_str.c_str()); }
- const mem_t *data() const noexcept { return c_str(); }
-
+ const mem_t *c_str() const noexcept { return static_cast<const mem_t *>(m_str.c_str()); }
+ const mem_t *data() const noexcept { return c_str(); }
+
+ /// \brief return number of codes in the string
+ ///
+ /// This may report a number less than what \ref size reports. pstrings
+ /// operate on character codes. In the case of utf pstrings thus the physical size
+ /// may be bigger than the logical size.
size_type length() const noexcept { return traits_type::len(m_str); }
- size_type size() const noexcept { return traits_type::len(m_str); }
+
+ /// \brief return number of memory units in the string
+ ///
+ /// This function returns the number of memory units used by a string.
+ /// Depending on the string type the size may be reported as bytes, words
+ /// or quad-words.
+ size_type size() const noexcept { return m_str.size(); }
+
bool empty() const noexcept { return m_str.empty(); }
void clear() noexcept { m_str.clear(); }
@@ -478,14 +490,18 @@ namespace plib
struct string_info<pstring_t<T>>
{
using mem_t = typename T::mem_t;
+#if 0
static std::size_t mem_size(const pstring_t<T> &s) { return s.mem_t_size(); }
+#endif
};
template<typename T>
struct string_info<std::basic_string<T>>
{
using mem_t = T;
+#if 0
static std::size_t mem_size(const std::basic_string<T> &s) { return s.size(); }
+#endif
};
} // namespace plib