KIO::UDSEntry

Search for usage in LXR

KIO::UDSEntry Class Reference

#include <KIO/UDSEntry>

Public Types

enum  StandardFieldTypes {
  UDS_STRING = 0x01000000, UDS_NUMBER = 0x02000000, UDS_TIME = 0x04000000 | UDS_NUMBER, UDS_SIZE = 1 | UDS_NUMBER,
  UDS_SIZE_LARGE = 2 | UDS_NUMBER, UDS_USER = 3 | UDS_STRING, UDS_ICON_NAME = 4 | UDS_STRING, UDS_GROUP = 5 | UDS_STRING,
  UDS_NAME = 6 | UDS_STRING, UDS_LOCAL_PATH = 7 | UDS_STRING, UDS_HIDDEN = 8 | UDS_NUMBER, UDS_ACCESS = 9 | UDS_NUMBER,
  UDS_MODIFICATION_TIME = 10 | UDS_TIME, UDS_ACCESS_TIME = 11 | UDS_TIME, UDS_CREATION_TIME = 12 | UDS_TIME, UDS_FILE_TYPE = 13 | UDS_NUMBER,
  UDS_LINK_DEST = 14 | UDS_STRING, UDS_URL = 15 | UDS_STRING, UDS_MIME_TYPE = 16 | UDS_STRING, UDS_GUESSED_MIME_TYPE = 17 | UDS_STRING,
  UDS_XML_PROPERTIES = 18 | UDS_STRING, UDS_EXTENDED_ACL = 19 | UDS_NUMBER, UDS_ACL_STRING = 20 | UDS_STRING, UDS_DEFAULT_ACL_STRING = 21 | UDS_STRING,
  UDS_DISPLAY_NAME = 22 | UDS_STRING, UDS_TARGET_URL = 23 | UDS_STRING, UDS_DISPLAY_TYPE = 24 | UDS_STRING, UDS_ICON_OVERLAY_NAMES = 26 | UDS_STRING,
  UDS_COMMENT = 28 | UDS_STRING, UDS_DEVICE_ID = 29 | UDS_NUMBER, UDS_INODE = 30 | UDS_NUMBER, UDS_RECURSIVE_SIZE = 31 | UDS_NUMBER,
  UDS_EXTRA = 100 | UDS_STRING, UDS_EXTRA_END = 140 | UDS_STRING
}
 

Public Member Functions

 UDSEntry (const QT_STATBUF &buff, const QString &name=QString())
 
 UDSEntry (const UDSEntry &)
 
 UDSEntry (UDSEntry &&)
 
 ~UDSEntry ()
 
void clear ()
 
bool contains (uint field) const
 
int count () const
 
void fastInsert (uint field, const QString &value)
 
void fastInsert (uint field, long long l)
 
QVector< uint > fields () const
 
void insert (uint field, const QString &value)
 
void insert (uint field, long long l)
 
bool isDir () const
 
bool isLink () const
 
QList< uint > listFields () const
 
long long numberValue (uint field, long long defaultValue=0) const
 
UDSEntryoperator= (const UDSEntry &)
 
UDSEntryoperator= (UDSEntry &&)
 
void replace (uint field, const QString &value)
 
void replace (uint field, long long l)
 
void reserve (int size)
 
QString stringValue (uint field) const
 

Detailed Description

Universal Directory Service

UDS entry is the data structure representing all the fields about a given URL (file or directory).

The KIO::listDir() and KIO:stat() operations use this data structure.

KIO defines a number of standard fields, see the UDS_XXX enums (see StandardFieldTypes). at the moment UDSEntry only provides fields with numeric indexes, but there might be named fields with string indexes in the future.

For instance, to retrieve the name of the entry, use:

To know the modification time of the file/url:

Definition at line 77 of file udsentry.h.

Member Enumeration Documentation

◆ StandardFieldTypes

Constants used to specify the type of a UDSField.

Enumerator
UDS_STRING 

Indicates that the field is a QString.

UDS_NUMBER 

Indicates that the field is a number (long long)

UDS_TIME 

Indicates that the field represents a time, which is modelled by a long long.

UDS_SIZE 

Size of the file.

UDS_SIZE_LARGE 
UDS_USER 

User ID of the file owner.

UDS_ICON_NAME 

Name of the icon, that should be used for displaying.

It overrides all other detection mechanisms

UDS_GROUP 

Group ID of the file owner.

UDS_NAME 

Filename - as displayed in directory listings etc.

"." has the usual special meaning of "current directory" UDS_NAME must always be set and never be empty, neither contain '/'.

Note that KIO will append the UDS_NAME to the url of their parent directory, so all KIO workers must use that naming scheme ("url_of_parent/filename" will be the full url of that file). To customize the appearance of files without changing the url of the items, use UDS_DISPLAY_NAME.

UDS_LOCAL_PATH 

A local file path if the KIO worker display files sitting on the local filesystem (but in another hierarchy, e.g. settings:/ or remote:/)

UDS_HIDDEN 

Treat the file as a hidden file (if set to 1) or as a normal file (if set to 0).

This field overrides the default behavior (the check for a leading dot in the filename).

UDS_ACCESS 

Access permissions (part of the mode returned by stat)

UDS_MODIFICATION_TIME 

The last time the file was modified. Required time format: seconds since UNIX epoch.

UDS_ACCESS_TIME 

The last time the file was opened. Required time format: seconds since UNIX epoch.

UDS_CREATION_TIME 

The time the file was created. Required time format: seconds since UNIX epoch.

UDS_FILE_TYPE 

File type, part of the mode returned by stat (for a link, this returns the file type of the pointed item) check UDS_LINK_DEST to know if this is a link.

UDS_LINK_DEST 

Name of the file where the link points to Allows to check for a symlink (don't use S_ISLNK !)

UDS_URL 

An alternative URL (If different from the caption).

Can be used to mix different hierarchies.

Use UDS_DISPLAY_NAME if you simply want to customize the user-visible filenames, or use UDS_TARGET_URL if you want "links" to unrelated urls.

UDS_MIME_TYPE 

A MIME type; the KIO worker should set it if it's known.

UDS_GUESSED_MIME_TYPE 

A MIME type to be used for displaying only.

But when 'running' the file, the MIME type is re-determined This is for special cases like symlinks in FTP; you probably don't want to use this one.

UDS_XML_PROPERTIES 

XML properties, e.g. for WebDAV.

UDS_EXTENDED_ACL 

Indicates that the entry has extended ACL entries.

UDS_ACL_STRING 

The access control list serialized into a single string.

UDS_DEFAULT_ACL_STRING 

The default access control list serialized into a single string.

Only available for directories.

UDS_DISPLAY_NAME 

If set, contains the label to display instead of the 'real name' in UDS_NAME.

Since
4.1
UDS_TARGET_URL 

This file is a shortcut or mount, pointing to an URL in a different hierarchy.

Since
4.1
UDS_DISPLAY_TYPE 

User-readable type of file (if not specified, the MIME type's description is used)

Since
4.4
UDS_ICON_OVERLAY_NAMES 

25 was used by the now removed UDS_NEPOMUK_URI

A comma-separated list of supplementary icon overlays which will be added to the list of overlays created by KFileItem.

Since
4.5
UDS_COMMENT 

27 was used by the now removed UDS_NEPOMUK_QUERY

A comment which will be displayed as is to the user. The string value may contain plain text or Qt-style rich-text extensions.

Since
4.6
UDS_DEVICE_ID 

Device number for this file, used to detect hardlinks.

Since
4.7.3
UDS_INODE 

Inode number for this file, used to detect hardlinks.

Since
4.7.3
UDS_RECURSIVE_SIZE 

For folders, the recursize size of its content.

Since
5.70
UDS_EXTRA 

Extra data (used only if you specified Columns/ColumnsTypes) NB: you cannot repeat this entry; use UDS_EXTRA + i until UDS_EXTRA_END.

UDS_EXTRA_END 

Extra data (used only if you specified Columns/ColumnsTypes) NB: you cannot repeat this entry; use UDS_EXTRA + i until UDS_EXTRA_END.

Definition at line 217 of file udsentry.h.

Constructor & Destructor Documentation

◆ UDSEntry() [1/3]

UDSEntry::UDSEntry ( const QT_STATBUF &  buff,
const QString name = QString() 
)

Create a UDSEntry by QT_STATBUF.

Parameters
buffQT_STATBUF object
namefilename
Since
5.0

Definition at line 348 of file udsentry.cpp.

◆ UDSEntry() [2/3]

UDSEntry::UDSEntry ( const UDSEntry )
default

Copy constructor.

◆ ~UDSEntry()

UDSEntry::~UDSEntry ( )
default

Destructor.

◆ UDSEntry() [3/3]

UDSEntry::UDSEntry ( UDSEntry &&  )
default

Move constructor.

Since
5.44

Member Function Documentation

◆ clear()

void UDSEntry::clear ( )

remove all fields

Definition at line 457 of file udsentry.cpp.

◆ contains()

bool UDSEntry::contains ( uint  field) const

check existence of a field

Parameters
fieldnumeric field id

Definition at line 452 of file udsentry.cpp.

◆ count()

int UDSEntry::count ( ) const

count fields

Returns
the number of fields

Definition at line 447 of file udsentry.cpp.

◆ fastInsert() [1/2]

void UDSEntry::fastInsert ( uint  field,
const QString value 
)

insert field with string value, it will assert if the field is already inserted.

In that case, use replace() instead.

Parameters
fieldnumeric field id
valueto set
Since
5.48

Definition at line 401 of file udsentry.cpp.

◆ fastInsert() [2/2]

void UDSEntry::fastInsert ( uint  field,
long long  l 
)

insert field with numeric value, it will assert if the field is already inserted.

In that case, use replace() instead.

Parameters
fieldnumeric field id
lvalue to set
Since
5.48

Definition at line 406 of file udsentry.cpp.

◆ fields()

QVector< uint > UDSEntry::fields ( ) const

A vector of fields being present for the current entry.

Returns
all fields for the current entry.
Since
5.8

Definition at line 442 of file udsentry.cpp.

◆ insert() [1/2]

void UDSEntry::insert ( uint  field,
const QString value 
)

insert field with string value

Parameters
fieldnumeric field id
valueto set
Deprecated:
since 5.48 in favor of fastInsert or replace

Definition at line 412 of file udsentry.cpp.

◆ insert() [2/2]

void UDSEntry::insert ( uint  field,
long long  l 
)

insert field with numeric value

Parameters
fieldnumeric field id
lvalue to set
Deprecated:
since 5.48 in favor of fastInsert or replace

Definition at line 419 of file udsentry.cpp.

◆ isDir()

bool UDSEntry::isDir ( ) const
Returns
true if this entry is a directory (or a link to a directory)

Definition at line 386 of file udsentry.cpp.

◆ isLink()

bool UDSEntry::isLink ( ) const
Returns
true if this entry is a link

Definition at line 391 of file udsentry.cpp.

◆ listFields()

QList< uint > UDSEntry::listFields ( ) const

List all fields.

Returns
all fields.
Deprecated:
since 5.8. Use fields() instead.

Definition at line 436 of file udsentry.cpp.

◆ numberValue()

long long UDSEntry::numberValue ( uint  field,
long long  defaultValue = 0 
) const
Returns
value of a numeric field

Definition at line 381 of file udsentry.cpp.

◆ operator=() [1/2]

UDSEntry & UDSEntry::operator= ( const UDSEntry )
default

Copy assignment.

◆ operator=() [2/2]

UDSEntry & UDSEntry::operator= ( UDSEntry &&  )
default

Move assignment.

Since
5.44

◆ replace() [1/2]

void UDSEntry::replace ( uint  field,
const QString value 
)

Replace or insert field with string value.

Parameters
fieldnumeric field id
valueto set
Since
5.47

Definition at line 425 of file udsentry.cpp.

◆ replace() [2/2]

void UDSEntry::replace ( uint  field,
long long  l 
)

Replace or insert field with numeric value.

Parameters
fieldnumeric field id
lvalue to set
Since
5.47

Definition at line 430 of file udsentry.cpp.

◆ reserve()

void UDSEntry::reserve ( int  size)

Calling this function before inserting items into an empty UDSEntry may save time and memory.

Parameters
sizenumber of items for which memory will be pre-allocated

Definition at line 396 of file udsentry.cpp.

◆ stringValue()

QString UDSEntry::stringValue ( uint  field) const
Returns
value of a textual field

Definition at line 376 of file udsentry.cpp.


The documentation for this class was generated from the following files:
@ UDS_NAME
Filename - as displayed in directory listings etc.
Definition: udsentry.h:249
QString stringValue(uint field) const
Definition: udsentry.cpp:376
AKONADI_CALENDAR_EXPORT QString displayName(Akonadi::ETMCalendar *calendar, const Akonadi::Collection &collection)
long long numberValue(uint field, long long defaultValue=0) const
Definition: udsentry.cpp:381
@ UDS_MODIFICATION_TIME
The last time the file was modified. Required time format: seconds since UNIX epoch.
Definition: udsentry.h:259
QDateTime fromSecsSinceEpoch(qint64 secs, Qt::TimeSpec spec, int offsetSeconds)
bool isValid() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Tue Dec 6 2022 03:56:08 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.