summaryrefslogtreecommitdiffstats
path: root/src/libnr
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2010-08-05 00:49:51 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2010-08-05 00:49:51 +0000
commit77dc5f1acd4a6b66b2d6fc5c81f7e5c61ef95785 (patch)
tree15c3b32afa8a124f69644c8bd279dd361680974e /src/libnr
parentWholesale cruft removal part 3 (diff)
downloadinkscape-77dc5f1acd4a6b66b2d6fc5c81f7e5c61ef95785.tar.gz
inkscape-77dc5f1acd4a6b66b2d6fc5c81f7e5c61ef95785.zip
Wholesale cruft removal part 4; fix crash when rendering guides
(bzr r9508.1.48)
Diffstat (limited to 'src/libnr')
-rw-r--r--src/libnr/Makefile_insert2
-rw-r--r--src/libnr/nr-maybe.h201
-rw-r--r--src/libnr/nr-path-code.h28
3 files changed, 0 insertions, 231 deletions
diff --git a/src/libnr/Makefile_insert b/src/libnr/Makefile_insert
index 6afef39ef..0a9b99e1e 100644
--- a/src/libnr/Makefile_insert
+++ b/src/libnr/Makefile_insert
@@ -13,10 +13,8 @@ ink_common_sources += \
libnr/nr-forward.h \
libnr/nr-i-coord.h \
libnr/nr-macros.h \
- libnr/nr-maybe.h \
libnr/nr-object.cpp \
libnr/nr-object.h \
- libnr/nr-path-code.h \
libnr/nr-pixblock-pattern.cpp \
libnr/nr-pixblock-pattern.h \
libnr/nr-pixblock.cpp \
diff --git a/src/libnr/nr-maybe.h b/src/libnr/nr-maybe.h
deleted file mode 100644
index 6071a60ad..000000000
--- a/src/libnr/nr-maybe.h
+++ /dev/null
@@ -1,201 +0,0 @@
-#ifndef __NR_MAYBE_H__
-#define __NR_MAYBE_H__
-
-/*
- * Nullable values for C++
- *
- * Copyright 2004, 2007 MenTaLguY <mental@rydia.net>
- *
- * This code is licensed under the GNU GPL; see COPYING for more information.
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdexcept>
-#include <string>
-#include <algorithm>
-
-namespace NR {
-
-class IsNothing : public std::domain_error {
-public:
- IsNothing() : domain_error(std::string("Is nothing")) {}
-};
-
-struct Nothing {};
-
-template <typename T>
-class MaybeStorage {
-public:
- MaybeStorage() : _is_nothing(true) {}
- MaybeStorage(T const &value)
- : _value(value), _is_nothing(false) {}
-
- bool is_nothing() const { return _is_nothing; }
- T &value() { return _value; }
- T const &value() const { return _value; }
-
-private:
- T _value;
- bool _is_nothing;
-};
-
-template <typename T>
-class Maybe {
-public:
- Maybe() {}
- Maybe(Nothing) {}
- Maybe(T const &t) : _storage(t) {}
- Maybe(Maybe const &m) : _storage(m._storage) {}
-
- template <typename T2>
- Maybe(Maybe<T2> const &m) {
- if (m) {
- _storage = *m;
- }
- }
-
- template <typename T2>
- Maybe(Maybe<T2 const &> m) {
- if (m) {
- _storage = *m;
- }
- }
-
- operator bool() const { return !_storage.is_nothing(); }
-
- T const &operator*() const throw(IsNothing) {
- if (_storage.is_nothing()) {
- throw IsNothing();
- } else {
- return _storage.value();
- }
- }
- T &operator*() throw(IsNothing) {
- if (_storage.is_nothing()) {
- throw IsNothing();
- } else {
- return _storage.value();
- }
- }
-
- T const *operator->() const throw(IsNothing) {
- if (_storage.is_nothing()) {
- throw IsNothing();
- } else {
- return &_storage.value();
- }
- }
- T *operator->() throw(IsNothing) {
- if (_storage.is_nothing()) {
- throw IsNothing();
- } else {
- return &_storage.value();
- }
- }
-
- template <typename T2>
- bool operator==(Maybe<T2> const &other) const {
- bool is_nothing = _storage.is_nothing();
- if ( is_nothing || !other ) {
- return is_nothing && !other;
- } else {
- return _storage.value() == *other;
- }
- }
- template <typename T2>
- bool operator!=(Maybe<T2> const &other) const {
- bool is_nothing = _storage.is_nothing();
- if ( is_nothing || !other ) {
- return !is_nothing || other;
- } else {
- return _storage.value() != *other;
- }
- }
-
-private:
- MaybeStorage<T> _storage;
-};
-
-template <typename T>
-class Maybe<T &> {
-public:
- Maybe() : _ref(NULL) {}
- Maybe(Nothing) : _ref(NULL) {}
- Maybe(T &t) : _ref(&t) {}
-
- template <typename T2>
- Maybe(Maybe<T2> const &m) {
- if (m) {
- _ref = &*m;
- }
- }
-
- template <typename T2>
- Maybe(Maybe<T2 &> m) {
- if (m) {
- _ref = *m;
- }
- }
-
- template <typename T2>
- Maybe(Maybe<T2 const &> m) {
- if (m) {
- _ref = *m;
- }
- }
-
- operator bool() const { return _ref; }
-
- T &operator*() const throw(IsNothing) {
- if (!_ref) {
- throw IsNothing();
- } else {
- return *_ref;
- }
- }
- T *operator->() const throw(IsNothing) {
- if (!_ref) {
- throw IsNothing();
- } else {
- return _ref;
- }
- }
-
- template <typename T2>
- bool operator==(Maybe<T2> const &other) const {
- if ( !_ref || !other ) {
- return !_ref && !other;
- } else {
- return *_ref == *other;
- }
- }
- template <typename T2>
- bool operator!=(Maybe <T2> const &other) const {
- if ( !_ref || !other ) {
- return _ref || other;
- } else {
- return *_ref != *other;
- }
- }
-
-private:
- T *_ref;
-};
-
-} /* namespace NR */
-
-#endif
-
-/*
- 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 :
diff --git a/src/libnr/nr-path-code.h b/src/libnr/nr-path-code.h
deleted file mode 100644
index cc174d73b..000000000
--- a/src/libnr/nr-path-code.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef SEEN_LIBNR_NR_PATH_CODE_H
-#define SEEN_LIBNR_NR_PATH_CODE_H
-
-/** \file
- * NRPathcode enum definition
- */
-
-typedef enum {
- NR_MOVETO, ///< Start of closed subpath
- NR_MOVETO_OPEN, ///< Start of open subpath
- NR_CURVETO, ///< Bezier curve segment
- NR_LINETO, ///< Line segment
- NR_END ///< End record
-} NRPathcode;
-
-
-#endif /* !SEEN_LIBNR_NR_PATH_CODE_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 :