summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a7f77cf)
raw | patch | inline | side by side (parent: a7f77cf)
author | Jon A. Cruz <jon@joncruz.org> | |
Thu, 4 Mar 2010 08:44:53 +0000 (00:44 -0800) | ||
committer | Jon A. Cruz <jon@joncruz.org> | |
Thu, 4 Mar 2010 08:44:53 +0000 (00:44 -0800) |
configure.ac | patch | blob | history | |
src/libnrtype/FontFactory.cpp | patch | blob | history | |
src/libnrtype/FontInstance.cpp | patch | blob | history | |
src/ui/tool/control-point-selection.h | patch | blob | history | |
src/ui/tool/multi-path-manipulator.cpp | patch | blob | history | |
src/util/Makefile_insert | patch | blob | history | |
src/util/set-types.h | [new file with mode: 0644] | patch | blob |
diff --git a/configure.ac b/configure.ac
index 5613f49a8fc035a48609d521dc579f7a7ddffe2d..8a8a5a702fb9543f5f9f554a3d72f35a0c53cd86 100644 (file)
--- a/configure.ac
+++ b/configure.ac
fi
fi
+# Test for various hash_set/unordered_set issues:
+# This is a system header so we check it as soon as possible
+AC_CHECK_HEADER(tr1/unordered_set,
+ AC_MSG_CHECKING([TR1 unordered_set usability])
+ AC_COMPILE_IFELSE([
+#include <tr1/unordered_set>
+int main() {
+ std::tr1::unordered_set<int> i, j;
+ i = j;
+ return 0;
+}
+], [unordered_set_broken=no], [unordered_set_broken=yet])
+if test "x$unordered_set_broken" = "xyes"; then
+ AC_MSG_RESULT([broken])
+else
+ AC_MSG_RESULT([ok])
+ AC_DEFINE(HAVE_TR1_UNORDERED_SET, 1, [Has the standard TR1 unordered_set])
+fi
+, [])
+
+AC_CHECK_HEADER(ext/hash_set, AC_DEFINE(HAVE_EXT_HASH_SET, 1, [Legacy ext/hash_set]), [])
+AC_CHECK_HEADER(unordered_set, AC_DEFINE(HAVE_UNORDERED_SET, 1, [Legacy unordered_set]), [])
+
+
# Test whether GCC emits a spurious warning when using boost::optional
# If yes, turn off strict aliasing warnings to reduce noise
# and allow the legitimate warnings to stand out
index d6fc207b0d92bccab054e71ed7c0653d58b9c59d..8ab2ee6962f69b900e6645b43c71fec75ce90271 100644 (file)
/* Freetype2 */
# include <pango/pangoft2.h>
-#include <boost/unordered_map.hpp>
+#include "util/set-types.h"
-typedef boost::unordered_map<PangoFontDescription*, font_instance*, font_descr_hash, font_descr_equal> FaceMapType;
+typedef optim_map<PangoFontDescription*, font_instance*, font_descr_hash, font_descr_equal> FaceMapType;
// need to avoid using the size field
size_t font_descr_hash::operator()( PangoFontDescription *const &x) const {
index 557e9106e4b0d278c06391753334adce016ab3cf..61cd281901e00b75f0190a44ef0b2b862076ad0c 100644 (file)
# include FT_TRUETYPE_TABLES_H
# include <pango/pangoft2.h>
-#include <boost/unordered_map.hpp>
+#include "util/set-types.h"
struct font_style_hash : public std::unary_function<font_style, size_t> {
bool operator()(font_style const &a, font_style const &b) const;
};
-typedef boost::unordered_map<font_style, raster_font*, font_style_hash, font_style_equal> StyleMap;
+typedef optim_map<font_style, raster_font*, font_style_hash, font_style_equal> StyleMap;
index b3c2f422bd5a12256a4e7d6ebef0ef19fb926538..6efb63b67573e1aebfa02651c3f7282b51b28026 100644 (file)
#include <memory>
#include <boost/optional.hpp>
-#include <boost/unordered_set.hpp>
-#include <boost/unordered_map.hpp>
+#include "util/set-types.h"
#include <sigc++/sigc++.h>
#include <2geom/forward.h>
#include <2geom/point.h>
}
}
+#ifdef USE_GNU_HASHES
+namespace __gnu_cxx {
+template<>
+struct hash<Inkscape::UI::SelectableControlPoint*> {
+ size_t operator()(Inkscape::UI::SelectableControlPoint *p) const {
+ return reinterpret_cast<size_t>(p);
+ }
+};
+} // namespace __gnu_cxx
+#endif // USE_GNU_HASHES
+
namespace Inkscape {
namespace UI {
public:
ControlPointSelection(SPDesktop *d, SPCanvasGroup *th_group);
~ControlPointSelection();
- typedef boost::unordered_set< SelectableControlPoint * > set_type;
+ typedef optim_set< SelectableControlPoint * > set_type;
typedef set_type Set; // convenience alias
typedef set_type::iterator iterator;
void erase(iterator first, iterator last);
// find
- iterator find(const key_type &k) { return _points.find(k); }
+ iterator find(const key_type &k) {
+ return _points.find(k);
+ }
// Sometimes it is very useful to keep a list of all selectable points.
set_type const &allPoints() const { return _all_points; }
set_type _points;
set_type _all_points;
- boost::unordered_map<SelectableControlPoint *, Geom::Point> _original_positions;
+ optim_map<SelectableControlPoint *, Geom::Point> _original_positions;
boost::optional<double> _rot_radius;
boost::optional<double> _mouseover_rot_radius;
Geom::OptRect _bounds;
index 3b0852e6e6842e4f9f7befcf429ba0a04dc95c85..d86a7e9e08cd8eee6906b0aa288a765ab5a5c797 100644 (file)
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#include <boost/unordered_set.hpp>
+#include "util/set-types.h"
#include <boost/shared_ptr.hpp>
#include <glib.h>
#include <glibmm/i18n.h>
#include "ui/tool/multi-path-manipulator.h"
#include "ui/tool/path-manipulator.h"
+#ifdef USE_GNU_HASHES
+namespace __gnu_cxx {
+template<>
+struct hash<Inkscape::UI::NodeList::iterator> {
+ size_t operator()(Inkscape::UI::NodeList::iterator const &n) const {
+ return reinterpret_cast<size_t>(n.ptr());
+ }
+};
+} // namespace __gnu_cxx
+#endif // USE_GNU_HASHES
+
namespace Inkscape {
namespace UI {
namespace {
typedef std::pair<NodeList::iterator, NodeList::iterator> IterPair;
typedef std::vector<IterPair> IterPairList;
-typedef boost::unordered_set<NodeList::iterator> IterSet;
+typedef optim_set<NodeList::iterator> IterSet;
typedef std::multimap<double, IterPair> DistanceMap;
typedef std::pair<double, IterPair> DistanceMapItem;
index 87a974768a9162a16f4e712d0d4c9edbd46081ff..3d3c88940e97cd53dcd1a083610ad261f6a2420b 100644 (file)
--- a/src/util/Makefile_insert
+++ b/src/util/Makefile_insert
util/map-list.h \
util/mathfns.h \
util/reverse-list.h \
+ util/set-types.h \
util/share.h \
util/share.cpp \
util/tuple.h \
diff --git a/src/util/set-types.h b/src/util/set-types.h
--- /dev/null
+++ b/src/util/set-types.h
@@ -0,0 +1,55 @@
+#ifndef SEEN_SET_TYPES_H
+#define SEEN_SET_TYPES_H
+
+
+/** @file
+ * Simple wrapper to disambiguate hash/unordered lists & sets.
+ */
+/* Authors:
+ * Jon A. Cruz <jon@joncruz.org>
+ *
+ * Copyright (C) 2010 Authors
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#if defined(HAVE_TR1_UNORDERED_SET)
+
+# include <tr1/unordered_set>
+# include <tr1/unordered_map>
+# define optim_set std::tr1::unordered_set
+# define optim_map std::tr1::unordered_map
+
+// TODO test on platform with this detected:
+//#elif defined(HAVE_UNORDERED_SET)
+//
+//# include <unordered_set>
+//# include <unordered_map>
+//#define optim_set std::unordered_set
+//#define optim_map std::unordered_map
+
+#elif defined(HAVE_EXT_HASH_SET)
+
+# include <ext/hash_set>
+# include <ext/hash_map>
+# define optim_set __gnu_cxx::hash_set
+# define optim_map __gnu_cxx::hash_map
+# define USE_GNU_HASHES 1
+
+#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:encoding=utf-8:textwidth=99 :