]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/hashcomp.h
Added <options:notimesync> to the example config
[user/henk/code/inspircd.git] / include / hashcomp.h
index fac1d4ed20a3ab0cce72d546371a495bbfdb8a81..b2756b340e02e1608b69b2eed288c53aea868c76 100644 (file)
@@ -123,6 +123,45 @@ namespace irc
                bool operator()(const insp_inaddr &s1, const insp_inaddr &s2) const;
        };
 
+       /** irc::stringjoiner joins string lists into a string, using
+        * the given seperator string.
+        * This class can join a vector of std::string, a deque of
+        * std::string, or a const char** array, using overloaded
+        * constructors.
+        */
+       class stringjoiner
+       {
+        private:
+               std::string joined;
+        public:
+               /** Join elements of a vector, between (and including) begin and end
+                * @param seperator The string to seperate values with
+                * @param sequence One or more items to seperate
+                * @param begin The starting element in the sequence to be joined
+                * @param end The ending element in the sequence to be joined
+                */
+               stringjoiner(const std::string &seperator, const std::vector<std::string> &sequence, int begin, int end);
+               /** Join elements of a deque, between (and including) begin and end
+                * @param seperator The string to seperate values with
+                * @param sequence One or more items to seperate
+                * @param begin The starting element in the sequence to be joined
+                * @param end The ending element in the sequence to be joined
+                */
+               stringjoiner(const std::string &seperator, const std::deque<std::string> &sequence, int begin, int end);
+               /** Join elements of an array of char arrays, between (and including) begin and end
+                * @param seperator The string to seperate values with
+                * @param sequence One or more items to seperate
+                * @param begin The starting element in the sequence to be joined
+                * @param end The ending element in the sequence to be joined
+                */
+               stringjoiner(const std::string &seperator, const char** sequence, int begin, int end);
+
+               /** Get the joined sequence
+                * @return A reference to the joined string
+                */
+               std::string& GetJoined();
+       };
+
        /** irc::modestacker stacks mode sequences into a list.
         * It can then reproduce this list, clamped to a maximum of MAXMODES
         * values per line.
@@ -170,7 +209,7 @@ namespace irc
                /** Return zero or more elements which form the
                 * mode line. This will be clamped to a max of
                 * MAXMODES+1 items (MAXMODES mode parameters and
-                * one mode dequence string).
+                * one mode sequence string).
                 * @param result The deque to populate. This will
                 * be cleared before it is used.
                 * @return The number of elements in the deque
@@ -209,10 +248,8 @@ namespace irc
                const std::string GetToken();
        };
 
-       /** irc::commasepstream allows for splitting comma seperated lists.
-        * Lists passed to irc::commasepstream should not contain spaces
-        * after the commas, or this will be taken to be part of the item
-        * data. Each successive call to commasepstream::GetToken() returns
+       /** 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
         * an empty string.
         */
@@ -224,7 +261,7 @@ namespace irc
                std::string::iterator n;
                char sep;
         public:
-               /** Create a commasepstream and fill it with the provided data
+               /** Create a sepstream and fill it with the provided data
                 */
                sepstream(const std::string &source, char seperator);
                virtual ~sepstream();
@@ -235,6 +272,8 @@ namespace irc
                virtual const std::string GetToken();
        };
 
+       /** A derived form of sepstream, which seperates on commas
+        */
        class commasepstream : public sepstream
        {
         public:
@@ -243,6 +282,8 @@ namespace irc
                }
        };
 
+       /** A derived form of sepstream, which seperates on spaces
+        */
        class spacesepstream : public sepstream
        {
         public: