|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.xml.QXmlStreamAttributes
public class QXmlStreamAttributes
The QXmlStreamAttributes class represents a vector of QXmlStreamAttribute.
Attributes are returned by a QXmlStreamReader in attributes() when the reader reports a start element. The class can also be used with a QXmlStreamWriter as an argument to 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.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter |
---|
QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I> |
Constructor Summary | |
---|---|
QXmlStreamAttributes()
Creates a new QXmlStreamAttributes object. |
Method Summary | |
---|---|
void |
append(QXmlStreamAttribute attribute)
Appends attribute to this QXmlStreamAttributes. |
void |
append(java.lang.String qualifiedName,
java.lang.String value)
Appends a new attribute with qualified name qualifiedName and value value. |
void |
append(java.lang.String namespaceUri,
java.lang.String name,
java.lang.String value)
Appends a new attribute with name in the namespace described with namespaceUri, and value value. |
QXmlStreamAttribute |
at(int i)
Returns the item at index position i in the vector. |
int |
capacity()
Returns the maximum number of items that can be stored in the vector without forcing a reallocation. |
void |
clear()
Removes all the elements from the vector. |
boolean |
contains(QXmlStreamAttribute t)
Returns true if the vector contains an occurrence of t; otherwise returns false. |
int |
count()
Same as size. |
int |
count(QXmlStreamAttribute t)
Returns the number of occurrences of t in the vector. |
boolean |
empty()
This function is provided for STL compatibility. |
boolean |
equals(java.lang.Object other)
|
java.util.List<QXmlStreamAttribute> |
fill(QXmlStreamAttribute t,
int size)
Assigns t to all items in the vector. |
QXmlStreamAttribute |
first()
|
static java.util.List<QXmlStreamAttribute> |
fromList(java.util.List<QXmlStreamAttribute> list)
Returns a QVector object with the data contained in list. |
static QXmlStreamAttributes |
fromNativePointer(QNativePointer nativePointer)
This function returns the QXmlStreamAttributes instance pointed to by nativePointer |
int |
indexOf(QXmlStreamAttribute t,
int from)
Returns the index position of the first occurrence of t in the vector, searching forward from index position from. |
boolean |
isEmpty()
Returns true if the vector has size 0; otherwise returns false. |
QXmlStreamAttribute |
last()
|
int |
lastIndexOf(QXmlStreamAttribute t,
int from)
Returns the index position of the last occurrence of the value t in the vector, searching backward from index position from. |
java.util.List<QXmlStreamAttribute> |
mid(int pos,
int length)
Returns a vector whose elements are copied from this vector, starting at position pos. |
static QNativePointer |
nativePointerArray(QXmlStreamAttributes[] array)
This function returns a QNativePointer that is pointing to the specified QXmlStreamAttributes array. |
void |
prepend(QXmlStreamAttribute t)
Inserts t at the beginning of the vector. |
void |
remove(int i)
Removes the element at index position i. |
void |
remove(int i,
int n)
Removes n elements from the middle of the vector, starting at index position i. |
void |
replace(int i,
QXmlStreamAttribute t)
Replaces the item at index position i with t. |
void |
reserve(int size)
Attempts to allocate memory for at least size elements. |
void |
resize(int size)
Sets the size of the vector to size. |
void |
setSharable(boolean sharable)
This method is used internally by Qt Jambi. |
int |
size()
Returns the number of items in the vector. |
void |
squeeze()
Releases any memory not required to store the items. |
java.util.List<QXmlStreamAttribute> |
toList()
Returns a QList object with the data contained in this QVector. |
java.lang.String |
value(java.lang.String qualifiedName)
Returns the value of the attribute with qualified name qualifiedName , or an empty string reference if the attribute is not defined. |
java.lang.String |
value(java.lang.String namespaceUri,
java.lang.String name)
Returns the value of the attribute name in the namespace described with namespaceUri, or an empty string reference if the attribute is not defined. |
Methods inherited from class com.trolltech.qt.QtJambiObject |
---|
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr |
Methods inherited from class com.trolltech.qt.QSignalEmitter |
---|
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread |
Methods inherited from class java.lang.Object |
---|
clone, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Constructor Detail |
---|
public QXmlStreamAttributes()
Method Detail |
---|
public final void append(java.lang.String namespaceUri, java.lang.String name, java.lang.String value)
Appends a new attribute with name in the namespace described with namespaceUri, and value value. The namespaceUri can be empty.
public final void append(java.lang.String qualifiedName, java.lang.String value)
Appends a new attribute with qualified name qualifiedName and value value.
public final void append(QXmlStreamAttribute attribute)
public final QXmlStreamAttribute at(int i)
Returns the item at index position i in the vector.
i must be a valid index position in the vector (i.e., 0 <= i < size).
public final int capacity()
Returns the maximum number of items that can be stored in the vector without forcing a reallocation.
The sole purpose of this function is to provide a means of fine tuning QVector's memory usage. In general, you will rarely ever need to call this function. If you want to know how many items are in the vector, call size.
public final void clear()
Removes all the elements from the vector.
Same as resize(0).
public final boolean contains(QXmlStreamAttribute t)
Returns true if the vector contains an occurrence of t; otherwise returns false.
This function requires the value type to have an implementation of operator==().
public final int count(QXmlStreamAttribute t)
Returns the number of occurrences of t in the vector.
This function requires the value type to have an implementation of operator==().
public final int count()
Same as size.
public final boolean empty()
This function is provided for STL compatibility. It is equivalent to isEmpty, returning true if the vector is empty; otherwise returns false.
public final java.util.List<QXmlStreamAttribute> fill(QXmlStreamAttribute t, int size)
Assigns t to all items in the vector. If size is different from -1 (the default), the vector is resized to size size beforehand.
Example:
QVector<QString> vector(3); vector.fill("Yes"); // vector: ["Yes", "Yes", "Yes"] vector.fill("oh", 5); // vector: ["oh", "oh", "oh", "oh", "oh"]
public final QXmlStreamAttribute first()
public final int indexOf(QXmlStreamAttribute t, int from)
Returns the index position of the first occurrence of t in the vector, searching forward from index position from. Returns -1 if no item matched.
Example:
QVector<QString> vector; vector << "A" << "B" << "C" << "B" << "A"; vector.indexOf("B"); // returns 1 vector.indexOf("B", 1); // returns 1 vector.indexOf("B", 2); // returns 3 vector.indexOf("X"); // returns -1
This function requires the value type to have an implementation of operator==().
public final boolean isEmpty()
Returns true if the vector has size 0; otherwise returns false.
public final QXmlStreamAttribute last()
public final int lastIndexOf(QXmlStreamAttribute t, int from)
Returns the index position of the last occurrence of the value t in the vector, searching backward from index position from. If from is -1 (the default), the search starts at the last item. Returns -1 if no item matched.
Example:
QList<QString> vector; vector << "A" << "B" << "C" << "B" << "A"; vector.lastIndexOf("B"); // returns 3 vector.lastIndexOf("B", 3); // returns 3 vector.lastIndexOf("B", 2); // returns 1 vector.lastIndexOf("X"); // returns -1
This function requires the value type to have an implementation of operator==().
public final java.util.List<QXmlStreamAttribute> mid(int pos, int length)
Returns a vector whose elements are copied from this vector, starting at position pos. If length is -1 (the default), all elements after pos are copied; otherwise length elements (or all remaining elements if there are less than length elements) are copied.
public final void prepend(QXmlStreamAttribute t)
Inserts t at the beginning of the vector.
Example:
QVector<QString> vector;
vector.prepend("one");
vector.prepend("two");
vector.prepend("three");
// vector: ["three", "two", "one"]
This is the same as vector.insert(0, t).
For large vectors, this operation can be slow (linear time), because it requires moving all the items in the vector by one position further in memory. If you want a container class that provides a fast prepend function, use QList or QLinkedList instead.
public final void remove(int i)
Removes the element at index position i.
public final void remove(int i, int n)
Removes n elements from the middle of the vector, starting at index position i.
public final void replace(int i, QXmlStreamAttribute t)
Replaces the item at index position i with t.
i must be a valid index position in the vector (i.e., 0 <= i < size).
public final void reserve(int size)
Attempts to allocate memory for at least size elements. If you know in advance how large the vector will be, you can call this function, and if you call resize often you are likely to get better performance. If size is an underestimate, the worst that will happen is that the QVector will be a bit slower.
The sole purpose of this function is to provide a means of fine tuning QVector's memory usage. In general, you will rarely ever need to call this function. If you want to change the size of the vector, call resize.
public final void resize(int size)
Sets the size of the vector to size. If size is greater than the current size, elements are added to the end; the new elements are initialized with a default-constructed value. If size is less than the current size, elements are removed from the end.
public final void setSharable(boolean sharable)
This method is used internally by Qt Jambi. Do not use it in your applications.
public final int size()
Returns the number of items in the vector.
public final void squeeze()
Releases any memory not required to store the items.
The sole purpose of this function is to provide a means of fine tuning QVector's memory usage. In general, you will rarely ever need to call this function.
public final java.util.List<QXmlStreamAttribute> toList()
Returns a QList object with the data contained in this QVector.
Example:
QVector<double> vect;
vect << "red" << "green" << "blue" << "black";
QList<double> list = vect.toList();
// list: ["red", "green", "blue", "black"]
public final java.lang.String value(java.lang.String qualifiedName)
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.
public final java.lang.String value(java.lang.String namespaceUri, java.lang.String name)
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.
public static java.util.List<QXmlStreamAttribute> fromList(java.util.List<QXmlStreamAttribute> list)
Returns a QVector object with the data contained in list.
Example:
QStringList list;
list << "Sven" << "Kim" << "Ola";
QVector<QString> vect = QVector<QString>::fromList(list);
// vect: ["Sven", "Kim", "Ola"]
public static QXmlStreamAttributes fromNativePointer(QNativePointer nativePointer)
nativePointer
- the QNativePointer of which object should be returned.public static QNativePointer nativePointerArray(QXmlStreamAttributes[] array)
array
- the array that the returned pointer will point to.
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |