]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/hashcomp.h
irc::tokenstream is a token parser which using std::string and std::vector builds...
[user/henk/code/inspircd.git] / include / hashcomp.h
index 7ec813ad6b7db5557ed0e2187ae0df210052d54a..ad6a2133e8fdbeafcd3a643205e3b55920fa9b04 100644 (file)
@@ -18,6 +18,8 @@
 #define _HASHCOMP_H_
 
 #include "inspircd_config.h"
+#include "socket.h"
+#include "hash_map.h"
 
 /*******************************************************
  * This file contains classes and templates that deal
  * backwards compatible with other code which is not
  * aware of irc::string.
  *******************************************************/
-
-#ifdef GCC3
-#include <ext/hash_map>
-#else
-#include <hash_map>
-#endif
-
-#ifdef GCC3
-#define nspace __gnu_cxx
-#else
-#define nspace std
-#endif
-
 using namespace std;
 
 namespace nspace
 {
-#ifdef GCC34
         template<> struct hash<in_addr>
-#else
-        template<> struct nspace::hash<in_addr>
-#endif
         {
                 size_t operator()(const struct in_addr &a) const;
         };
-#ifdef GCC34
-        template<> struct hash<string>
-#else
-        template<> struct nspace::hash<string>
-#endif
+
+        template<> struct hash<std::string>
         {
                 size_t operator()(const string &s) const;
         };
@@ -96,6 +79,19 @@ namespace irc
                bool operator()(const in_addr &s1, const in_addr &s2) const;
        };
 
+       class tokenstream
+       {
+        private:
+               std::string tokenbuffer;
+               std::vector<std::string> tokens;
+        public:
+               tokenstream(std::string &source);
+               ~tokenstream();
+
+               unsigned int GetNumTokens();
+               const std::string& GetToken(unsigned int index);
+       };
+
 
        /** The irc_char_traits class is used for RFC-style comparison of strings.
         * This class is used to implement irc::string, a case-insensitive, RFC-