summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLiam P. White <inkscapebrony@gmail.com>2015-02-25 01:05:17 +0000
committerLiam P. White <inkscapebrony@gmail.com>2015-02-25 01:05:17 +0000
commit982ffe6c01c8856c62c157ebafb3f59fad09efa5 (patch)
tree3cdc3ab634462b61ee20d7fa2432d8e531a5dedf /src
parentStrip ToolFactory (diff)
downloadinkscape-982ffe6c01c8856c62c157ebafb3f59fad09efa5.tar.gz
inkscape-982ffe6c01c8856c62c157ebafb3f59fad09efa5.zip
Kill factory.h
(bzr r13939.1.3)
Diffstat (limited to 'src')
-rw-r--r--src/factory.h95
1 files changed, 0 insertions, 95 deletions
diff --git a/src/factory.h b/src/factory.h
deleted file mode 100644
index 6b448064e..000000000
--- a/src/factory.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/** @file
- * Generic Factory
- *//*
- * Authors:
- * Markus Engel
- *
- * Copyright (C) 2013 Authors
- * Released under GNU GPL, read the file 'COPYING' for more information
- */
-
-#ifndef FACTORY_H_SEEN
-#define FACTORY_H_SEEN
-
-#include <exception>
-#include <map>
-#include <string>
-#include "xml/node.h"
-
-/**
- * A simple singleton implementation.
- */
-template <class T>
-struct Singleton {
- static T &instance() {
- static T inst;
- return inst;
- }
-};
-
-namespace FactoryExceptions {
-class TypeNotRegistered : public std::exception {
-public:
- TypeNotRegistered(std::string const &type)
- : std::exception()
- , _type_string(type) {
- }
-
- virtual ~TypeNotRegistered() throw() {
- }
-
- char const *what() const throw() {
- return _type_string.c_str();
- }
-
-private:
- std::string const _type_string;
-};
-} // namespace FactoryExceptions
-
-/**
- * A Factory for creating objects which can be identified by strings.
- */
-template <class BaseObject>
-class Factory {
-public:
- typedef BaseObject *CreateFunction();
-
- bool registerObject(std::string const &id, CreateFunction *creator) {
- return this->_object_map.insert(std::make_pair(id, creator)).second;
- }
-
- BaseObject *createObject(std::string const &id) const {
- typename std::map<std::string const, CreateFunction *>::const_iterator it = this->_object_map.find(id);
-
- if (it == this->_object_map.end()) {
- //throw FactoryExceptions::TypeNotRegistered(id);
- if (!(id.empty() // comments, usually
- || id == "rdf:RDF" // no SP node yet
- || id == "inkscape:clipboard" // SP node not necessary
- || id == "inkscape:_templateinfo")) {
- g_warning("unknown type: %s", id.c_str());
- }
- return NULL;
- }
-
- return it->second();
- }
-
-private:
- std::map<std::string const, CreateFunction *> _object_map;
-};
-
-
-#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:fileencoding=utf-8:textwidth=99 :