Qt 4.8
|
The QXmlStreamAttributes class represents a vector of QXmlStreamAttribute. More...
#include <qxmlstream.h>
Public Functions | |
void | append (const QString &namespaceUri, const QString &name, const QString &value) |
Appends a new attribute with name in the namespace described with namespaceUri, and value value. More... | |
void | append (const QString &qualifiedName, const QString &value) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Appends a new attribute with qualified name qualifiedName and value value. More... | |
bool | hasAttribute (const QString &qualifiedName) const |
bool | hasAttribute (const QLatin1String &qualifiedName) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
bool | hasAttribute (const QString &namespaceUri, const QString &name) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
QXmlStreamAttributes () | |
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. More... | |
QStringRef | value (const QString &namespaceUri, const QLatin1String &name) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns the value of the attribute name in the namespace described with namespaceUri, or an empty string reference if the attribute is not defined. More... | |
QStringRef | value (const QLatin1String &namespaceUri, const QLatin1String &name) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns the value of the attribute name in the namespace described with namespaceUri, or an empty string reference if the attribute is not defined. More... | |
QStringRef | value (const QString &qualifiedName) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the value of the attribute with qualified name qualifiedName , or an empty string reference if the attribute is not defined. More... | |
QStringRef | value (const QLatin1String &qualifiedName) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the value of the attribute with qualified name qualifiedName , or an empty string reference if the attribute is not defined. More... | |
Public Functions inherited from QVector< QXmlStreamAttribute > | |
void | append (const QXmlStreamAttribute &t) |
Inserts value at the end of the vector. More... | |
const QXmlStreamAttribute & | at (int i) const |
Returns the item at index position i in the vector. More... | |
reference | back () |
This function is provided for STL compatibility. More... | |
const_reference | back () const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
iterator | begin () |
Returns an STL-style iterator pointing to the first item in the vector. More... | |
const_iterator | begin () const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
int | capacity () const |
Returns the maximum number of items that can be stored in the vector without forcing a reallocation. More... | |
void | clear () |
Removes all the elements from the vector and releases the memory used by the vector. More... | |
const_iterator | constBegin () const |
Returns a const STL-style iterator pointing to the first item in the vector. More... | |
const QXmlStreamAttribute * | constData () const |
Returns a const pointer to the data stored in the vector. More... | |
const_iterator | constEnd () const |
Returns a const STL-style iterator pointing to the imaginary item after the last item in the vector. More... | |
bool | contains (const QXmlStreamAttribute &t) const |
Returns true if the vector contains an occurrence of value; otherwise returns false. More... | |
int | count (const QXmlStreamAttribute &t) const |
Returns the number of occurrences of value in the vector. More... | |
int | count () const |
Same as size(). More... | |
QXmlStreamAttribute * | data () |
Returns a pointer to the data stored in the vector. More... | |
const QXmlStreamAttribute * | data () const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | detach () |
bool | empty () const |
This function is provided for STL compatibility. More... | |
iterator | end () |
Returns an STL-style iterator pointing to the imaginary item after the last item in the vector. More... | |
const_iterator | end () const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
bool | endsWith (const QXmlStreamAttribute &t) const |
Returns true if this vector is not empty and its last item is equal to value; otherwise returns false. More... | |
iterator | erase (iterator begin, iterator end) |
Removes all the items from begin up to (but not including) end. More... | |
iterator | erase (iterator pos) |
Removes the item pointed to by the iterator pos from the vector, and returns an iterator to the next item in the vector (which may be end()). More... | |
QVector< QXmlStreamAttribute > & | fill (const QXmlStreamAttribute &t, int size=-1) |
Assigns value to all items in the vector. More... | |
QXmlStreamAttribute & | first () |
Returns a reference to the first item in the vector. More... | |
const QXmlStreamAttribute & | first () const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
QXmlStreamAttribute & | front () |
This function is provided for STL compatibility. More... | |
const_reference | front () const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
int | indexOf (const QXmlStreamAttribute &t, int from=0) const |
Returns the index position of the first occurrence of value in the vector, searching forward from index position from. More... | |
void | insert (int i, const QXmlStreamAttribute &t) |
Inserts value at index position i in the vector. More... | |
void | insert (int i, int n, const QXmlStreamAttribute &t) |
Inserts count copies of value at index position i in the vector. More... | |
iterator | insert (iterator before, int n, const QXmlStreamAttribute &x) |
Inserts count copies of value in front of the item pointed to by the iterator before. More... | |
iterator | insert (iterator before, const QXmlStreamAttribute &x) |
Inserts value in front of the item pointed to by the iterator before. More... | |
bool | isDetached () const |
bool | isEmpty () const |
Returns true if the vector has size 0; otherwise returns false. More... | |
bool | isSharedWith (const QVector< QXmlStreamAttribute > &other) const |
QXmlStreamAttribute & | last () |
Returns a reference to the last item in the vector. More... | |
const QXmlStreamAttribute & | last () const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
int | lastIndexOf (const QXmlStreamAttribute &t, int from=-1) const |
Returns the index position of the last occurrence of the value value in the vector, searching backward from index position from. More... | |
QVector< QXmlStreamAttribute > | mid (int pos, int length=-1) const |
Returns a vector whose elements are copied from this vector, starting at position pos. More... | |
bool | operator!= (const QVector< QXmlStreamAttribute > &v) const |
Returns true if other is not equal to this vector; otherwise returns false. More... | |
QVector< QXmlStreamAttribute > | operator+ (const QVector< QXmlStreamAttribute > &l) const |
Returns a vector that contains all the items in this vector followed by all the items in the other vector. More... | |
QVector< QXmlStreamAttribute > & | operator+= (const QVector< QXmlStreamAttribute > &l) |
Appends the items of the other vector to this vector and returns a reference to this vector. More... | |
QVector< QXmlStreamAttribute > & | operator+= (const QXmlStreamAttribute &t) |
Appends value to the vector. More... | |
QVector< QXmlStreamAttribute > & | operator<< (const QVector< QXmlStreamAttribute > &l) |
Appends other to the vector and returns a reference to the vector. More... | |
QVector< QXmlStreamAttribute > & | operator<< (const QXmlStreamAttribute &t) |
Appends value to the vector and returns a reference to this vector. More... | |
QVector< QXmlStreamAttribute > & | operator= (const QVector< QXmlStreamAttribute > &v) |
Assigns other to this vector and returns a reference to this vector. More... | |
bool | operator== (const QVector< QXmlStreamAttribute > &v) const |
Returns true if other is equal to this vector; otherwise returns false. More... | |
QXmlStreamAttribute & | operator[] (int i) |
Returns the item at index position i as a modifiable reference. More... | |
const QXmlStreamAttribute & | operator[] (int i) const |
Same as at(i). More... | |
void | pop_back () |
This function is provided for STL compatibility. More... | |
void | pop_front () |
This function is provided for STL compatibility. More... | |
void | prepend (const QXmlStreamAttribute &t) |
Inserts value at the beginning of the vector. More... | |
void | push_back (const QXmlStreamAttribute &t) |
This function is provided for STL compatibility. More... | |
void | push_front (const QXmlStreamAttribute &t) |
This function is provided for STL compatibility. More... | |
QVector () | |
Constructs an empty vector. More... | |
QVector (int size) | |
Constructs a vector with an initial size of size elements. More... | |
QVector (int size, const QXmlStreamAttribute &t) | |
Constructs a vector with an initial size of size elements. More... | |
QVector (const QVector< QXmlStreamAttribute > &v) | |
Constructs a copy of other. More... | |
void | remove (int i) |
Removes the element at index position i. More... | |
void | remove (int i, int n) |
Removes count elements from the middle of the vector, starting at index position i. More... | |
void | replace (int i, const QXmlStreamAttribute &t) |
Replaces the item at index position i with value. More... | |
void | reserve (int size) |
Attempts to allocate memory for at least size elements. More... | |
void | resize (int size) |
Sets the size of the vector to size. More... | |
void | setSharable (bool sharable) |
int | size () const |
Returns the number of items in the vector. More... | |
void | squeeze () |
Releases any memory not required to store the items. More... | |
bool | startsWith (const QXmlStreamAttribute &t) const |
Returns true if this vector is not empty and its first item is equal to value; otherwise returns false. More... | |
void | swap (QVector< QXmlStreamAttribute > &other) |
Swaps vector other with this vector. More... | |
QList< QXmlStreamAttribute > | toList () const |
Returns a QList object with the data contained in this QVector. More... | |
std::vector< QXmlStreamAttribute > | toStdVector () const |
Returns a std::vector object with the data contained in this QVector. More... | |
QXmlStreamAttribute | value (int i) const |
Returns the value at index position i in the vector. More... | |
QXmlStreamAttribute | value (int i, const QXmlStreamAttribute &defaultValue) const |
If the index i is out of bounds, the function returns defaultValue. More... | |
~QVector () | |
Destroys the vector. More... | |
Additional Inherited Members | |
Public Types inherited from QVector< QXmlStreamAttribute > | |
typedef const QXmlStreamAttribute * | const_iterator |
The QVector::const_iterator typedef provides an STL-style const iterator for QVector and QStack. More... | |
typedef const value_type * | const_pointer |
Typedef for const T *. More... | |
typedef const value_type & | const_reference |
Typedef for T &. More... | |
typedef const_iterator | ConstIterator |
Qt-style synonym for QVector::const_iterator. More... | |
typedef qptrdiff | difference_type |
Typedef for ptrdiff_t. More... | |
typedef QXmlStreamAttribute * | iterator |
The QVector::iterator typedef provides an STL-style non-const iterator for QVector and QStack. More... | |
typedef iterator | Iterator |
Qt-style synonym for QVector::iterator. More... | |
typedef value_type * | pointer |
Typedef for T *. More... | |
typedef value_type & | reference |
Typedef for T &. More... | |
typedef int | size_type |
Typedef for int. More... | |
typedef QXmlStreamAttribute | value_type |
Typedef for T. More... | |
Static Public Functions inherited from QVector< QXmlStreamAttribute > | |
static QVector< QXmlStreamAttribute > | fromList (const QList< QXmlStreamAttribute > &list) |
Returns a QVector object with the data contained in list. More... | |
static QVector< QXmlStreamAttribute > | fromStdVector (const std::vector< QXmlStreamAttribute > &vector) |
Returns a QVector object with the data contained in vector. More... | |
Public Variables inherited from QVector< QXmlStreamAttribute > | |
QVectorData * | d |
Data * | p |
Related Functions inherited from QVector< QXmlStreamAttribute > | |
QDataStream & | operator<< (QDataStream &out, const QVector< QXmlStreamAttribute > &vector) |
Writes the vector vector to stream out. More... | |
QDataStream & | operator>> (QDataStream &in, QVector< QXmlStreamAttribute > &vector) |
Reads a vector from stream in into vector. More... | |
The QXmlStreamAttributes class represents a vector of QXmlStreamAttribute.
Attributes are returned by a QXmlStreamReader in attributes() when the reader reports a QXmlStreamReader::StartElement{start element}. The class can also be used with a QXmlStreamWriter as an argument to QXmlStreamWriter::writeAttributes(){writeAttributes()}.
The convenience function value() loops over the vector and returns an attribute value for a given namespaceUri and an attribute's name.
New attributes can be added with append().
Definition at line 169 of file qxmlstream.h.
|
inline |
Definition at line 172 of file qxmlstream.h.
void QXmlStreamAttributes::append | ( | const QString & | namespaceUri, |
const QString & | name, | ||
const QString & | value | ||
) |
Appends a new attribute with name in the namespace described with namespaceUri, and value value.
The namespaceUri can be empty.
Definition at line 2893 of file qxmlstream.cpp.
Referenced by parseCSStoXMLAttrs(), parseStopNode(), and QXmlStreamReaderPrivate::resolveTag().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Appends a new attribute with qualified name qualifiedName and value value.
Definition at line 2902 of file qxmlstream.cpp.
|
inline |
Returns true if this QXmlStreamAttributes has an attribute whose qualified name is qualifiedName; otherwise returns false.
Note that this is not namespace aware. For instance, if this QXmlStreamAttributes contains an attribute whose lexical name is "xlink:href" this doesn't tell that an attribute named href
in the XLink namespace is present, since the xlink
prefix can be bound to any namespace. Use the overload that takes a namespace URI and a local name as parameter, for namespace aware code.
Definition at line 181 of file qxmlstream.h.
Referenced by QPatternist::XSLTTokenizer::handleXMLBase(), QPatternist::XSLTTokenizer::handleXSLTVersion(), QPatternist::XSLTTokenizer::queueParams(), QPatternist::XSLTTokenizer::queueSelectOrSequenceConstructor(), QPatternist::XSLTTokenizer::queueSimpleContentConstructor(), QPatternist::XSLTTokenizer::queueSorting(), QPatternist::XSLTTokenizer::queueVariableDeclaration(), and QPatternist::XSLTTokenizer::readToggleAttribute().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 186 of file qxmlstream.h.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Returns true if this QXmlStreamAttributes has an attribute whose namespace URI and name correspond to namespaceUri and name; otherwise returns false.
Definition at line 191 of file qxmlstream.h.
QStringRef QXmlStreamAttributes::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.
The namespaceUri can be empty.
Definition at line 2805 of file qxmlstream.cpp.
Referenced by QPatternist::ColoringMessageHandler::colorifyDescription(), createCircleNode(), createEllipseNode(), createFontNode(), createImageNode(), createLinearGradientNode(), createLineNode(), createPathNode(), createPolygonNode(), createPolylineNode(), createRadialGradientNode(), createRectNode(), createSolidColorNode(), createSvgGlyph(), createSvgNode(), createTextAreaNode(), createTextNode(), createUseNode(), QPatternist::XSLTTokenizer::handleStandardAttributes(), QPatternist::XSLTTokenizer::handleXMLBase(), QPatternist::XSLTTokenizer::handleXSLTVersion(), QPatternist::XSLTTokenizer::insideTemplate(), QXmlStreamAttribute::operator==(), QScriptXmlParser::parse(), parseAnimateColorNode(), parseAnimateTransformNode(), parseBaseGradient(), parseFontFaceNameNode(), parseFontFaceNode(), parseStopNode(), parseStyleNode(), QSvgAttributes::QSvgAttributes(), QPatternist::XSLTTokenizer::queueSelectOrSequenceConstructor(), QPatternist::XSLTTokenizer::queueSimpleContentConstructor(), QPatternist::XSLTTokenizer::queueSorting(), QPatternist::XSLTTokenizer::queueVariableDeclaration(), QPatternist::XSLTTokenizer::readToggleAttribute(), someId(), QSvgHandler::startElement(), and tokenUntil().
QStringRef QXmlStreamAttributes::value | ( | const QString & | namespaceUri, |
const QLatin1String & | name | ||
) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns the value of the attribute name in the namespace described with namespaceUri, or an empty string reference if the attribute is not defined.
The namespaceUri can be empty.
Definition at line 2820 of file qxmlstream.cpp.
QStringRef QXmlStreamAttributes::value | ( | const QLatin1String & | namespaceUri, |
const QLatin1String & | name | ||
) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns the value of the attribute name in the namespace described with namespaceUri, or an empty string reference if the attribute is not defined.
The namespaceUri can be empty.
Definition at line 2835 of file qxmlstream.cpp.
QStringRef QXmlStreamAttributes::value | ( | const QString & | qualifiedName | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the value of the attribute with qualified name qualifiedName , or an empty string reference if the attribute is not defined.
A qualified name is the raw name of an attribute in the XML data. It consists of the namespace prefix, followed by colon, followed by the attribute's local name. Since the namespace prefix is not unique (the same prefix can point to different namespaces and different prefixes can point to the same namespace), you shouldn't use qualified names, but a resolved namespaceUri and the attribute's local name.
Definition at line 2857 of file qxmlstream.cpp.
QStringRef QXmlStreamAttributes::value | ( | const QLatin1String & | qualifiedName | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the value of the attribute with qualified name qualifiedName , or an empty string reference if the attribute is not defined.
A qualified name is the raw name of an attribute in the XML data. It consists of the namespace prefix, followed by colon, followed by the attribute's local name. Since the namespace prefix is not unique (the same prefix can point to different namespaces and different prefixes can point to the same namespace), you shouldn't use qualified names, but a resolved namespaceUri and the attribute's local name.
Definition at line 2879 of file qxmlstream.cpp.