Qt 4.8
Public Functions | Public Variables | List of all members
QDomNodeListPrivate Class Reference

Public Functions

void createList ()
 
QDomNodePrivateitem (int index)
 
uint length () const
 
bool operator!= (const QDomNodeListPrivate &) const
 
bool operator== (const QDomNodeListPrivate &) const
 
 QDomNodeListPrivate (QDomNodePrivate *)
 
 QDomNodeListPrivate (QDomNodePrivate *, const QString &)
 
 QDomNodeListPrivate (QDomNodePrivate *, const QString &, const QString &)
 
 ~QDomNodeListPrivate ()
 

Public Variables

QList< QDomNodePrivate * > list
 
QDomNodePrivatenode_impl
 
QString nsURI
 
QAtomicInt ref
 
QString tagname
 
long timestamp
 

Detailed Description

Definition at line 209 of file qdom.cpp.

Constructors and Destructors

◆ QDomNodeListPrivate() [1/3]

QDomNodeListPrivate::QDomNodeListPrivate ( QDomNodePrivate n_impl)

Definition at line 1171 of file qdom.cpp.

1172 {
1173  ref = 1;
1174  node_impl = n_impl;
1175  if (node_impl)
1176  node_impl->ref.ref();
1177  timestamp = 0;
1178 }
QDomNodePrivate * node_impl
Definition: qdom.cpp:228
QAtomicInt ref
Definition: qdom.cpp:224
bool ref()
Atomically increments the value of this QAtomicInt.
QAtomicInt ref
Definition: qdom.cpp:191

◆ QDomNodeListPrivate() [2/3]

QDomNodeListPrivate::QDomNodeListPrivate ( QDomNodePrivate n_impl,
const QString name 
)

Definition at line 1180 of file qdom.cpp.

1181 {
1182  ref = 1;
1183  node_impl = n_impl;
1184  if (node_impl)
1185  node_impl->ref.ref();
1186  tagname = name;
1187  timestamp = 0;
1188 }
QDomNodePrivate * node_impl
Definition: qdom.cpp:228
QAtomicInt ref
Definition: qdom.cpp:224
bool ref()
Atomically increments the value of this QAtomicInt.
QAtomicInt ref
Definition: qdom.cpp:191
QString tagname
Definition: qdom.cpp:229
const char * name

◆ QDomNodeListPrivate() [3/3]

QDomNodeListPrivate::QDomNodeListPrivate ( QDomNodePrivate n_impl,
const QString _nsURI,
const QString localName 
)

Definition at line 1190 of file qdom.cpp.

1191 {
1192  ref = 1;
1193  node_impl = n_impl;
1194  if (node_impl)
1195  node_impl->ref.ref();
1196  tagname = localName;
1197  nsURI = _nsURI;
1198  timestamp = 0;
1199 }
QDomNodePrivate * node_impl
Definition: qdom.cpp:228
QAtomicInt ref
Definition: qdom.cpp:224
bool ref()
Atomically increments the value of this QAtomicInt.
QAtomicInt ref
Definition: qdom.cpp:191
QString tagname
Definition: qdom.cpp:229

◆ ~QDomNodeListPrivate()

QDomNodeListPrivate::~QDomNodeListPrivate ( )

Definition at line 1201 of file qdom.cpp.

1202 {
1203  if (node_impl && !node_impl->ref.deref())
1204  delete node_impl;
1205 }
QDomNodePrivate * node_impl
Definition: qdom.cpp:228
QAtomicInt ref
Definition: qdom.cpp:191
bool deref()
Atomically decrements the value of this QAtomicInt.

Functions

◆ createList()

void QDomNodeListPrivate::createList ( )

Definition at line 1217 of file qdom.cpp.

Referenced by length().

1218 {
1219  if (!node_impl)
1220  return;
1221 
1222  const QDomDocumentPrivate *const doc = node_impl->ownerDocument();
1223  if (doc && timestamp != doc->nodeListTime)
1224  timestamp = doc->nodeListTime;
1225 
1227 
1228  list.clear();
1229  if (tagname.isNull()) {
1230  while (p) {
1231  list.append(p);
1232  p = p->next;
1233  }
1234  } else if (nsURI.isNull()) {
1235  while (p && p != node_impl) {
1236  if (p->isElement() && p->nodeName() == tagname) {
1237  list.append(p);
1238  }
1239  if (p->first)
1240  p = p->first;
1241  else if (p->next)
1242  p = p->next;
1243  else {
1244  p = p->parent();
1245  while (p && p != node_impl && !p->next)
1246  p = p->parent();
1247  if (p && p != node_impl)
1248  p = p->next;
1249  }
1250  }
1251  } else {
1252  while (p && p != node_impl) {
1253  if (p->isElement() && p->name==tagname && p->namespaceURI==nsURI) {
1254  list.append(p);
1255  }
1256  if (p->first)
1257  p = p->first;
1258  else if (p->next)
1259  p = p->next;
1260  else {
1261  p = p->parent();
1262  while (p && p != node_impl && !p->next)
1263  p = p->parent();
1264  if (p && p != node_impl)
1265  p = p->next;
1266  }
1267  }
1268  }
1269 }
QDomNodePrivate * node_impl
Definition: qdom.cpp:228
QDomNodePrivate * parent() const
Definition: qdom.cpp:161
QString name
Definition: qdom.cpp:198
QDomDocumentPrivate * ownerDocument()
Definition: qdom.cpp:1893
virtual bool isElement() const
Definition: qdom.cpp:175
QString tagname
Definition: qdom.cpp:229
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
QDomNodePrivate * next
Definition: qdom.cpp:193
void clear()
Removes all items from the list.
Definition: qlist.h:764
bool isNull() const
Returns true if this string is null; otherwise returns false.
Definition: qstring.h:505
QString namespaceURI
Definition: qdom.cpp:201
QDomNodePrivate * first
Definition: qdom.cpp:195
QString nodeName() const
Definition: qdom.cpp:142
QList< QDomNodePrivate * > list
Definition: qdom.cpp:231

◆ item()

QDomNodePrivate * QDomNodeListPrivate::item ( int  index)

Definition at line 1271 of file qdom.cpp.

1272 {
1273  if (!node_impl)
1274  return 0;
1275 
1276  const QDomDocumentPrivate *const doc = node_impl->ownerDocument();
1277  if (!doc || timestamp != doc->nodeListTime)
1278  createList();
1279 
1280  if (index >= list.size())
1281  return 0;
1282 
1283  return list.at(index);
1284 }
QDomNodePrivate * node_impl
Definition: qdom.cpp:228
QDomDocumentPrivate * ownerDocument()
Definition: qdom.cpp:1893
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
quint16 index
QList< QDomNodePrivate * > list
Definition: qdom.cpp:231

◆ length()

uint QDomNodeListPrivate::length ( ) const

Definition at line 1286 of file qdom.cpp.

1287 {
1288  if (!node_impl)
1289  return 0;
1290 
1291  const QDomDocumentPrivate *const doc = node_impl->ownerDocument();
1292  if (!doc || timestamp != doc->nodeListTime) {
1293  QDomNodeListPrivate *that = const_cast<QDomNodeListPrivate *>(this);
1294  that->createList();
1295  }
1296 
1297  return list.count();
1298 }
QDomNodePrivate * node_impl
Definition: qdom.cpp:228
QDomDocumentPrivate * ownerDocument()
Definition: qdom.cpp:1893
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
QList< QDomNodePrivate * > list
Definition: qdom.cpp:231

◆ operator!=()

bool QDomNodeListPrivate::operator!= ( const QDomNodeListPrivate other) const

Definition at line 1212 of file qdom.cpp.

1213 {
1214  return (node_impl != other.node_impl) || (tagname != other.tagname);
1215 }
QDomNodePrivate * node_impl
Definition: qdom.cpp:228
QString tagname
Definition: qdom.cpp:229

◆ operator==()

bool QDomNodeListPrivate::operator== ( const QDomNodeListPrivate other) const

Definition at line 1207 of file qdom.cpp.

1208 {
1209  return (node_impl == other.node_impl) && (tagname == other.tagname);
1210 }
QDomNodePrivate * node_impl
Definition: qdom.cpp:228
QString tagname
Definition: qdom.cpp:229

Properties

◆ list

QList<QDomNodePrivate*> QDomNodeListPrivate::list

Definition at line 231 of file qdom.cpp.

◆ node_impl

QDomNodePrivate* QDomNodeListPrivate::node_impl

Definition at line 228 of file qdom.cpp.

Referenced by operator!=(), and operator==().

◆ nsURI

QString QDomNodeListPrivate::nsURI

Definition at line 230 of file qdom.cpp.

◆ ref

QAtomicInt QDomNodeListPrivate::ref

Definition at line 224 of file qdom.cpp.

Referenced by QDomNodeList::operator=().

◆ tagname

QString QDomNodeListPrivate::tagname

Definition at line 229 of file qdom.cpp.

Referenced by operator!=(), and operator==().

◆ timestamp

long QDomNodeListPrivate::timestamp

Definition at line 232 of file qdom.cpp.


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