diff options
author | Norbert Preining <norbert@preining.info> | 2019-11-16 03:00:48 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-11-16 03:00:48 +0000 |
commit | bad81a00a2943d1fb7ff2de3d0ae48c049dac302 (patch) | |
tree | ca23b6ca941037d20dce638d0859309f3c48c66d /dviware/dvisvgm/src/optimizer/AttributeExtractor.hpp | |
parent | 0e223aaa93c5ee0c0e937c23f75535269324d217 (diff) |
CTAN sync 201911160300
Diffstat (limited to 'dviware/dvisvgm/src/optimizer/AttributeExtractor.hpp')
-rw-r--r-- | dviware/dvisvgm/src/optimizer/AttributeExtractor.hpp | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/dviware/dvisvgm/src/optimizer/AttributeExtractor.hpp b/dviware/dvisvgm/src/optimizer/AttributeExtractor.hpp index 8cb9de5bab..c882e8b4c8 100644 --- a/dviware/dvisvgm/src/optimizer/AttributeExtractor.hpp +++ b/dviware/dvisvgm/src/optimizer/AttributeExtractor.hpp @@ -27,35 +27,32 @@ /** Moves common attributes of adjacent elements to enclosing groups. */ class AttributeExtractor : public OptimizerModule { - friend class GroupCollapser; - using Attribute = XMLElement::Attribute; + using Attribute = XMLElement::Attribute; - /** Represents a range of adjacent nodes where all elements have a common attribute. */ - struct AttributeRun { - public: - AttributeRun (const Attribute &attr, XMLElement *first); - XMLNode* first () {return _first;} - XMLNode* last () {return _last;} -// XMLNodeIterator begin () {return XMLNodeIterator(_first);} -// XMLNodeIterator end () {return XMLNodeIterator(_last);} - int length () const {return _length;} + /** Represents a range of adjacent nodes where all elements have a common attribute. */ + struct AttributeRun { + public: + AttributeRun (const Attribute &attr, XMLElement *first); + XMLNode* first () {return _first;} + XMLNode* last () {return _last;} + int length () const {return _length;} - private: - int _length; ///< run length excluding non-element nodes - XMLNode *_first, *_last; ///< first and last node in run - }; + private: + int _length; ///< run length excluding non-element nodes + XMLNode *_first, *_last; ///< first and last node in run + }; public: void execute (XMLElement*, XMLElement *context) override {execute(context, true);}; const char* info () const override; + static bool groupable (const XMLElement &elem); + static bool inheritable (const Attribute &attrib); + static bool extractable (const Attribute &attr, XMLElement &element); protected: void execute (XMLElement *context, bool recurse); XMLNode* extractAttribute (XMLElement *elem); bool extracted (const Attribute &attr) const; - static bool groupable (const XMLElement &elem); - static bool inheritable (const Attribute &attrib); - static bool extractable (const Attribute &attr, XMLElement &element); private: std::set<std::string> _extractedAttributes; |