KIO::UDSEntry

Search for usage in LXR

KIO::UDSEntry Class Reference

#include <KIO/UDSEntry>

Public Types

enum  ItemTypes { UDS_STRING = 0x01000000 , UDS_NUMBER = 0x02000000 , UDS_TIME = 0x04000000 | UDS_NUMBER }
 
enum  StandardFieldTypes {
  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 = 25 | UDS_STRING , UDS_COMMENT = 26 | UDS_STRING , UDS_DEVICE_ID = 27 | UDS_NUMBER , UDS_INODE = 28 | UDS_NUMBER ,
  UDS_RECURSIVE_SIZE = 29 | UDS_NUMBER , UDS_LOCAL_USER_ID = 30 | UDS_NUMBER , UDS_LOCAL_GROUP_ID = 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)
 
QList< uint > fields () const
 
bool isDir () const
 
bool isLink () 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:

QString displayName = entry.stringValue( KIO::UDSEntry::UDS_NAME );
@ UDS_NAME
Filename - as displayed in directory listings etc.
Definition udsentry.h:224

To know the modification time of the file/url:

if (mtime.isValid())
...
@ UDS_MODIFICATION_TIME
The last time the file was modified. Required time format: seconds since UNIX epoch.
Definition udsentry.h:234
QDateTime fromSecsSinceEpoch(qint64 secs)
bool isValid() const const

Definition at line 77 of file udsentry.h.

Member Enumeration Documentation

◆ ItemTypes

Bit field used to specify the item type of a StandardFieldTypes.

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.

Definition at line 185 of file udsentry.h.

◆ StandardFieldTypes

Constants used to specify the type of a UDSEntry’s field.

Enumerator
UDS_SIZE 

Size of the file.

UDS_SIZE_LARGE 
UDS_USER 

User Name of the file owner Not present on local fs, use UDS_LOCAL_USER_ID.

UDS_ICON_NAME 

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

It overrides all other detection mechanisms

UDS_GROUP 

Group Name of the file owner Not present on local fs, use UDS_LOCAL_GROUP_ID.

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 

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 

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_LOCAL_USER_ID 

User ID of the file owner.

Since
6.0
UDS_LOCAL_GROUP_ID 

Group ID of the file owner.

Since
6.0
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 198 of file udsentry.h.

Constructor & Destructor Documentation

◆ UDSEntry() [1/4]

UDSEntry::UDSEntry ( )

Definition at line 331 of file udsentry.cpp.

◆ UDSEntry() [2/4]

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 337 of file udsentry.cpp.

◆ UDSEntry() [3/4]

UDSEntry::UDSEntry ( const UDSEntry & )
default

Copy constructor.

◆ ~UDSEntry()

UDSEntry::~UDSEntry ( )
default

Destructor.

◆ UDSEntry() [4/4]

UDSEntry::UDSEntry ( UDSEntry && )
default

Move constructor.

Since
5.44

Member Function Documentation

◆ clear()

void UDSEntry::clear ( )

remove all fields

Definition at line 425 of file udsentry.cpp.

◆ contains()

bool UDSEntry::contains ( uint field) const

check existence of a field

Parameters
fieldnumeric field id

Definition at line 420 of file udsentry.cpp.

◆ count()

int UDSEntry::count ( ) const

count fields

Returns
the number of fields

Definition at line 415 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 390 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 395 of file udsentry.cpp.

◆ fields()

QList< 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 410 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 375 of file udsentry.cpp.

◆ isLink()

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

Definition at line 380 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 370 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 400 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 405 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 385 of file udsentry.cpp.

◆ stringValue()

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

Definition at line 365 of file udsentry.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:53:30 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.