diff options
author | Elias Fleckenstein <54945686+EliasFleckenstein03@users.noreply.github.com> | 2020-11-04 16:44:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-04 16:44:42 +0100 |
commit | 5d9ae5a91c544fc7fbd475decf47cef7e09ef8fc (patch) | |
tree | c980d614fec4a5495798be3e79e033229062c3cd /src/util/strfnd.h | |
parent | 28f6a79706b088c37268a59d90878220dc4ef9c7 (diff) | |
parent | 3af10766fd2b58b068e970266724d7eb10e9316b (diff) | |
download | dragonfireclient-5d9ae5a91c544fc7fbd475decf47cef7e09ef8fc.tar.xz |
Merge branch 'master' into master
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(); |