28 #include <QtCore/QString> 29 #include <QtCore/QHash> 30 #include <QtCore/QList> 41 inline Field() : m_long(0) { }
49 static void load(QDataStream &,
UDSEntry &);
54 : d(new UDSEntryPrivate())
75 return d->fields.value(field).m_str;
80 UDSEntryPrivate::FieldHash::ConstIterator it = d->fields.find(field);
81 return it != d->fields.constEnd() ? it->m_long :
defaultValue;
96 UDSEntryPrivate::Field
f;
98 d->fields.insert(field,
f);
103 UDSEntryPrivate::Field
f;
105 d->fields.insert(field,
f);
110 return d->fields.keys();
115 return d->fields.count();
120 return d->fields.contains(field);
125 return d->fields.remove(field) > 0;
135 UDSEntryPrivate::save(s, a);
141 UDSEntryPrivate::load(s, a);
145 void UDSEntryPrivate::save(QDataStream &s,
const UDSEntry &a)
147 const FieldHash &e = a.d->fields;
150 FieldHash::ConstIterator it = e.begin();
151 const FieldHash::ConstIterator
end = e.end();
152 for( ; it !=
end; ++it)
154 const quint32 uds = it.key();
161 Q_ASSERT_X(
false,
"KIO::UDSEntry",
"Found a field with an invalid type");
165 void UDSEntryPrivate::load(QDataStream &s,
UDSEntry &a)
167 FieldHash &e = a.d->fields;
176 static QVector<QString> cachedStrings;
177 if (cachedStrings.size() < size) {
178 cachedStrings.resize(size);
181 for(quint32 i = 0; i < size; ++i)
192 if (buffer != cachedStrings.at(i)) {
193 cachedStrings[i] = buffer;
197 f.m_str = cachedStrings.at(i);
204 Q_ASSERT_X(
false,
"KIO::UDSEntry",
"Found a field with an invalid type");
QString stringValue(uint field) const
QList< uint > listFields() const
lists all fields
Indicates that the field is a QString.
void clear()
remove all fields
Universal Directory Service.
A namespace for KIO globals.
void insert(uint field, const QString &value)
insert field with numeric value
File type, part of the mode returned by stat (for a link, this returns the file type of the pointed i...
static quint32 f(DES_KEY *key, quint32 r, char *subkey)
QDataStream & operator<<(QDataStream &s, const AuthInfo &a)
long long numberValue(uint field, long long defaultValue=0) const
bool contains(uint field) const
check existence of a field
UDSEntry & operator=(const UDSEntry &other)
QDataStream & operator>>(QDataStream &s, AuthInfo &a)
int count() const
count fields
Indicates that the field is a number (long long)
Name of the file where the link points to Allows to check for a symlink (don't use S_ISLNK !...
bool remove(uint field)
remove a field with a certain numeric id
Q_DECLARE_TYPEINFO(KIO::UDSEntryPrivate::Field, Q_MOVABLE_TYPE)
KAction * save(const QObject *recvr, const char *slot, QObject *parent)
QString defaultValue(const QString &t)