X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9cc56d1fc0b8eec41fbe2b961965e67c598d9406..7344108e8a129a3f9b4df5ab0f98a1713db03b89:/interface/wx/hashmap.h diff --git a/interface/wx/hashmap.h b/interface/wx/hashmap.h index 6a61c80520..b7554e815b 100644 --- a/interface/wx/hashmap.h +++ b/interface/wx/hashmap.h @@ -3,7 +3,7 @@ // Purpose: interface of wxHashMap // Author: wxWidgets team // RCS-ID: $Id$ -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// /** @@ -11,8 +11,8 @@ This is a simple, type-safe, and reasonably efficient hash map class, whose interface is a subset of the interface of STL containers. - In particular, the interface is modeled after std::map, and the various, - non-standard, std::hash_map. + In particular, the interface is modelled after std::map, and the various, + non-standard, std::hash_map (http://www.cppreference.com/wiki/stl/map/start). Example: @code @@ -73,18 +73,18 @@ @endcode The HASH_T and KEY_EQ_T are the types used for the hashing function and key comparison. wxWidgets provides three predefined hashing functions: - wxIntegerHash for integer types ( int, long, short, and their unsigned counterparts ), - wxStringHash for strings ( wxString, wxChar*, char* ), and wxPointerHash for + @c wxIntegerHash for integer types ( int, long, short, and their unsigned counterparts ), + @c wxStringHash for strings ( wxString, wxChar*, char* ), and @c wxPointerHash for any kind of pointer. - Similarly three equality predicates: wxIntegerEqual, wxStringEqual, - wxPointerEqual are provided. + Similarly three equality predicates: @c wxIntegerEqual, @c wxStringEqual, + @c wxPointerEqual are provided. Using this you could declare a hash map mapping int values to wxString like this: @code WX_DECLARE_HASH_MAP( int, wxString, - wxIntegerHash, - wxIntegerEqual, + ::wxIntegerHash, + ::wxIntegerEqual, MyHash ); // using an user-defined class for keys @@ -119,8 +119,8 @@ WX_DECLARE_HASH_MAP( MyKey, // type of the keys SOME_TYPE, // any type you like - MyKeyHash, // hasher - MyKeyEqual, // key equality predicate + ::MyKeyHash, // hasher + ::MyKeyEqual, // key equality predicate CLASSNAME); // name of the class @endcode @@ -151,6 +151,13 @@ it + 3, it1 - it2. + @section hashmap_predef Predefined hashmap types + + wxWidgets defines the following hashmap types: + - wxLongToLongHashMap (uses long both for keys and values) + - wxStringToStringHashMap (uses wxString both for keys and values) + + @library{wxbase} @category{containers} */ @@ -221,7 +228,8 @@ public: /** If an element with the given key is present, the functions returns an iterator pointing at that element, otherwise an invalid iterator is - returned; i.e. + returned. + @code hashmap.find( non_existent_key ) == hashmap.end() @endcode