diff options
author | Karl Berry <karl@freefriends.org> | 2018-01-17 22:50:15 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-01-17 22:50:15 +0000 |
commit | e7dfe5ab98e759081fc73990ed6c1ac6910a105d (patch) | |
tree | 1635f79c86856a6aa57a45b8b952b651ef9fcba9 /Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.hpp | |
parent | ae542350b1e3add10d4ee3d7b68f610132f31a50 (diff) |
dvisvgm 2.3.1 (patched)
git-svn-id: svn://tug.org/texlive/trunk@46352 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.hpp')
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.hpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.hpp index 919881811a4..250ebef082b 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/SpecialManager.hpp @@ -2,7 +2,7 @@ ** SpecialManager.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2018 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -21,25 +21,24 @@ #ifndef SPECIALMANAGER_HPP #define SPECIALMANAGER_HPP -#include <map> +#include <memory> #include <ostream> #include <string> +#include <unordered_map> #include <vector> #include "SpecialHandler.hpp" class SpecialActions; -class SpecialManager -{ +class SpecialManager { private: - typedef std::vector<SpecialHandler*> HandlerPool; - typedef std::map<std::string,SpecialHandler*> HandlerMap; + using HandlerPool = std::vector<std::unique_ptr<SpecialHandler>>; + using HandlerMap = std::unordered_map<std::string,SpecialHandler*>; public: - ~SpecialManager (); static SpecialManager& instance (); - void registerHandler (SpecialHandler *handler); - void registerHandlers (SpecialHandler **handlers, const char *ignorelist); + void registerHandler (std::unique_ptr<SpecialHandler> &&handler); + void registerHandlers (std::vector<std::unique_ptr<SpecialHandler>> &handlers, const char *ignorelist); void unregisterHandlers (); void preprocess (const std::string &special, SpecialActions &actions) const; bool process (const std::string &special, double dvi2bp, SpecialActions &actions) const; @@ -48,15 +47,16 @@ class SpecialManager void notifyEndPage (unsigned pageno, SpecialActions &actions) const; void notifyPositionChange (double x, double y, SpecialActions &actions) const; void writeHandlerInfo (std::ostream &os) const; + SpecialHandler* findHandlerByName (const std::string &name) const; protected: - SpecialManager () {} - SpecialManager (const SpecialManager &) {} - SpecialHandler* findHandler (const std::string &prefix) const; + SpecialManager () =default; + SpecialManager (const SpecialManager &) =delete; + SpecialHandler* findHandlerByPrefix (const std::string &prefix) const; private: - HandlerPool _pool; ///< stores pointers to all handlers - HandlerMap _handlers; ///< pointers to handlers for corresponding prefixes + HandlerPool _handlerPool; ///< stores pointers to all handlers + HandlerMap _handlersByPrefix; ///< pointers to handlers for corresponding prefixes std::vector<DVIPreprocessingListener*> _preprocListeners; std::vector<DVIBeginPageListener*> _beginPageListeners; std::vector<DVIEndPageListener*> _endPageListeners; |