doc, small fixes
This commit is contained in:
@@ -29,93 +29,146 @@
|
||||
#include "pifile.h"
|
||||
|
||||
|
||||
//! \ingroup IO
|
||||
//! \~\brief
|
||||
//! \~english Local directory.
|
||||
//! \~russian Локальная директория.
|
||||
class PIP_EXPORT PIDir
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructs directory with path "path"
|
||||
//! \~english Constructs directory with path "dir"
|
||||
//! \~russian Создает директорию с путём "dir"
|
||||
PIDir(const PIString & dir = PIString());
|
||||
|
||||
//! Constructs directory with "file" directory path "path"
|
||||
//! \~english Constructs directory with "file" directory path
|
||||
//! \~russian Создает директорию с путём директории файла "file"
|
||||
PIDir(const PIFile & file);
|
||||
|
||||
|
||||
//! Returns if this directory is exists
|
||||
//! \~english Returns if this directory exists
|
||||
//! \~russian Возвращает существует ли эта директория
|
||||
bool isExists() const {return PIDir::isExists(path());}
|
||||
|
||||
//! Returns if path of this directory is absolute
|
||||
//! \~english Returns if path of this directory is absolute
|
||||
//! \~russian Возвращает абсолютный ли путь у директории
|
||||
bool isAbsolute() const;
|
||||
|
||||
//! Returns if path of this directory is relative
|
||||
//! \~english Returns if path of this directory is relative
|
||||
//! \~russian Возвращает относительный ли путь у директории
|
||||
bool isRelative() const {return !isAbsolute();}
|
||||
|
||||
//! Returns path of current reading directory. This path
|
||||
//! valid only while \a allEntries functions
|
||||
|
||||
//! \~english Returns path of current reading directory. This path valid only while \a allEntries() functions
|
||||
//! \~russian Возвращает путь текущей директории чтения. Этот путь действителен только во время выполнения метода \a allEntries()
|
||||
const PIString & scanDir() const {return scan_;}
|
||||
|
||||
|
||||
//! Returns path of this directory
|
||||
//! \~english Returns path of this directory
|
||||
//! \~russian Возвращает путь директории
|
||||
PIString path() const;
|
||||
|
||||
//! Returns absolute path of this directory
|
||||
//! \~english Returns absolute path of this directory
|
||||
//! \~russian Возвращает абсолютный путь директории
|
||||
PIString absolutePath() const;
|
||||
|
||||
/** \brief Simplify path of this directory
|
||||
* \details This function remove repeatedly separators and
|
||||
* resolve ".." in path. E.g. "/home/.//peri4/src/../.." will
|
||||
* become "/home" \n This function returns reference to this %PIDir */
|
||||
//! \~english Simplify path of this directory
|
||||
//! \~russian Упрощает путь директории
|
||||
PIDir & cleanPath();
|
||||
|
||||
//! Returns %PIDir with simplified path of this directory
|
||||
//! \~english Returns %PIDir with simplified path of this directory
|
||||
//! \~russian Возвращает %PIDir с упрощённым путём директории
|
||||
PIDir cleanedPath() const {PIDir d(path()); d.cleanPath(); return d;}
|
||||
|
||||
//! Returns relative to this directory path "path"
|
||||
//! \~english Returns relative to this directory path "path"
|
||||
//! \~russian Возвращает путь "path" относительно этой директории
|
||||
PIString relative(const PIString & path) const;
|
||||
|
||||
//! Set this directory path to simplified "path"
|
||||
//! \~english Set this directory path to simplified "path"
|
||||
//! \~russian Устанавливает путь директории упрощённым "path"
|
||||
PIDir & setDir(const PIString & path);
|
||||
|
||||
//! Set this directory path as current for application
|
||||
//! \~english Set this directory path as current for application
|
||||
//! \~russian Устанавливает путь директории текущим путём приложения
|
||||
bool setCurrent() {return PIDir::setCurrent(path());}
|
||||
|
||||
|
||||
/** \brief Returns this directory content
|
||||
* \details Scan this directory and returns all directories
|
||||
* and files in one list, sorted alphabetically. This list
|
||||
* contains also "." and ".." members. There are absolute
|
||||
* pathes in returned list.
|
||||
* \attention This function doesn`t scan content of inner
|
||||
* directories! */
|
||||
//! \~english Returns this directory content
|
||||
//! \~russian Возвращает содержимое этой директории
|
||||
PIVector<PIFile::FileInfo> entries();
|
||||
|
||||
/** \brief Returns all this directory content
|
||||
* \details Scan this directory recursively and returns all
|
||||
* directories and files in one list, sorted alphabetically.
|
||||
* This list doesn`t contains "." and ".." members. There
|
||||
* are absolute pathes in returned list, and
|
||||
* files placed after directories in this list */
|
||||
//! \~english Returns this directory content recursively
|
||||
//! \~russian Возвращает содержимое этой директории рекурсивно
|
||||
PIVector<PIFile::FileInfo> allEntries();
|
||||
|
||||
//! \~english Make this directory, recursively if "withParents"
|
||||
//! \~russian Создаёт эту директорию, рекурсивно если "withParents"
|
||||
bool make(bool withParents = true);
|
||||
|
||||
//! \~english Remove this directory
|
||||
//! \~russian Удаляет эту директорию
|
||||
bool remove() {return PIDir::remove(path());}
|
||||
bool rename(const PIString & new_name) {if (!PIDir::rename(path(), new_name)) return false; setDir(new_name); return true;}
|
||||
|
||||
//! \~english Rename this directory
|
||||
//! \~russian Переименовывает эту директорию
|
||||
bool rename(const PIString & new_name);
|
||||
|
||||
//! \~english Change this directory to relative path "path"
|
||||
//! \~russian Изменяет директорию на относительный путь "path"
|
||||
PIDir & cd(const PIString & path);
|
||||
|
||||
//! \~english Change this directory to parent
|
||||
//! \~russian Изменяет директорию на родительскую
|
||||
PIDir & up() {return cd("..");}
|
||||
|
||||
//! \~english Compare operator
|
||||
//! \~russian Оператор сравнения
|
||||
bool operator ==(const PIDir & d) const;
|
||||
|
||||
//! \~english Compare operator
|
||||
//! \~russian Оператор сравнения
|
||||
bool operator !=(const PIDir & d) const {return !((*this) == d);}
|
||||
|
||||
static const PIChar separator;
|
||||
|
||||
|
||||
//! \~english Returns current directory for application
|
||||
//! \~russian Возвращает текущую директорию приложения
|
||||
static PIDir current();
|
||||
|
||||
//! \~english Returns user home directory
|
||||
//! \~russian Возвращает домашнюю директорию пользователя
|
||||
static PIDir home();
|
||||
|
||||
//! \~english Returns temporary directory
|
||||
//! \~russian Возвращает временную директорию
|
||||
static PIDir temporary();
|
||||
|
||||
//! \~english Returns directory "path" content recursively
|
||||
//! \~russian Возвращает содержимое директории "path" рекурсивно
|
||||
static PIVector<PIFile::FileInfo> allEntries(const PIString & path);
|
||||
|
||||
//! \~english Returns if directory "path" exists
|
||||
//! \~russian Возвращает существует ли эта директория
|
||||
static bool isExists(const PIString & path);
|
||||
|
||||
//! \~english Make directory "path", recursively if "withParents"
|
||||
//! \~russian Создаёт директорию "path", рекурсивно если "withParents"
|
||||
static bool make(const PIString & path, bool withParents = true);
|
||||
|
||||
//! \~english Remove directory "path"
|
||||
//! \~russian Удаляет директорию "path"
|
||||
static bool remove(const PIString & path) {return removeDir(path);}
|
||||
|
||||
//! \~english Rename directory "path"
|
||||
//! \~russian Переименовывает директорию "path"
|
||||
static bool rename(const PIString & path, const PIString & new_name) {return PIDir::renameDir(path, new_name);}
|
||||
|
||||
//! \~english Set path "path" as current for application
|
||||
//! \~russian Устанавливает путь "path" текущим путём приложения
|
||||
static bool setCurrent(const PIString & path);
|
||||
|
||||
//! \~english Set directory "dir" path as current for application
|
||||
//! \~russian Устанавливает путь директории "dir" текущим путём приложения
|
||||
static bool setCurrent(const PIDir & dir) {return setCurrent(dir.path());}
|
||||
|
||||
private:
|
||||
@@ -133,6 +186,9 @@ inline bool operator >(const PIFile::FileInfo & v0, const PIFile::FileInfo & v1
|
||||
inline bool operator ==(const PIFile::FileInfo & v0, const PIFile::FileInfo & v1) {return (v0.path == v1.path);}
|
||||
inline bool operator !=(const PIFile::FileInfo & v0, const PIFile::FileInfo & v1) {return (v0.path != v1.path);}
|
||||
|
||||
//! \relatesalso PICout
|
||||
//! \~english Output operator to \a PICout
|
||||
//! \~russian Оператор вывода в \a PICout
|
||||
inline PICout operator <<(PICout s, const PIDir & v) {s.setControl(0, true); s << "PIDir(\"" << v.path() << "\")"; s.restoreControl(); return s;}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user