Qt 4.8
Public Functions | Public Variables | List of all members
QSvgAttributes Struct Reference

Public Functions

 QSvgAttributes (const QXmlStreamAttributes &xmlAttributes, QSvgHandler *handler)
 

Public Variables

QStringRef color
 
QStringRef colorOpacity
 
QStringRef compOp
 
QStringRef display
 
QStringRef fill
 
QStringRef fillOpacity
 
QStringRef fillRule
 
QStringRef fontFamily
 
QStringRef fontSize
 
QStringRef fontStyle
 
QStringRef fontVariant
 
QStringRef fontWeight
 
QString id
 
QVector< QSvgCssAttributem_cssAttributes
 
QStringRef offset
 
QStringRef opacity
 
QStringRef stopColor
 
QStringRef stopOpacity
 
QStringRef stroke
 
QStringRef strokeDashArray
 
QStringRef strokeDashOffset
 
QStringRef strokeLineCap
 
QStringRef strokeLineJoin
 
QStringRef strokeMiterLimit
 
QStringRef strokeOpacity
 
QStringRef strokeWidth
 
QStringRef textAnchor
 
QStringRef transform
 
QStringRef vectorEffect
 
QStringRef visibility
 

Detailed Description

Definition at line 160 of file qsvghandler.cpp.

Constructors and Destructors

◆ QSvgAttributes()

QSvgAttributes::QSvgAttributes ( const QXmlStreamAttributes xmlAttributes,
QSvgHandler handler 
)

Definition at line 198 of file qsvghandler.cpp.

Referenced by parseStyle().

199 {
200  QStringRef style = xmlAttributes.value(QLatin1String("style"));
201  if (!style.isEmpty()) {
202  handler->parseCSStoXMLAttrs(style.toString(), &m_cssAttributes);
203  for (int j = 0; j < m_cssAttributes.count(); ++j) {
204  const QSvgCssAttribute &attribute = m_cssAttributes.at(j);
205  QStringRef name = attribute.name;
206  QStringRef value = attribute.value;
207  if (name.isEmpty())
208  continue;
209 
210  switch (name.at(0).unicode()) {
211 
212  case 'c':
213  if (name == QLatin1String("color"))
214  color = value;
215  else if (name == QLatin1String("color-opacity"))
216  colorOpacity = value;
217  else if (name == QLatin1String("comp-op"))
218  compOp = value;
219  break;
220 
221  case 'd':
222  if (name == QLatin1String("display"))
223  display = value;
224  break;
225 
226  case 'f':
227  if (name == QLatin1String("fill"))
228  fill = value;
229  else if (name == QLatin1String("fill-rule"))
230  fillRule = value;
231  else if (name == QLatin1String("fill-opacity"))
232  fillOpacity = value;
233  else if (name == QLatin1String("font-family"))
234  fontFamily = value;
235  else if (name == QLatin1String("font-size"))
236  fontSize = value;
237  else if (name == QLatin1String("font-style"))
238  fontStyle = value;
239  else if (name == QLatin1String("font-weight"))
240  fontWeight = value;
241  else if (name == QLatin1String("font-variant"))
242  fontVariant = value;
243  break;
244 
245  case 'o':
246  if (name == QLatin1String("opacity"))
247  opacity = value;
248  else if (name == QLatin1String("offset"))
249  offset = value;
250  break;
251 
252  case 's':
253  if (name.length() > 5 && QStringRef(name.string(), name.position() + 1, 5) == QLatin1String("troke")) {
254  QStringRef strokeRef(name.string(), name.position() + 6, name.length() - 6);
255  if (strokeRef.isEmpty())
256  stroke = value;
257  else if (strokeRef == QLatin1String("-dasharray"))
258  strokeDashArray = value;
259  else if (strokeRef == QLatin1String("-dashoffset"))
260  strokeDashOffset = value;
261  else if (strokeRef == QLatin1String("-linecap"))
262  strokeLineCap = value;
263  else if (strokeRef == QLatin1String("-linejoin"))
264  strokeLineJoin = value;
265  else if (strokeRef == QLatin1String("-miterlimit"))
266  strokeMiterLimit = value;
267  else if (strokeRef == QLatin1String("-opacity"))
268  strokeOpacity = value;
269  else if (strokeRef == QLatin1String("-width"))
270  strokeWidth = value;
271  }
272  else if (name == QLatin1String("stop-color"))
273  stopColor = value;
274  else if (name == QLatin1String("stop-opacity"))
275  stopOpacity = value;
276  break;
277 
278  case 't':
279  if (name == QLatin1String("text-anchor"))
280  textAnchor = value;
281  else if (name == QLatin1String("transform"))
282  transform = value;
283  break;
284 
285  case 'v':
286  if (name == QLatin1String("vector-effect"))
287  vectorEffect = value;
288  else if (name == QLatin1String("visibility"))
289  visibility = value;
290  break;
291 
292  default:
293  break;
294  }
295  }
296  }
297 
298  for (int i = 0; i < xmlAttributes.count(); ++i) {
299  const QXmlStreamAttribute &attribute = xmlAttributes.at(i);
300  QStringRef name = attribute.qualifiedName();
301  if (name.isEmpty())
302  continue;
303  QStringRef value = attribute.value();
304 
305  switch (name.at(0).unicode()) {
306 
307  case 'c':
308  if (name == QLatin1String("color"))
309  color = value;
310  else if (name == QLatin1String("color-opacity"))
311  colorOpacity = value;
312  else if (name == QLatin1String("comp-op"))
313  compOp = value;
314  break;
315 
316  case 'd':
317  if (name == QLatin1String("display"))
318  display = value;
319  break;
320 
321  case 'f':
322  if (name == QLatin1String("fill"))
323  fill = value;
324  else if (name == QLatin1String("fill-rule"))
325  fillRule = value;
326  else if (name == QLatin1String("fill-opacity"))
327  fillOpacity = value;
328  else if (name == QLatin1String("font-family"))
329  fontFamily = value;
330  else if (name == QLatin1String("font-size"))
331  fontSize = value;
332  else if (name == QLatin1String("font-style"))
333  fontStyle = value;
334  else if (name == QLatin1String("font-weight"))
335  fontWeight = value;
336  else if (name == QLatin1String("font-variant"))
337  fontVariant = value;
338  break;
339 
340  case 'i':
341  if (name == QLatin1String("id"))
342  id = value.toString();
343  break;
344 
345  case 'o':
346  if (name == QLatin1String("opacity"))
347  opacity = value;
348  if (name == QLatin1String("offset"))
349  offset = value;
350  break;
351 
352  case 's':
353  if (name.length() > 5 && QStringRef(name.string(), name.position() + 1, 5) == QLatin1String("troke")) {
354  QStringRef strokeRef(name.string(), name.position() + 6, name.length() - 6);
355  if (strokeRef.isEmpty())
356  stroke = value;
357  else if (strokeRef == QLatin1String("-dasharray"))
358  strokeDashArray = value;
359  else if (strokeRef == QLatin1String("-dashoffset"))
360  strokeDashOffset = value;
361  else if (strokeRef == QLatin1String("-linecap"))
362  strokeLineCap = value;
363  else if (strokeRef == QLatin1String("-linejoin"))
364  strokeLineJoin = value;
365  else if (strokeRef == QLatin1String("-miterlimit"))
366  strokeMiterLimit = value;
367  else if (strokeRef == QLatin1String("-opacity"))
368  strokeOpacity = value;
369  else if (strokeRef == QLatin1String("-width"))
370  strokeWidth = value;
371  }
372  else if (name == QLatin1String("stop-color"))
373  stopColor = value;
374  else if (name == QLatin1String("stop-opacity"))
375  stopOpacity = value;
376  break;
377 
378  case 't':
379  if (name == QLatin1String("text-anchor"))
380  textAnchor = value;
381  else if (name == QLatin1String("transform"))
382  transform = value;
383  break;
384 
385  case 'v':
386  if (name == QLatin1String("vector-effect"))
387  vectorEffect = value;
388  else if (name == QLatin1String("visibility"))
389  visibility = value;
390  break;
391 
392  case 'x':
393  if (name == QLatin1String("xml:id") && id.isEmpty())
394  id = value.toString();
395  break;
396 
397  default:
398  break;
399  }
400  }
401 
402 }
QString toString() const
Returns a copy of the string reference as a QString object.
Definition: qstring.cpp:8653
QStringRef fontVariant
QXmlStreamStringRef name
Definition: qsvghandler_p.h:77
QStringRef vectorEffect
int length() const
Returns the number of characters referred to by the string reference.
Definition: qstring.h:1116
QStringRef fontStyle
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qchar.h:251
int count(const T &t) const
Returns the number of occurrences of value in the vector.
Definition: qvector.h:742
QStringRef strokeDashArray
QVector< QSvgCssAttribute > m_cssAttributes
QStringRef value() const
Returns the attribute&#39;s value.
Definition: qxmlstream.h:156
QStringRef visibility
QStringRef stopColor
QStringRef stroke
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
QStringRef fontWeight
QStringRef stopOpacity
QStringRef qualifiedName() const
Returns the attribute&#39;s qualified name.
Definition: qxmlstream.h:150
QStringRef value(const QString &namespaceUri, const QString &name) const
Returns the value of the attribute name in the namespace described with namespaceUri, or an empty string reference if the attribute is not defined.
QStringRef strokeDashOffset
QStringRef fontSize
The QXmlStreamAttribute class represents a single XML attribute.
Definition: qxmlstream.h:135
QStringRef compOp
QStringRef strokeMiterLimit
QStringRef offset
const char * name
bool isEmpty() const
Returns true if the string reference has no characters; otherwise returns false.
Definition: qstring.h:1169
QStringRef fontFamily
QStringRef fillRule
QStringRef fill
The QStringRef class provides a thin wrapper around QString substrings.
Definition: qstring.h:1099
QStringRef transform
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
int position() const
Returns the starting position in the referenced string that is referred to by the string reference...
Definition: qstring.h:1113
const QString * string() const
Returns a pointer to the string referred to by the string reference, or 0 if it does not reference a ...
Definition: qstring.h:1112
QStringRef display
QStringRef fillOpacity
QStringRef strokeOpacity
QStringRef textAnchor
QStringRef colorOpacity
void parseCSStoXMLAttrs(QString css, QVector< QSvgCssAttribute > *attributes)
QStringRef strokeWidth
QStringRef color
QStringRef opacity
QStringRef strokeLineJoin
QStringRef strokeLineCap
const QChar at(int i) const
Returns the character at the given index position in the string reference.
Definition: qstring.h:1174
QXmlStreamStringRef value
Definition: qsvghandler_p.h:78

Properties

◆ color

QStringRef QSvgAttributes::color

◆ colorOpacity

QStringRef QSvgAttributes::colorOpacity

Definition at line 167 of file qsvghandler.cpp.

Referenced by parseColor(), and QSvgAttributes().

◆ compOp

QStringRef QSvgAttributes::compOp

Definition at line 189 of file qsvghandler.cpp.

Referenced by parseCompOp(), and QSvgAttributes().

◆ display

QStringRef QSvgAttributes::display

Definition at line 190 of file qsvghandler.cpp.

Referenced by parseOthers(), and QSvgAttributes().

◆ fill

QStringRef QSvgAttributes::fill

Definition at line 168 of file qsvghandler.cpp.

Referenced by parseBrush(), and QSvgAttributes().

◆ fillOpacity

QStringRef QSvgAttributes::fillOpacity

Definition at line 170 of file qsvghandler.cpp.

Referenced by parseBrush(), and QSvgAttributes().

◆ fillRule

QStringRef QSvgAttributes::fillRule

Definition at line 169 of file qsvghandler.cpp.

Referenced by parseBrush(), and QSvgAttributes().

◆ fontFamily

QStringRef QSvgAttributes::fontFamily

Definition at line 180 of file qsvghandler.cpp.

Referenced by parseFont(), and QSvgAttributes().

◆ fontSize

QStringRef QSvgAttributes::fontSize

Definition at line 181 of file qsvghandler.cpp.

Referenced by parseFont(), and QSvgAttributes().

◆ fontStyle

QStringRef QSvgAttributes::fontStyle

Definition at line 182 of file qsvghandler.cpp.

Referenced by parseFont(), and QSvgAttributes().

◆ fontVariant

QStringRef QSvgAttributes::fontVariant

Definition at line 184 of file qsvghandler.cpp.

Referenced by parseFont(), and QSvgAttributes().

◆ fontWeight

QStringRef QSvgAttributes::fontWeight

Definition at line 183 of file qsvghandler.cpp.

Referenced by parseFont(), and QSvgAttributes().

◆ id

QString QSvgAttributes::id

◆ m_cssAttributes

QVector<QSvgCssAttribute> QSvgAttributes::m_cssAttributes

Definition at line 195 of file qsvghandler.cpp.

Referenced by QSvgAttributes().

◆ offset

QStringRef QSvgAttributes::offset

Definition at line 191 of file qsvghandler.cpp.

Referenced by parseStopNode(), and QSvgAttributes().

◆ opacity

QStringRef QSvgAttributes::opacity

Definition at line 188 of file qsvghandler.cpp.

Referenced by parseOpacity(), and QSvgAttributes().

◆ stopColor

QStringRef QSvgAttributes::stopColor

Definition at line 192 of file qsvghandler.cpp.

Referenced by parseStopNode(), and QSvgAttributes().

◆ stopOpacity

QStringRef QSvgAttributes::stopOpacity

Definition at line 193 of file qsvghandler.cpp.

Referenced by parseStopNode(), and QSvgAttributes().

◆ stroke

QStringRef QSvgAttributes::stroke

Definition at line 171 of file qsvghandler.cpp.

Referenced by parsePen(), and QSvgAttributes().

◆ strokeDashArray

QStringRef QSvgAttributes::strokeDashArray

Definition at line 172 of file qsvghandler.cpp.

Referenced by parsePen(), and QSvgAttributes().

◆ strokeDashOffset

QStringRef QSvgAttributes::strokeDashOffset

Definition at line 173 of file qsvghandler.cpp.

Referenced by parsePen(), and QSvgAttributes().

◆ strokeLineCap

QStringRef QSvgAttributes::strokeLineCap

Definition at line 174 of file qsvghandler.cpp.

Referenced by parsePen(), and QSvgAttributes().

◆ strokeLineJoin

QStringRef QSvgAttributes::strokeLineJoin

Definition at line 175 of file qsvghandler.cpp.

Referenced by parsePen(), and QSvgAttributes().

◆ strokeMiterLimit

QStringRef QSvgAttributes::strokeMiterLimit

Definition at line 176 of file qsvghandler.cpp.

Referenced by parsePen(), and QSvgAttributes().

◆ strokeOpacity

QStringRef QSvgAttributes::strokeOpacity

Definition at line 177 of file qsvghandler.cpp.

Referenced by parsePen(), and QSvgAttributes().

◆ strokeWidth

QStringRef QSvgAttributes::strokeWidth

Definition at line 178 of file qsvghandler.cpp.

Referenced by parsePen(), and QSvgAttributes().

◆ textAnchor

QStringRef QSvgAttributes::textAnchor

Definition at line 185 of file qsvghandler.cpp.

Referenced by parseFont(), and QSvgAttributes().

◆ transform

QStringRef QSvgAttributes::transform

Definition at line 186 of file qsvghandler.cpp.

Referenced by parseTransform(), and QSvgAttributes().

◆ vectorEffect

QStringRef QSvgAttributes::vectorEffect

Definition at line 179 of file qsvghandler.cpp.

Referenced by parsePen(), and QSvgAttributes().

◆ visibility

QStringRef QSvgAttributes::visibility

Definition at line 187 of file qsvghandler.cpp.

Referenced by parseVisibility(), and QSvgAttributes().


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