From ddffc1a8ab9e3357a8e0350ff08b5ef1a9fb2651 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Fri, 19 Oct 2018 00:53:43 +0200 Subject: Remove util/unordered-containers.h aliases. --- src/libnrtype/FontFactory.cpp | 5 ++-- src/libnrtype/FontInstance.cpp | 1 - src/ui/tool/control-point-selection.h | 9 +++--- src/ui/tool/multi-path-manipulator.cpp | 6 ++-- src/util/CMakeLists.txt | 1 - src/util/units.cpp | 5 ++-- src/util/units.h | 20 ++++++++++--- src/util/unordered-containers.h | 54 ---------------------------------- 8 files changed, 31 insertions(+), 70 deletions(-) delete mode 100644 src/util/unordered-containers.h diff --git a/src/libnrtype/FontFactory.cpp b/src/libnrtype/FontFactory.cpp index cfa37bb97..74b68fc3f 100644 --- a/src/libnrtype/FontFactory.cpp +++ b/src/libnrtype/FontFactory.cpp @@ -16,6 +16,8 @@ #define PANGO_ENABLE_ENGINE #endif +#include + #include #include @@ -25,13 +27,12 @@ #include #include "io/sys.h" -#include "util/unordered-containers.h" #include "libnrtype/FontFactory.h" #include "libnrtype/font-instance.h" #include "libnrtype/OpenTypeUtil.h" -typedef INK_UNORDERED_MAP FaceMapType; +typedef std::unordered_map FaceMapType; // need to avoid using the size field size_t font_descr_hash::operator()( PangoFontDescription *const &x) const { diff --git a/src/libnrtype/FontInstance.cpp b/src/libnrtype/FontInstance.cpp index 88339a60e..7358deac0 100644 --- a/src/libnrtype/FontInstance.cpp +++ b/src/libnrtype/FontInstance.cpp @@ -32,7 +32,6 @@ #include <2geom/path-sink.h> #include "libnrtype/font-glyph.h" #include "libnrtype/font-instance.h" -#include "util/unordered-containers.h" #ifndef USE_PANGO_WIN32 diff --git a/src/ui/tool/control-point-selection.h b/src/ui/tool/control-point-selection.h index 192e273e0..046b98649 100644 --- a/src/ui/tool/control-point-selection.h +++ b/src/ui/tool/control-point-selection.h @@ -14,13 +14,14 @@ #include #include +#include +#include #include #include #include #include <2geom/forward.h> #include <2geom/point.h> #include <2geom/rect.h> -#include "util/unordered-containers.h" #include "ui/tool/commit-events.h" #include "ui/tool/manipulator.h" #include "snap-candidate.h" @@ -42,7 +43,7 @@ class ControlPointSelection : public Manipulator, public sigc::trackable { public: ControlPointSelection(SPDesktop *d, SPCanvasGroup *th_group); ~ControlPointSelection() override; - typedef INK_UNORDERED_SET set_type; + typedef std::unordered_set set_type; typedef set_type Set; // convenience alias typedef set_type::iterator iterator; @@ -144,8 +145,8 @@ private: set_type _points; set_type _all_points; - INK_UNORDERED_MAP _original_positions; - INK_UNORDERED_MAP _last_trans; + std::unordered_map _original_positions; + std::unordered_map _last_trans; boost::optional _rot_radius; boost::optional _mouseover_rot_radius; Geom::OptRect _bounds; diff --git a/src/ui/tool/multi-path-manipulator.cpp b/src/ui/tool/multi-path-manipulator.cpp index dd700d9b3..a92b129e9 100644 --- a/src/ui/tool/multi-path-manipulator.cpp +++ b/src/ui/tool/multi-path-manipulator.cpp @@ -10,6 +10,8 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include + #include #include @@ -39,13 +41,13 @@ struct hash_nodelist_iterator : public std::unary_function { std::size_t operator()(NodeList::iterator i) const { - return INK_HASH()(&*i); + return std::hash()(&*i); } }; typedef std::pair IterPair; typedef std::vector IterPairList; -typedef INK_UNORDERED_SET IterSet; +typedef std::unordered_set IterSet; typedef std::multimap DistanceMap; typedef std::pair DistanceMapItem; diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index b8c61e2fe..ce982eab3 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -35,7 +35,6 @@ set(util_SRC tuple.h ucompose.hpp units.h - unordered-containers.h ziptool.h ) diff --git a/src/util/units.cpp b/src/util/units.cpp index 35493bcbc..0308623d5 100644 --- a/src/util/units.cpp +++ b/src/util/units.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -81,7 +82,7 @@ unsigned const svg_length_lookup[] = { // maps unit codes obtained from their abbreviations to their SVGLength unit indexes -typedef INK_UNORDERED_MAP UnitCodeLookup; +typedef std::unordered_map UnitCodeLookup; UnitCodeLookup make_unit_code_lookup() { @@ -96,7 +97,7 @@ UnitCodeLookup const unit_code_lookup = make_unit_code_lookup(); -typedef INK_UNORDERED_MAP TypeMap; +typedef std::unordered_map TypeMap; /** A std::map that gives the data type value for the string version. * @todo consider hiding map behind hasFoo() and getFoo() type functions. */ diff --git a/src/util/units.h b/src/util/units.h index e4530d0c3..17c54eb4e 100644 --- a/src/util/units.h +++ b/src/util/units.h @@ -13,12 +13,24 @@ #ifndef INKSCAPE_UTIL_UNITS_H #define INKSCAPE_UTIL_UNITS_H -#include +#include #include #include #include <2geom/coord.h> #include "svg/svg-length.h" -#include "unordered-containers.h" + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +namespace std { +template <> +struct hash : public std::unary_function { + std::size_t operator()(Glib::ustring const &s) const { + return hash()(s.raw()); + } +}; +} // namespace std + +#endif namespace Inkscape { namespace Util { @@ -137,8 +149,8 @@ public: UnitTable(); virtual ~UnitTable(); - typedef INK_UNORDERED_MAP UnitMap; - typedef INK_UNORDERED_MAP UnitCodeMap; + typedef std::unordered_map UnitMap; + typedef std::unordered_map UnitCodeMap; /** Add a new unit to the table */ void addUnit(Unit const &u, bool primary); diff --git a/src/util/unordered-containers.h b/src/util/unordered-containers.h deleted file mode 100644 index 9d869142d..000000000 --- a/src/util/unordered-containers.h +++ /dev/null @@ -1,54 +0,0 @@ -/** @file - * @brief Compatibility wrapper for unordered containers. - */ -/* Authors: - * Jon A. Cruz - * Krzysztof KosiƄski - * - * Copyright (C) 2010 Authors - * Released under GNU GPL, read the file 'COPYING' for more information - */ - -#ifndef SEEN_INK_UTIL_UNORDERED_CONTAINERS_H -#define SEEN_INK_UTIL_UNORDERED_CONTAINERS_H - -#include - -#ifndef DOXYGEN_SHOULD_SKIP_THIS - -#include -#include -#define INK_UNORDERED_SET std::unordered_set -#define INK_UNORDERED_MAP std::unordered_map -#define INK_HASH std::hash - -namespace std { -template <> -struct hash : public std::unary_function { - std::size_t operator()(Glib::ustring const &s) const { - return hash()(s.raw()); - } -}; -} // namespace std - -#else -/// Name (with namespace) of the unordered set template. -#define INK_UNORDERED_SET -/// Name (with namespace) of the unordered map template. -#define INK_UNORDERED_MAP -/// Name (with namespace) of the hash template. -#define INK_HASH - -#endif - -#endif // SEEN_SET_TYPES_H -/* - Local Variables: - mode:c++ - c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) - indent-tabs-mode:nil - fill-column:99 - End: -*/ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : -- cgit v1.2.3