Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# TQUrlInfo Class Reference

The TQUrlInfo class stores information about URLs. More...

`#include <ntqurlinfo.h>`

List of all member functions.

## Public Members

- enum PermissionSpec { ReadOwner = 00400, WriteOwner = 00200, ExeOwner = 00100, ReadGroup = 00040, WriteGroup = 00020, ExeGroup = 00010, ReadOther = 00004, WriteOther = 00002, ExeOther = 00001 }
- TQUrlInfo ()
- TQUrlInfo ( const TQUrlOperator & path, const TQString & file )
- TQUrlInfo ( const TQUrlInfo & ui )
- TQUrlInfo ( const TQString & name, int permissions, const TQString & owner, const TQString & group, uint size, const TQDateTime & lastModified, const TQDateTime & lastRead, bool isDir, bool isFile, bool isSymLink, bool isWritable, bool isReadable, bool isExecutable )
- TQUrlInfo ( const TQUrl & url, int permissions, const TQString & owner, const TQString & group, uint size, const TQDateTime & lastModified, const TQDateTime & lastRead, bool isDir, bool isFile, bool isSymLink, bool isWritable, bool isReadable, bool isExecutable )
- TQUrlInfo & operator= ( const TQUrlInfo & ui )
- virtual ~TQUrlInfo ()
- virtual void setName ( const TQString & name )
- virtual void setDir ( bool b )
- virtual void setFile ( bool b )
- virtual void setSymLink ( bool b )
- virtual void setOwner ( const TQString & s )
- virtual void setGroup ( const TQString & s )
- virtual void setSize ( uint size )
- virtual void setWritable ( bool b )
- virtual void setReadable ( bool b )
- virtual void setPermissions ( int p )
- virtual void setLastModified ( const TQDateTime & dt )
- bool isValid () const
- TQString name () const
- int permissions () const
- TQString owner () const
- TQString group () const
- uint size () const
- TQDateTime lastModified () const
- TQDateTime lastRead () const
- bool isDir () const
- bool isFile () const
- bool isSymLink () const
- bool isWritable () const
- bool isReadable () const
- bool isExecutable () const
- bool operator== ( const TQUrlInfo & i ) const

## Static Public Members

- bool greaterThan ( const TQUrlInfo & i1, const TQUrlInfo & i2, int sortBy )
- bool lessThan ( const TQUrlInfo & i1, const TQUrlInfo & i2, int sortBy )
- bool equal ( const TQUrlInfo & i1, const TQUrlInfo & i2, int sortBy )

## Detailed Description

The TQUrlInfo class stores information about URLs.

This class is just a container for storing information about URLs, which is why all information must be passed in the constructor.

Unless you're reimplementing a network protocol you're unlikely to create TQUrlInfo objects yourself, but you may receive TQUrlInfo objects from functions, e.g. TQUrlOperator::info().

The information that can be retrieved includes name(), permissions(), owner(), group(), size(), lastModified(), lastRead(), isDir(), isFile(), isSymLink(), isWritable(), isReadable() and isExecutable().

See also Input/Output and Networking and Miscellaneous Classes.

## Member Type Documentation

### TQUrlInfo::PermissionSpec

This enum is used by the permissions() function to report the permissions of a file.

- `TQUrlInfo::ReadOwner` - The file is readable by the owner of the file.
- `TQUrlInfo::WriteOwner` - The file is writable by the owner of the file.
- `TQUrlInfo::ExeOwner` - The file is executable by the owner of the file.
- `TQUrlInfo::ReadGroup` - The file is readable by the group.
- `TQUrlInfo::WriteGroup` - The file is writable by the group.
- `TQUrlInfo::ExeGroup` - The file is executable by the group.
- `TQUrlInfo::ReadOther` - The file is readable by anyone.
- `TQUrlInfo::WriteOther` - The file is writable by anyone.
- `TQUrlInfo::ExeOther` - The file is executable by anyone.

## Member Function Documentation

### TQUrlInfo::TQUrlInfo ()

Constructs an invalid TQUrlInfo object with default values.

See also isValid().

### TQUrlInfo::TQUrlInfo ( const TQUrlOperator & path, const TQString & file )

Constructs a TQUrlInfo object with information about the file file in the path. It tries to find the information about the file in the TQUrlOperator path.

If the information is not found, this constructor creates an invalid TQUrlInfo, i.e. isValid() returns FALSE. You should always check if the URL info is valid before relying on the return values of any getter functions.

If file is empty, it defaults to the TQUrlOperator path, i.e. to the directory.

See also isValid() and TQUrlOperator::info().

### TQUrlInfo::TQUrlInfo ( const TQUrlInfo & ui )

Copy constructor, copies ui to this URL info object.

### TQUrlInfo::TQUrlInfo ( const TQString & name, int permissions, const TQString & owner, const TQString & group, uint size, const TQDateTime & lastModified, const TQDateTime & lastRead, bool isDir, bool isFile, bool isSymLink, bool isWritable, bool isReadable, bool isExecutable )

Constructs a TQUrlInfo object by specifying all the URL's information.

The information that is passed is the name, file permissions, owner and group and the file's size. Also passed is the lastModified date/time and the lastRead date/time. Flags are also passed, specifically, isDir, isFile, isSymLink, isWritable, isReadable and isExecutable.

### TQUrlInfo::TQUrlInfo ( const TQUrl & url, int permissions, const TQString & owner, const TQString & group, uint size, const TQDateTime & lastModified, const TQDateTime & lastRead, bool isDir, bool isFile, bool isSymLink, bool isWritable, bool isReadable, bool isExecutable )

Constructs a TQUrlInfo object by specifying all the URL's information.

The information that is passed is the url, file permissions, owner and group and the file's size. Also passed is the lastModified date/time and the lastRead date/time. Flags are also passed, specifically, isDir, isFile, isSymLink, isWritable, isReadable and isExecutable.

### TQUrlInfo::~TQUrlInfo ()`[virtual]`

Destroys the URL info object.

The TQUrlOperator object to which this URL referred (if any) is not affected.

### bool TQUrlInfo::equal ( const TQUrlInfo & i1, const TQUrlInfo & i2, int sortBy )`[static]`

Returns TRUE if i1 equals to i2; otherwise returns FALSE. The objects are compared by the value, which is specified by sortBy. This must be one of TQDir::Name, TQDir::Time or TQDir::Size.

### bool TQUrlInfo::greaterThan ( const TQUrlInfo & i1, const TQUrlInfo & i2, int sortBy )`[static]`

Returns TRUE if i1 is greater than i2; otherwise returns FALSE. The objects are compared by the value, which is specified by sortBy. This must be one of TQDir::Name, TQDir::Time or TQDir::Size.

### TQString TQUrlInfo::group () const

Returns the group of the URL.

See also isValid().

### bool TQUrlInfo::isDir () const

Returns TRUE if the URL is a directory; otherwise returns FALSE.

See also isValid().

Examples: network/ftpclient/ftpmainwindow.ui.h and network/networkprotocol/nntp.cpp.

### bool TQUrlInfo::isExecutable () const

Returns TRUE if the URL is executable; otherwise returns FALSE.

See also isValid().

### bool TQUrlInfo::isFile () const

Returns TRUE if the URL is a file; otherwise returns FALSE.

See also isValid().

### bool TQUrlInfo::isReadable () const

Returns TRUE if the URL is readable; otherwise returns FALSE.

See also isValid().

### bool TQUrlInfo::isSymLink () const

Returns TRUE if the URL is a symbolic link; otherwise returns FALSE.

See also isValid().

### bool TQUrlInfo::isValid () const

Returns TRUE if the URL info is valid; otherwise returns FALSE. Valid means that the TQUrlInfo contains real information. For example, a call to TQUrlOperator::info() might return a an invalid TQUrlInfo, if no information about the requested entry is available.

You should always check if the URL info is valid before relying on the values.

### bool TQUrlInfo::isWritable () const

Returns TRUE if the URL is writable; otherwise returns FALSE.

See also isValid().

### TQDateTime TQUrlInfo::lastModified () const

Returns the last modification date of the URL.

See also isValid().

Example: network/ftpclient/ftpmainwindow.ui.h.

### TQDateTime TQUrlInfo::lastRead () const

Returns the date when the URL was last read.

See also isValid().

### bool TQUrlInfo::lessThan ( const TQUrlInfo & i1, const TQUrlInfo & i2, int sortBy )`[static]`

Returns TRUE if i1 is less than i2; otherwise returns FALSE. The objects are compared by the value, which is specified by sortBy. This must be one of TQDir::Name, TQDir::Time or TQDir::Size.

### TQString TQUrlInfo::name () const

Returns the file name of the URL.

See also isValid().

Example: network/ftpclient/ftpmainwindow.ui.h.

### TQUrlInfo & TQUrlInfo::operator= ( const TQUrlInfo & ui )

Assigns the values of ui to this TQUrlInfo object.

### bool TQUrlInfo::operator== ( const TQUrlInfo & i ) const

Compares this TQUrlInfo with i and returns TRUE if they are equal; otherwise returns FALSE.

### TQString TQUrlInfo::owner () const

Returns the owner of the URL.

See also isValid().

### int TQUrlInfo::permissions () const

Returns the permissions of the URL. You can use the PermissionSpec flags to test for certain permissions.

See also isValid().

### void TQUrlInfo::setDir ( bool b )`[virtual]`

If b is TRUE then the URL is set to be a directory; if \b is FALSE then the URL is set not to be a directory (which normally means it is a file). (Note that a URL can refer to both a file and a directory even though most file systems do not support this.)

If you call this function for an invalid URL info, this function turns it into a valid one.

See also isValid().

Example: network/networkprotocol/nntp.cpp.

### void TQUrlInfo::setFile ( bool b )`[virtual]`

If b is TRUE then the URL is set to be a file; if \b is FALSE then the URL is set not to be a file (which normally means it is a directory). (Note that a URL can refer to both a file and a directory even though most file systems do not support this.)

If you call this function for an invalid URL info, this function turns it into a valid one.

See also isValid().

Example: network/networkprotocol/nntp.cpp.

### void TQUrlInfo::setGroup ( const TQString & s )`[virtual]`

Specifies that the owning group of the URL is called s.

If you call this function for an invalid URL info, this function turns it into a valid one.

See also isValid().

### void TQUrlInfo::setLastModified ( const TQDateTime & dt )`[virtual]`

Specifies that the object the URL refers to was last modified at dt.

If you call this function for an invalid URL info, this function turns it into a valid one.

See also isValid().

### void TQUrlInfo::setName ( const TQString & name )`[virtual]`

Sets the name of the URL to name. The name is the full text, for example, "http://doc.trolltech.com/ntqurlinfo.html".

If you call this function for an invalid URL info, this function turns it into a valid one.

See also isValid().

Example: network/networkprotocol/nntp.cpp.

### void TQUrlInfo::setOwner ( const TQString & s )`[virtual]`

Specifies that the owner of the URL is called s.

If you call this function for an invalid URL info, this function turns it into a valid one.

See also isValid().

### void TQUrlInfo::setPermissions ( int p )`[virtual]`

Specifies that the URL has access permisions, p.

If you call this function for an invalid URL info, this function turns it into a valid one.

See also isValid().

### void TQUrlInfo::setReadable ( bool b )`[virtual]`

Specifies that the URL is readable if b is TRUE and not readable if b is FALSE.

If you call this function for an invalid URL info, this function turns it into a valid one.

See also isValid().

Example: network/networkprotocol/nntp.cpp.

### void TQUrlInfo::setSize ( uint size )`[virtual]`

Specifies the size of the URL.

If you call this function for an invalid URL info, this function turns it into a valid one.

See also isValid().

### void TQUrlInfo::setSymLink ( bool b )`[virtual]`

Specifies that the URL refers to a symbolic link if b is TRUE and that it does not if b is FALSE.

If you call this function for an invalid URL info, this function turns it into a valid one.

See also isValid().

Example: network/networkprotocol/nntp.cpp.

### void TQUrlInfo::setWritable ( bool b )`[virtual]`

Specifies that the URL is writable if b is TRUE and not writable if b is FALSE.

If you call this function for an invalid URL info, this function turns it into a valid one.

See also isValid().

Example: network/networkprotocol/nntp.cpp.

### uint TQUrlInfo::size () const

Returns the size of the URL.

See also isValid().

Example: network/ftpclient/ftpmainwindow.ui.h.

This file is part of the TQt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.