]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/hashcomp.h
Make classbase and refcountbase uncopyable; expand comments on their indended uses
[user/henk/code/inspircd.git] / include / hashcomp.h
index a1bc26602e8f0d9dab261afc01c2a44584c047b6..5392c6ae5d94e26126ea05846520a971b6ebd999 100644 (file)
@@ -3,7 +3,7 @@
  *       +------------------------------------+
  *
  *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
  *         the file COPYING for details.
@@ -204,7 +204,7 @@ namespace irc
         * std::string, or a const char* const* array, using overloaded
         * constructors.
         */
-       class CoreExport stringjoiner : public classbase
+       class CoreExport stringjoiner
        {
         private:
 
@@ -248,11 +248,9 @@ namespace irc
         * It can then reproduce this list, clamped to a maximum of MAXMODES
         * values per line.
         */
-       class CoreExport modestacker : public classbase
+       class CoreExport modestacker
        {
         private:
-               InspIRCd* ServerInstance;
-
                /** The mode sequence and its parameters
                 */
                std::deque<std::string> sequence;
@@ -268,7 +266,7 @@ namespace irc
                 * @param add True if the stack is adding modes,
                 * false if it is removing them
                 */
-               modestacker(InspIRCd* Instance, bool add);
+               modestacker(bool add);
 
                /** Push a modeletter and its parameter onto the stack.
                 * No checking is performed as to if this mode actually
@@ -304,7 +302,7 @@ namespace irc
                 * characters. As specified below, this function
                 * should be called in a loop until it returns zero,
                 * indicating there are no more modes to return.
-                * @param result The deque to populate. This will
+                * @param result The vector to populate. This will not
                 * be cleared before it is used.
                 * @param max_line_size The maximum size of the line
                 * to build, in characters, seperate to MAXMODES.
@@ -313,7 +311,16 @@ namespace irc
                 * returns 0, in case there are multiple lines of
                 * mode changes to be obtained.
                 */
-               int GetStackedLine(std::deque<std::string> &result, int max_line_size = 360);
+               int GetStackedLine(std::vector<std::string> &result, int max_line_size = 360);
+
+               /** deprecated compatability interface - TODO remove */
+               int GetStackedLine(std::deque<std::string> &result, int max_line_size = 360) {
+                       std::vector<std::string> r;
+                       int n = GetStackedLine(r, max_line_size);
+                       result.clear();
+                       result.insert(result.end(), r.begin(), r.end());
+                       return n;
+               }
        };
 
        /** irc::tokenstream reads a string formatted as per RFC1459 and RFC2812.
@@ -328,7 +335,7 @@ namespace irc
         * list will be ":item". This is to allow for parsing 'source' fields
         * from data.
         */
-       class CoreExport tokenstream : public classbase
+       class CoreExport tokenstream
        {
         private:
 
@@ -387,7 +394,7 @@ namespace irc
         * the next token, until none remain, at which point the method returns
         * an empty string.
         */
-       class CoreExport sepstream : public classbase
+       class CoreExport sepstream
        {
         private:
                /** Original string.
@@ -460,7 +467,7 @@ namespace irc
         * start or end < 0) then GetToken() will return the first element
         * of the pair of numbers.
         */
-       class CoreExport portparser : public classbase
+       class CoreExport portparser
        {
         private:
 
@@ -627,13 +634,13 @@ inline std::string& trim(std::string &str)
 }
 
 /** Hashing stuff is totally different on vc++'s hash_map implementation, so to save a buttload of
- * #ifdefs we'll just do it all at once
+ * #ifdefs we'll just do it all at once. Except, of course, with TR1, when it's the same as GCC.
  */
 BEGIN_HASHMAP_NAMESPACE
 
        /** Hashing function to hash irc::string
         */
-#ifdef WINDOWS
+#if defined(WINDOWS) && !defined(HAS_TR1_UNORDERED)
        template<> class CoreExport hash_compare<irc::string, std::less<irc::string> >
        {
        public:
@@ -679,7 +686,7 @@ BEGIN_HASHMAP_NAMESPACE
                 * @param s A string to hash
                 * @return The hash value
                 */
-               size_t operator()(const irc::string &s) const;
+               size_t CoreExport operator()(const irc::string &s) const;
        };
 
        /* XXX FIXME: Implement a hash function overriding std::string's that works with TR1! */
@@ -687,10 +694,10 @@ BEGIN_HASHMAP_NAMESPACE
 #ifdef HASHMAP_DEPRECATED
        struct insensitive
 #else
-       template<> struct hash<std::string>
+       CoreExport template<> struct hash<std::string>
 #endif
        {
-               size_t operator()(const std::string &s) const;
+               size_t CoreExport operator()(const std::string &s) const;
        };
 
 #endif