+ static bool ne(char c1st, char c2nd);
+
+ /** Check if one char is less than another.
+ * @param c1st First character
+ * @param c2nd Second character
+ * @return true if c1st is less than c2nd
+ */
+ static bool lt(char c1st, char c2nd);
+
+ /** Compare two strings of size n.
+ * @param str1 First string
+ * @param str2 Second string
+ * @param n Length to compare to
+ * @return similar to strcmp, zero for equal, less than zero for str1
+ * being less and greater than zero for str1 being greater than str2.
+ */
+ static int compare(const char* str1, const char* str2, size_t n);
+
+ /** Find a char within a string up to position n.
+ * @param s1 String to find in
+ * @param n Position to search up to
+ * @param c Character to search for
+ * @return Pointer to the first occurance of c in s1
+ */
+ static const char* find(const char* s1, int n, char c);
+ };
+
+ /** This typedef declares irc::string based upon irc_char_traits.
+ */
+ typedef std::basic_string<char, irc_char_traits, std::allocator<char> > string;
+
+ /** 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<std::string>& 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
+ * false.
+ */
+ class CoreExport sepstream
+ {
+ protected:
+ /** Original string.
+ */
+ std::string tokens;
+ /** Separator value
+ */
+ char sep;
+ /** Current string position
+ */
+ size_t pos;
+ /** If set then GetToken() can return an empty string
+ */
+ bool allow_empty;
+ public:
+ /** Create a sepstream and fill it with the provided data
+ */
+ sepstream(const std::string &source, char separator, bool allowempty = false);
+
+ /** Fetch the next token from the stream
+ * @param token The next token from the stream is placed here
+ * @return True if tokens still remain, false if there are none left
+ */
+ bool GetToken(std::string& token);
+
+ /** Fetch the entire remaining stream, without tokenizing
+ * @return The remaining part of the stream
+ */
+ const std::string GetRemaining();
+
+ /** Returns true if the end of the stream has been reached
+ * @return True if the end of the stream has been reached, otherwise false
+ */
+ bool StreamEnd();
+ };
+
+ /** A derived form of sepstream, which seperates on commas
+ */
+ class CoreExport commasepstream : public sepstream
+ {
+ public:
+ /** Initialize with comma separator
+ */
+ commasepstream(const std::string &source, bool allowempty = false) : sepstream(source, ',', allowempty)
+ {
+ }
+ };
+
+ /** A derived form of sepstream, which seperates on spaces
+ */
+ class CoreExport spacesepstream : public sepstream
+ {
+ public:
+ /** Initialize with space separator
+ */
+ spacesepstream(const std::string &source, bool allowempty = false) : sepstream(source, ' ', allowempty)
+ {
+ }