diff options
Diffstat (limited to 'src/util/strfnd.h')
-rw-r--r-- | src/util/strfnd.h | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/util/strfnd.h b/src/util/strfnd.h index 96cf1b458..92fbbaf07 100644 --- a/src/util/strfnd.h +++ b/src/util/strfnd.h @@ -21,14 +21,19 @@ with this program; if not, write to the Free Software Foundation, Inc., #include <string> -template <typename T> -class BasicStrfnd { +template <typename T> class BasicStrfnd +{ typedef std::basic_string<T> String; String str; size_t pos; + public: BasicStrfnd(const String &s) : str(s), pos(0) {} - void start(const String &s) { str = s; pos = 0; } + void start(const String &s) + { + str = s; + pos = 0; + } size_t where() { return pos; } void to(size_t i) { pos = i; } bool at_end() { return pos >= str.size(); } @@ -48,8 +53,9 @@ public: return ret; } - // Returns substr up to the next occurence of sep that isn't escaped with esc ('\\') - String next_esc(const String &sep, T esc=static_cast<T>('\\')) + // Returns substr up to the next occurence of sep that isn't escaped with esc + // ('\\') + String next_esc(const String &sep, T esc = static_cast<T>('\\')) { if (pos >= str.size()) return String(); |