X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fhashcomp.h;h=f0e092729d9618cec08e4b01972280721af3a022;hb=79892a727e323dcc4bce7e9c0cf3c99c5fe61706;hp=bda85182f2bd26463d5c998f0ed8d4c74ef7f855;hpb=124c17e14134a4999afc1a5e981ab7c75b3694b9;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/hashcomp.h b/include/hashcomp.h index bda85182f..f0e092729 100644 --- a/include/hashcomp.h +++ b/include/hashcomp.h @@ -108,13 +108,6 @@ namespace irc bool CoreExport operator()(const std::string& a, const std::string& b) const; }; - /** Joins the contents of a vector to a string. - * @param sequence Zero or more items to join. - * @param separator The character to place between the items, defaults to ' ' (space). - * @return Joined string. - */ - std::string CoreExport stringjoiner(const std::vector& sequence, char separator = ' '); - /** irc::sepstream allows for splitting token seperated lists. * Each successive call to sepstream::GetToken() returns * the next token, until none remain, at which point the method returns @@ -193,30 +186,30 @@ namespace irc * list will be ":item". This is to allow for parsing 'source' fields * from data. */ - class CoreExport tokenstream : private spacesepstream + class CoreExport tokenstream { - public: - /** Create a tokenstream and fill it with the provided data - */ - tokenstream(const std::string &source); + private: + /** The message we are parsing tokens from. */ + std::string message; - /** Fetch the next token from the stream as a std::string - * @param token The next token available, or an empty string if none remain - * @return True if tokens are left to be read, false if the last token was just retrieved. - */ - bool GetToken(std::string &token); + /** The current position within the message. */ + size_t position; + + public: + /** Create a tokenstream and fill it with the provided data. */ + tokenstream(const std::string& msg, size_t start = 0); - /** Fetch the next token from the stream as an integer - * @param token The next token available, or undefined if none remain + /** Retrieve the next \ token in the token stream. + * @param token The next token available, or an empty string if none remain. * @return True if tokens are left to be read, false if the last token was just retrieved. */ - bool GetToken(int &token); + bool GetMiddle(std::string& token); - /** Fetch the next token from the stream as a long integer - * @param token The next token available, or undefined if none remain + /** Retrieve the next \ token in the token stream. + * @param token The next token available, or an empty string if none remain. * @return True if tokens are left to be read, false if the last token was just retrieved. */ - bool GetToken(long &token); + bool GetTrailing(std::string& token); }; /** The portparser class seperates out a port range into integers.