doc, small fixes

This commit is contained in:
2022-05-08 19:23:52 +03:00
parent 460519c075
commit 3107949e6f
24 changed files with 1061 additions and 406 deletions

View File

@@ -45,17 +45,16 @@ extern "C" {
# include <sys/stat.h>
#endif
/*! \class PIDir
* \brief Local directory
*
* \section PIDir_sec0 Synopsis
* This class provide access to local file. You can manipulate
* binary content or use this class as text stream. To binary
* access there are function \a read(), \a write(), and many
* \a writeBinary() functions. For write variables to file in
* their text representation threr are many "<<" operators.
*
*/
//! \class PIDir pidir.h
//! \details
//! \~english \section PIDir_sec0 Synopsis
//! \~russian \section PIDir_sec0 Краткий обзор
//! \~english
//! This class provide access to local directory.
//!
//! \~russian
//!
PIDir::PIDir(const PIString & dir) {
@@ -115,6 +114,15 @@ PIString PIDir::absolutePath() const {
}
//! \details
//! \~english
//! This function remove repeatedly separators and
//! resolve ".." in path. E.g. "/home/.//user/src/../.." will
//! become "/home". \n Returns reference to this %PIDir
//! \~russian
//! Этот метод удаляет повторяющиеся разделители и разрешает
//! "..". Например, путь "/home/.//user/src/../.." станет "/home". \n
//! Возвращает ссылку на этот %PIDir
PIDir & PIDir::cleanPath() {
PIString p(path_);
if (p.isEmpty()) {
@@ -236,6 +244,14 @@ bool PIDir::make(bool withParents) {
}
bool PIDir::rename(const PIString & new_name) {
if (!PIDir::rename(path(), new_name))
return false;
setDir(new_name);
return true;
}
#ifdef WINDOWS
bool sort_compare(const PIFile::FileInfo & v0, const PIFile::FileInfo & v1) {
return strcoll(v0.path.data(), v1.path.data()) < 0;
@@ -243,6 +259,20 @@ bool sort_compare(const PIFile::FileInfo & v0, const PIFile::FileInfo & v1) {
#endif
//! \~\details
//! \~english
//! 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!
//! \~russian
//! Читает директорию и возвращает все директории и файлы
//! одним списком, сортированным по алфавиту. Список содержит
//! также "." и "..". Возвращаются абсолютные пути.
//! \attention Этот метод не читает содержимое директорий
//! рекурсивно!
PIVector<PIFile::FileInfo> PIDir::entries() {
PIVector<PIFile::FileInfo> l;
if (!isExists()) return l;
@@ -322,6 +352,18 @@ PIVector<PIFile::FileInfo> PIDir::entries() {
}
//! \~\details
//! \~english
//! 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.
//! \~russian
//! Читает директорию рекурсивно и возвращает все директории и файлы
//! одним списком, сортированным по алфавиту. Список не содержит
//! "." и "..". Возвращаются абсолютные пути, причём файлы
//! располагаются после директорий.
PIVector<PIFile::FileInfo> PIDir::allEntries() {
PIVector<PIFile::FileInfo> ret;
PIVector<PIFile::FileInfo> dirs;