~ubuntu-branches/ubuntu/precise/inkscape/precise-updates

« back to all changes in this revision

Viewing changes to src/util/unordered-containers.h

  • Committer: Bazaar Package Importer
  • Author(s): Alex Valavanis
  • Date: 2010-09-12 19:44:58 UTC
  • mfrom: (1.1.12 upstream) (45.1.3 maverick)
  • Revision ID: james.westby@ubuntu.com-20100912194458-4sjwmbl7dlsrk5dc
Tags: 0.48.0-1ubuntu1
* Merge with Debian unstable (LP: #628048, LP: #401567, LP: #456248, 
  LP: #463602, LP: #591986)
* debian/control: 
  - Ubuntu maintainers
  - Promote python-lxml, python-numpy, python-uniconvertor to Recommends.
  - Demote pstoedit to Suggests (universe package).
  - Suggests ttf-dejavu instead of ttf-bitstream-vera (LP: #513319)
* debian/rules:
  - Run intltool-update on build (Ubuntu-specific).
  - Add translation domain to .desktop files (Ubuntu-specific).
* debian/dirs:
  - Add usr/share/pixmaps.  Allow inkscape.xpm installation
* drop 50-poppler-API.dpatch (now upstream)
* drop 51-paste-in-unwritable-directory.dpatch (now upstream) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/** @file
 
2
 * @brief Compatibility wrapper for unordered containers.
 
3
 */
 
4
/* Authors:
 
5
 *   Jon A. Cruz <jon@joncruz.org>
 
6
 *   Krzysztof Kosiński <tweenk.pl@gmail.com>
 
7
 *
 
8
 * Copyright (C) 2010 Authors
 
9
 * Released under GNU GPL, read the file 'COPYING' for more information
 
10
 */
 
11
 
 
12
#ifndef SEEN_INK_UTIL_UNORDERED_CONTAINERS_H
 
13
#define SEEN_INK_UTIL_UNORDERED_CONTAINERS_H
 
14
 
 
15
#ifdef HAVE_CONFIG_H
 
16
# include "config.h"
 
17
#endif
 
18
 
 
19
#ifndef DOXYGEN_SHOULD_SKIP_THIS
 
20
#if defined(HAVE_TR1_UNORDERED_SET)
 
21
 
 
22
# include <tr1/unordered_set>
 
23
# include <tr1/unordered_map>
 
24
# define INK_UNORDERED_SET std::tr1::unordered_set
 
25
# define INK_UNORDERED_MAP std::tr1::unordered_map
 
26
# define INK_HASH std::tr1::hash
 
27
 
 
28
#elif defined(HAVE_BOOST_UNORDERED_SET)
 
29
# include <boost/unordered_set.hpp>
 
30
# include <boost/unordered_map.hpp>
 
31
# define INK_UNORDERED_SET boost::unordered_set
 
32
# define INK_UNORDERED_MAP boost::unordered_map
 
33
# define INK_HASH boost::hash
 
34
 
 
35
#elif defined(HAVE_EXT_HASH_SET)
 
36
 
 
37
# include <functional>
 
38
# include <ext/hash_set>
 
39
# include <ext/hash_map>
 
40
# define INK_UNORDERED_SET __gnu_cxx::hash_set
 
41
# define INK_UNORDERED_MAP __gnu_cxx::hash_map
 
42
# define INK_HASH __gnu_cxx::hash
 
43
 
 
44
namespace __gnu_cxx {
 
45
// hash function for pointers
 
46
// TR1 and Boost have this defined by default, __gnu_cxx doesn't
 
47
template<typename T>
 
48
struct hash<T *> : public std::unary_function<T *, std::size_t> {
 
49
    std::size_t operator()(T *p) const {
 
50
        // Taken from Boost
 
51
        std::size_t x = static_cast<std::size_t>(reinterpret_cast<std::ptrdiff_t>(p));
 
52
        return x + (x >> 3);
 
53
    }
 
54
};
 
55
} // namespace __gnu_cxx
 
56
#endif
 
57
 
 
58
#else
 
59
/// Name (with namespace) of the unordered set template.
 
60
#define INK_UNORDERED_SET
 
61
/// Name (with namespace) of the unordered map template.
 
62
#define INK_UNORDERED_MAP
 
63
/// Name (with namespace) of the hash template.
 
64
#define INK_HASH
 
65
 
 
66
#endif
 
67
 
 
68
#endif // SEEN_SET_TYPES_H
 
69
/*
 
70
  Local Variables:
 
71
  mode:c++
 
72
  c-file-style:"stroustrup"
 
73
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
 
74
  indent-tabs-mode:nil
 
75
  fill-column:99
 
76
  End:
 
77
*/
 
78
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :