X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fhashcomp.h;h=78d7ee878d230719ca692ff9b13fe2f9ac674023;hb=e6601069038c35c546fd3f3dce95024b0d13f1b4;hp=df36eefde30526484629f1c0ee311c2491ddf1e2;hpb=6b2ea833674bb3bfedb0f2e2af06efa25655e5f5;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/hashcomp.h b/include/hashcomp.h index df36eefde..78d7ee878 100644 --- a/include/hashcomp.h +++ b/include/hashcomp.h @@ -1,18 +1,29 @@ -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ +/* + * InspIRCd -- Internet Relay Chat Daemon * - * InspIRCd: (C) 2002-2009 InspIRCd Development Team - * See: http://wiki.inspircd.org/Credits + * Copyright (C) 2011 Adam + * Copyright (C) 2009 Daniel De Graaf + * Copyright (C) 2007, 2009 Dennis Friis + * Copyright (C) 2005-2009 Craig Edwards + * Copyright (C) 2007-2008 Robin Burchell + * Copyright (C) 2008 Pippijn van Steenhoven * - * This program is free but copyrighted software; see - * the file COPYING for details. + * This file is part of InspIRCd. InspIRCd is free software: you can + * redistribute it and/or modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation, version 2. * - * --------------------------------------------------- + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ -#ifndef _HASHCOMP_H_ -#define _HASHCOMP_H_ + +#ifndef HASHCOMP_H +#define HASHCOMP_H #include #include @@ -92,7 +103,7 @@ namespace irc * Case sensitivity is ignored, and the RFC 'character set' * is adhered to */ - struct StrHashComp + struct CoreExport StrHashComp { /** The operator () does the actual comparison in hash_map */ @@ -146,7 +157,7 @@ namespace irc /** Compose a hex string from raw data. * @param raw The raw data to compose hex from - * @pram rawsz The size of the raw data buffer + * @param rawsz The size of the raw data buffer * @return The hex string. */ CoreExport std::string hex(const unsigned char *raw, size_t rawsz); @@ -430,7 +441,7 @@ namespace irc /** Used to split on commas */ - commasepstream* sep; + commasepstream sep; /** Current position in a range of ports */ @@ -451,7 +462,7 @@ namespace irc /** Used to determine overlapping of ports * without O(n) algorithm being used */ - std::map overlap_set; + std::set overlap_set; /** Returns true if val overlaps an existing range */ @@ -464,10 +475,6 @@ namespace irc */ portparser(const std::string &source, bool allow_overlapped = true); - /** Frees the internal commasepstream object - */ - ~portparser(); - /** Fetch the next token from the stream * @return The next port number is returned, or 0 if none remain */ @@ -479,6 +486,15 @@ namespace irc * @return The new value with _ translated to space. */ CoreExport const char* Spacify(const char* n); + + struct hash + { + /** Hash an irc::string using RFC1459 case sensitivity rules + * @param s A string to hash + * @return The hash value + */ + size_t CoreExport operator()(const irc::string &s) const; + }; } /* Define operators for using >> and << with irc::string to an ostream on an istream. */ @@ -576,13 +592,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. Except, of course, with TR1, when it's the same as GCC. + * \#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 */ -#if defined(WINDOWS) && !defined(HAS_TR1_UNORDERED) +#if defined(_WIN32) && !defined(HAS_TR1_UNORDERED) template<> class CoreExport hash_compare > { public: @@ -622,15 +638,6 @@ BEGIN_HASHMAP_NAMESPACE }; #else - template<> struct hash - { - /** Hash an irc::string using RFC1459 case sensitivity rules - * @param s A string to hash - * @return The hash value - */ - size_t CoreExport operator()(const irc::string &s) const; - }; - /* XXX FIXME: Implement a hash function overriding std::string's that works with TR1! */ #ifdef HASHMAP_DEPRECATED