diff options
author | Adam <Adam@anope.org> | 2012-11-22 00:50:33 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2012-11-22 00:50:33 -0500 |
commit | d33a0f75a5c0c584fbb7cc0076da36d494f39494 (patch) | |
tree | 7b2274cc833c793c0f5595660cbd4d715de52ffd /src/hashcomp.cpp | |
parent | 368d469631763e9c8bf399980d0ac7c5b5664d39 (diff) |
Pretty large coding style cleanup, in source doc
cleanup, and allow protocol mods to depend on each
other
Diffstat (limited to 'src/hashcomp.cpp')
-rw-r--r-- | src/hashcomp.cpp | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index 7ce28df13..2875a52df 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -1,11 +1,10 @@ /* + * * Copyright (C) 2002-2011 InspIRCd Development Team * Copyright (C) 2008-2012 Anope Team <team@anope.org> * * Please read COPYING and README for further details. * - * These classes have been copied from InspIRCd and modified - * for use in Anope. */ #include "services.h" @@ -70,11 +69,6 @@ const char *ci::ci_char_traits::find(const char *s1, int n, char c) return n >= 0 ? s1 : NULL; } -/** Compare two Anope::strings as ci::strings and find which one is less - * @param s1 The first string - * @param s2 The second string - * @return true if s1 < s2, else false - */ bool ci::less::operator()(const Anope::string &s1, const Anope::string &s2) const { return s1.ci_str().compare(s2.ci_str()) < 0; @@ -111,6 +105,34 @@ bool sepstream::GetToken(Anope::string &token) return false; } +bool sepstream::GetToken(Anope::string &token, int num) +{ + int i; + for (i = 0; i < num + 1 && !this->GetToken(token); ++i); + return i == num + 1; +} + +int sepstream::NumTokens() +{ + int i; + Anope::string token; + for (i = 0; this->GetToken(token); ++i); + return i; +} + +bool sepstream::GetTokenRemainder(Anope::string &token, int num) +{ + if (this->GetToken(token, num)) + { + if (!this->StreamEnd()) + token += sep + this->GetRemaining(); + + return true; + } + + return false; +} + const Anope::string sepstream::GetRemaining() { return Anope::string(n, tokens.end()); |