Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::Extension::Internal::StyleMemory Class Reference

#include <remember-styles.h>

Public Member Functions

 StyleMemory (std::set< SPAttr > remember_attrs)
 Construct a new style memeory and ask for specific attrs.
 
StyleMap get_changes (SPStyle const *style) const
 Return a StyleMap of all the differences between the state and the given style.
 
StyleMap get_changes_and_remember (SPStyle const *style)
 Modify the changes scope without managing the FILO stack.
 
StyleMap get_ifset (SPStyle const *style) const
 Return a StyleMap of all the set styles, filtered in the same way as get_changes.
 
StyleMap const & get_state () const
 Get the current state map, empty if nothing is on the stack or contains every attr at the current state.
 
auto remember (StyleMap map)
 Add the given map to the stack and return a scoped object.
 

Private Member Functions

void _push (StyleMap changes)
 

Private Attributes

std::set< SPAttr > const _attrs
 
std::stack< StyleMap_changes
 

Detailed Description

Definition at line 30 of file remember-styles.h.

Constructor & Destructor Documentation

◆ StyleMemory()

Inkscape::Extension::Internal::StyleMemory::StyleMemory ( std::set< SPAttr remember_attrs)
inlineexplicit

Construct a new style memeory and ask for specific attrs.

Parameters
remember_attrs- A set of SPAttr enums to keep track of.

Definition at line 38 of file remember-styles.h.

References _changes.

Member Function Documentation

◆ _push()

void Inkscape::Extension::Internal::StyleMemory::_push ( StyleMap  changes)
inlineprivate

Definition at line 100 of file remember-styles.h.

References _changes, current, and get_state().

Referenced by get_changes_and_remember(), and remember().

◆ get_changes()

StyleMap Inkscape::Extension::Internal::StyleMemory::get_changes ( SPStyle const *  style) const

Return a StyleMap of all the differences between the state and the given style.

Parameters
style- The SPStyle to compare to.
Returns
A delta map containing only elements that have changed.

Definition at line 17 of file remember-styles.cpp.

References _attrs, current, get_state(), map, and SPStyle::properties().

Referenced by get_changes_and_remember().

◆ get_changes_and_remember()

StyleMap Inkscape::Extension::Internal::StyleMemory::get_changes_and_remember ( SPStyle const *  style)
inline

Modify the changes scope without managing the FILO stack.

Definition at line 56 of file remember-styles.h.

References _push(), and get_changes().

Referenced by Inkscape::Extension::Internal::PdfBuilder::DrawContext::paint_text_layout().

◆ get_ifset()

StyleMap Inkscape::Extension::Internal::StyleMemory::get_ifset ( SPStyle const *  style) const

◆ get_state()

StyleMap const & Inkscape::Extension::Internal::StyleMemory::get_state ( ) const
inline

Get the current state map, empty if nothing is on the stack or contains every attr at the current state.

Not just the last delta

Returns
A full attribute state map.

Definition at line 74 of file remember-styles.h.

References _changes.

Referenced by _push(), and get_changes().

◆ remember()

auto Inkscape::Extension::Internal::StyleMemory::remember ( StyleMap  map)
inline

Add the given map to the stack and return a scoped object.

The stack Will be automatically returned when the scope object is deleted.

Parameters
map- The StyleMap delta to add to the stack generated by get_changes()
Returns
A scope object for managing the stack.

Definition at line 87 of file remember-styles.h.

References _changes, _push(), and map.

Referenced by Inkscape::Extension::Internal::PdfBuilder::Document::get_tiling_pattern(), and Inkscape::Extension::Internal::PdfBuilder::DrawContext::paint_item().

Member Data Documentation

◆ _attrs

std::set<SPAttr> const Inkscape::Extension::Internal::StyleMemory::_attrs
private

Definition at line 95 of file remember-styles.h.

Referenced by get_changes().

◆ _changes

std::stack<StyleMap> Inkscape::Extension::Internal::StyleMemory::_changes
private

Definition at line 98 of file remember-styles.h.

Referenced by _push(), get_state(), remember(), and StyleMemory().


The documentation for this class was generated from the following files: