Krita Source Code Documentation
Loading...
Searching...
No Matches
SvgParser::DeferredUseStore Struct Reference

Classes

struct  El
 

Public Member Functions

void add (const QDomElement *useE, const QString &key)
 
void checkPendingUse (const QDomElement &b, QList< KoShape * > &shapes)
 
 DeferredUseStore (SvgParser *p)
 
bool empty () const
 
 ~DeferredUseStore ()
 

Public Attributes

SvgParserm_parse
 
std::vector< Elm_uses
 

Detailed Description

Definition at line 71 of file SvgParser.cpp.

Constructor & Destructor Documentation

◆ DeferredUseStore()

SvgParser::DeferredUseStore::DeferredUseStore ( SvgParser * p)
inline

Definition at line 79 of file SvgParser.cpp.

79 :
80 m_parse(p) {
81 }
const Params2D p

◆ ~DeferredUseStore()

SvgParser::DeferredUseStore::~DeferredUseStore ( )
inline

Definition at line 114 of file SvgParser.cpp.

114 {
115 while (!m_uses.empty()) {
116 const El& el = m_uses.back();
117 debugFlake << "WARNING: could not find path in <use xlink:href=\"#xxxxx\" expression. Losing data here. Key:"
118 << el.m_key;
119 m_uses.pop_back();
120 }
121 }
#define debugFlake
Definition FlakeDebug.h:15
std::vector< El > m_uses

References debugFlake, SvgParser::DeferredUseStore::El::m_key, and m_uses.

Member Function Documentation

◆ add()

void SvgParser::DeferredUseStore::add ( const QDomElement * useE,
const QString & key )
inline

Definition at line 83 of file SvgParser.cpp.

83 {
84 m_uses.push_back(El(useE, key));
85 }

References m_uses.

◆ checkPendingUse()

void SvgParser::DeferredUseStore::checkPendingUse ( const QDomElement & b,
QList< KoShape * > & shapes )
inline

Definition at line 90 of file SvgParser.cpp.

90 {
91 KoShape* shape = 0;
92 const QString id = b.attribute("id");
93
94 if (id.isEmpty())
95 return;
96
97 // debugFlake << "Checking id: " << id;
98 auto i = std::partition(m_uses.begin(), m_uses.end(),
99 [&](const El& e) -> bool {return e.m_key != id;});
100
101 while (i != m_uses.end()) {
102 const El& el = m_uses.back();
103 if (m_parse->m_context.hasDefinition(el.m_key)) {
104 // debugFlake << "Found pending use for id: " << el.m_key;
105 shape = m_parse->resolveUse(*(el.m_useElement), el.m_key);
106 if (shape) {
107 shapes.append(shape);
108 }
109 }
110 m_uses.pop_back();
111 }
112 }
bool hasDefinition(const QString &id) const
Checks if a definition with the specified id exists.
QList< KoShape * > shapes() const
Returns the list of all shapes of the svg document.
SvgLoadingContext m_context
Definition SvgParser.h:229
KoShape * resolveUse(const QDomElement &e, const QString &key)

References SvgLoadingContext::hasDefinition(), SvgParser::m_context, SvgParser::DeferredUseStore::El::m_key, m_parse, SvgParser::DeferredUseStore::El::m_useElement, m_uses, SvgParser::resolveUse(), and SvgParser::shapes().

◆ empty()

bool SvgParser::DeferredUseStore::empty ( ) const
inline

Definition at line 86 of file SvgParser.cpp.

86 {
87 return m_uses.empty();
88 }

References m_uses.

Member Data Documentation

◆ m_parse

SvgParser* SvgParser::DeferredUseStore::m_parse

Definition at line 122 of file SvgParser.cpp.

◆ m_uses

std::vector<El> SvgParser::DeferredUseStore::m_uses

Definition at line 123 of file SvgParser.cpp.


The documentation for this struct was generated from the following file: