summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/unistring.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/unistring.h b/src/unistring.h
index 5413ef14..d42f2b28 100644
--- a/src/unistring.h
+++ b/src/unistring.h
@@ -55,6 +55,8 @@ namespace ledger {
class unistring
{
public:
+ static const std::size_t npos = static_cast<std::size_t>(-1);
+
std::vector<boost::uint32_t> utf32chars;
unistring() {
@@ -96,6 +98,23 @@ public:
return utf8result;
}
+
+ std::size_t find(const boost::uint32_t __s, std::size_t __pos = 0) const {
+ std::size_t idx = 0;
+ foreach (const boost::uint32_t& ch, utf32chars) {
+ if (idx >= __pos && ch == __s)
+ return idx;
+ idx++;
+ }
+ return npos;
+ }
+
+ boost::uint32_t& operator[](const std::size_t index) {
+ return utf32chars[index];
+ }
+ const boost::uint32_t& operator[](const std::size_t index) const {
+ return utf32chars[index];
+ }
};
inline void justify(std::ostream& out,