WARNING: USE THIS SOFTWARE AT YOUR OWN RISK! THIS IS EXPERIMENTAL SOFTWARE NOT INTENDED FOR PRODUCTION USE! Zuble is currently an early stage prototype. As such Zuble is minimally tested and inherently unstable. It is provided for experimental, development, and demonstration purposes only. Zuble QML Types   |  Zuble C++ Classes   |  Zuble Overview
Zuble  0.1
Zuble Framework C++/QML extension API
Public Types | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Properties | List of all members
Zbl::ZDir Class Reference

Access and manipulate file directories. This class is a Javascript wrapper for QDir objects. More...

#include <ZDir.h>

Inheritance diagram for Zbl::ZDir:
Inheritance graph
[legend]
Collaboration diagram for Zbl::ZDir:
Collaboration graph
[legend]

Public Types

enum  Filter {
  Dirs = QDir::Dirs, Files = QDir::Files, Drives = QDir::Drives, NoSymLinks = QDir::NoSymLinks,
  AllEntries = QDir::AllEntries, TypeMask = QDir::TypeMask, Readable = QDir::Readable, Writable = QDir::Writable,
  Executable = QDir::Executable, PermissionMask = QDir::PermissionMask, Modified = QDir::Modified, Hidden = QDir::Hidden,
  System = QDir::System, AccessMask = QDir::AccessMask, AllDirs = QDir::AllDirs, CaseSensitive = QDir::CaseSensitive,
  NoDot = QDir::NoDot, NoDotDot = QDir::NoDotDot, NoDotAndDotDot = QDir::NoDotAndDotDot, NoFilter = QDir::NoFilter
}
 
enum  Sort {
  Name = QDir::Name, Time = QDir::Time, Size = QDir::Size, Unsorted = QDir::Unsorted,
  SortByMask = QDir::SortByMask, DirsFirst = QDir::DirsFirst, Reversed = QDir::Reversed, IgnoreCase = QDir::IgnoreCase,
  DirsLast = QDir::DirsLast, LocaleAware = QDir::LocaleAware, Type = QDir::Type, NoSort = QDir::NoSort
}
 

Signals

void filterChanged ()
 
void pathChanged ()
 
void tagsChanged ()
 

Public Member Functions

 ZDir (QObject *parent=nullptr)
 Constructs a ZDir object. More...
 
 ZDir (const QDir &dir, QObject *parent=nullptr)
 Constructs a ZDir object to wrap a QDir object. More...
 
virtual ~ZDir ()
 
Q_INVOKABLE void setPath (const QString &path)
 
Q_INVOKABLE void setToCurrentPath ()
 
Q_INVOKABLE void setToHomePath ()
 
Q_INVOKABLE bool rename (const QString &oldName, const QString &newName)
 
Q_INVOKABLE void swap (QObject *zDir)
 
Q_INVOKABLE bool setCurrent (const QString &path)
 
Q_INVOKABLE QString currentPath ()
 
Q_INVOKABLE QString homePath ()
 
Q_INVOKABLE QString rootPath ()
 
Q_INVOKABLE QString tempPath ()
 
Q_INVOKABLE QString filePath (const QString &fileName) const
 
Q_INVOKABLE QString absoluteFilePath (const QString &fileName) const
 
Q_INVOKABLE QString relativeFilePath (const QString &fileName) const
 
Q_INVOKABLE bool cd (const QString &dirName)
 
Q_INVOKABLE bool cdUp ()
 
Q_INVOKABLE QString getChildName (int pos)
 
Q_INVOKABLE bool mkdir (const QString &dirName) const
 
Q_INVOKABLE bool rmdir (const QString &dirName) const
 
Q_INVOKABLE bool mkpath (const QString &dirPath) const
 
Q_INVOKABLE bool rmpath (const QString &dirPath) const
 
Q_INVOKABLE bool removeRecursively ()
 
Q_INVOKABLE bool remove (const QString &fileName)
 
Q_INVOKABLE bool fileExists (const QString &name) const
 
Q_INVOKABLE void refresh () const
 
Q_INVOKABLE bool isRelativePath (const QString &path)
 
Q_INVOKABLE bool isAbsolutePath (const QString &path)
 
Q_INVOKABLE bool isRelative () const
 
Q_INVOKABLE bool isAbsolute () const
 
Q_INVOKABLE bool makeAbsolute ()
 
Q_INVOKABLE QString cleanPath (const QString &path)
 
Q_INVOKABLE QObject * entryInfoList (int filters, int sort) const
 Returns a ZFileInfo object describing the contents of the directory. More...
 
Q_INVOKABLE QStringList entryList (int filters, int sort) const
 Returns a QStringList describing the contents of the directory. More...
 
QVariant getTags ()
 
uint getFilter () const
 
void setFilter (uint filters)
 
QString getPath () const
 
QString getAbsolutePath () const
 
QString getCanonicalPath () const
 
QString getDirName () const
 
uint getCount () const
 
bool isReadable () const
 
bool exists () const
 
bool isRoot () const
 

Static Public Member Functions

static void registerType ()
 Registers ZDir as a QML type. More...
 

Protected Member Functions

void initDir ()
 
void validateDir () const
 
void createTags ()
 Constructs a QVariantMap representing constant values for ZDir objects and stores that in a QVariant for later use. More...
 

Protected Attributes

QDir * m_dir
 

Static Protected Attributes

static QVariant m_tags
 

Properties

QVariant tags
 
uint filter
 
QString path
 
QString absolutePath
 
QString canonicalPath
 
QString dirName
 
uint count
 
bool isReadable
 
bool exists
 
bool isRoot
 

Detailed Description

Access and manipulate file directories. This class is a Javascript wrapper for QDir objects.

Definition at line 42 of file ZDir.h.

Member Enumeration Documentation

◆ Filter

Enumerator
Dirs 
Files 
Drives 
NoSymLinks 
AllEntries 
TypeMask 
Readable 
Writable 
Executable 
PermissionMask 
Modified 
Hidden 
System 
AccessMask 
AllDirs 
CaseSensitive 
NoDot 
NoDotDot 
NoDotAndDotDot 
NoFilter 

Definition at line 54 of file ZDir.h.

◆ Sort

Enumerator
Name 
Time 
Size 
Unsorted 
SortByMask 
DirsFirst 
Reversed 
IgnoreCase 
DirsLast 
LocaleAware 
Type 
NoSort 

Definition at line 84 of file ZDir.h.

Constructor & Destructor Documentation

◆ ZDir() [1/2]

Zbl::ZDir::ZDir ( QObject *  parent = nullptr)
explicit

Constructs a ZDir object.

Parameters
parentparent object

Definition at line 42 of file ZDir.cpp.

◆ ZDir() [2/2]

Zbl::ZDir::ZDir ( const QDir &  dir,
QObject *  parent = nullptr 
)
explicit

Constructs a ZDir object to wrap a QDir object.

This method creates a copy of the QDir object and wraps the copy

Parameters
dirReference to a QDir object to wrap
parentparent object

Definition at line 49 of file ZDir.cpp.

◆ ~ZDir()

Zbl::ZDir::~ZDir ( )
virtual

Definition at line 55 of file ZDir.cpp.

Member Function Documentation

◆ absoluteFilePath()

QString Zbl::ZDir::absoluteFilePath ( const QString &  fileName) const

Definition at line 245 of file ZDir.cpp.

◆ cd()

bool Zbl::ZDir::cd ( const QString &  dirName)

Definition at line 261 of file ZDir.cpp.

◆ cdUp()

bool Zbl::ZDir::cdUp ( )

Definition at line 269 of file ZDir.cpp.

◆ cleanPath()

QString Zbl::ZDir::cleanPath ( const QString &  path)

Definition at line 456 of file ZDir.cpp.

◆ createTags()

void Zbl::ZDir::createTags ( )
protected

Constructs a QVariantMap representing constant values for ZDir objects and stores that in a QVariant for later use.

object ZDir::tags returns a dictionary object containing constants for use with the ZDir object

Definition at line 84 of file ZDir.cpp.

Referenced by ZDir().

◆ currentPath()

QString Zbl::ZDir::currentPath ( )

Definition at line 427 of file ZDir.cpp.

◆ entryInfoList()

QObject * Zbl::ZDir::entryInfoList ( int  filters,
int  sort 
) const

Returns a ZFileInfo object describing the contents of the directory.

Definition at line 465 of file ZDir.cpp.

◆ entryList()

QStringList Zbl::ZDir::entryList ( int  filters,
int  sort 
) const

Returns a QStringList describing the contents of the directory.

Definition at line 487 of file ZDir.cpp.

◆ exists()

bool Zbl::ZDir::exists ( ) const

Referenced by fileExists(), and removeRecursively().

◆ fileExists()

bool Zbl::ZDir::fileExists ( const QString &  name) const

Definition at line 364 of file ZDir.cpp.

◆ filePath()

QString Zbl::ZDir::filePath ( const QString &  fileName) const

Definition at line 237 of file ZDir.cpp.

◆ filterChanged

void Zbl::ZDir::filterChanged ( )
signal

◆ getAbsolutePath()

QString Zbl::ZDir::getAbsolutePath ( ) const

Definition at line 211 of file ZDir.cpp.

◆ getCanonicalPath()

QString Zbl::ZDir::getCanonicalPath ( ) const

Definition at line 219 of file ZDir.cpp.

◆ getChildName()

QString Zbl::ZDir::getChildName ( int  pos)

Definition at line 285 of file ZDir.cpp.

◆ getCount()

uint Zbl::ZDir::getCount ( ) const

Definition at line 277 of file ZDir.cpp.

◆ getDirName()

QString Zbl::ZDir::getDirName ( ) const

Definition at line 228 of file ZDir.cpp.

◆ getFilter()

uint Zbl::ZDir::getFilter ( ) const

Definition at line 134 of file ZDir.cpp.

◆ getPath()

QString Zbl::ZDir::getPath ( ) const

Definition at line 203 of file ZDir.cpp.

◆ getTags()

QVariant Zbl::ZDir::getTags ( )

Definition at line 128 of file ZDir.cpp.

◆ homePath()

QString Zbl::ZDir::homePath ( )

Definition at line 434 of file ZDir.cpp.

◆ initDir()

void Zbl::ZDir::initDir ( )
inlineprotected

Definition at line 337 of file ZDir.h.

Referenced by rename(), setFilter(), setPath(), setToCurrentPath(), setToHomePath(), and swap().

◆ isAbsolute()

bool Zbl::ZDir::isAbsolute ( ) const

Definition at line 403 of file ZDir.cpp.

◆ isAbsolutePath()

bool Zbl::ZDir::isAbsolutePath ( const QString &  path)

Definition at line 388 of file ZDir.cpp.

◆ isReadable()

bool Zbl::ZDir::isReadable ( ) const

Referenced by removeRecursively().

◆ isRelative()

bool Zbl::ZDir::isRelative ( ) const

Definition at line 395 of file ZDir.cpp.

◆ isRelativePath()

bool Zbl::ZDir::isRelativePath ( const QString &  path)

Definition at line 381 of file ZDir.cpp.

◆ isRoot()

bool Zbl::ZDir::isRoot ( ) const

Referenced by removeRecursively().

◆ makeAbsolute()

bool Zbl::ZDir::makeAbsolute ( )

Definition at line 411 of file ZDir.cpp.

◆ mkdir()

bool Zbl::ZDir::mkdir ( const QString &  dirName) const

Definition at line 293 of file ZDir.cpp.

◆ mkpath()

bool Zbl::ZDir::mkpath ( const QString &  dirPath) const

Definition at line 309 of file ZDir.cpp.

◆ pathChanged

void Zbl::ZDir::pathChanged ( )
signal

◆ refresh()

void Zbl::ZDir::refresh ( ) const

Definition at line 372 of file ZDir.cpp.

◆ registerType()

void Zbl::ZDir::registerType ( )
static

Registers ZDir as a QML type.

Registers this object as a QML type.

Definition at line 65 of file ZDir.cpp.

Referenced by Zbl::Zblcore::registerTypes().

◆ relativeFilePath()

QString Zbl::ZDir::relativeFilePath ( const QString &  fileName) const

Definition at line 253 of file ZDir.cpp.

◆ remove()

bool Zbl::ZDir::remove ( const QString &  fileName)

Definition at line 356 of file ZDir.cpp.

◆ removeRecursively()

bool Zbl::ZDir::removeRecursively ( )

Definition at line 325 of file ZDir.cpp.

◆ rename()

bool Zbl::ZDir::rename ( const QString &  oldName,
const QString &  newName 
)

Definition at line 174 of file ZDir.cpp.

◆ rmdir()

bool Zbl::ZDir::rmdir ( const QString &  dirName) const

Definition at line 301 of file ZDir.cpp.

◆ rmpath()

bool Zbl::ZDir::rmpath ( const QString &  dirPath) const

Definition at line 317 of file ZDir.cpp.

◆ rootPath()

QString Zbl::ZDir::rootPath ( )

Definition at line 441 of file ZDir.cpp.

◆ setCurrent()

bool Zbl::ZDir::setCurrent ( const QString &  path)

Definition at line 420 of file ZDir.cpp.

◆ setFilter()

void Zbl::ZDir::setFilter ( uint  filters)

Definition at line 142 of file ZDir.cpp.

◆ setPath()

void Zbl::ZDir::setPath ( const QString &  path)

Definition at line 150 of file ZDir.cpp.

◆ setToCurrentPath()

void Zbl::ZDir::setToCurrentPath ( )

Definition at line 158 of file ZDir.cpp.

Referenced by setToHomePath().

◆ setToHomePath()

void Zbl::ZDir::setToHomePath ( )

Definition at line 166 of file ZDir.cpp.

◆ swap()

void Zbl::ZDir::swap ( QObject *  zDir)

Definition at line 182 of file ZDir.cpp.

◆ tagsChanged

void Zbl::ZDir::tagsChanged ( )
signal

◆ tempPath()

QString Zbl::ZDir::tempPath ( )

Definition at line 448 of file ZDir.cpp.

Referenced by cleanPath().

◆ validateDir()

void Zbl::ZDir::validateDir ( ) const
inlineprotected

Member Data Documentation

◆ m_dir

QDir* Zbl::ZDir::m_dir
protected

◆ m_tags

QVariant Zbl::ZDir::m_tags
staticprotected

Definition at line 330 of file ZDir.h.

Referenced by createTags(), and getTags().

Property Documentation

◆ absolutePath

QString Zbl::ZDir::absolutePath
read

Definition at line 133 of file ZDir.h.

◆ canonicalPath

QString Zbl::ZDir::canonicalPath
read

Definition at line 134 of file ZDir.h.

◆ count

uint Zbl::ZDir::count
read

Definition at line 136 of file ZDir.h.

◆ dirName

QString Zbl::ZDir::dirName
read

Definition at line 135 of file ZDir.h.

◆ exists

bool Zbl::ZDir::exists
read

Definition at line 138 of file ZDir.h.

◆ filter

uint Zbl::ZDir::filter
readwrite

Definition at line 131 of file ZDir.h.

◆ isReadable

bool Zbl::ZDir::isReadable
read

Definition at line 137 of file ZDir.h.

◆ isRoot

bool Zbl::ZDir::isRoot
read

Definition at line 139 of file ZDir.h.

◆ path

QString Zbl::ZDir::path
read

Definition at line 132 of file ZDir.h.

Referenced by setToCurrentPath(), and setToHomePath().

◆ tags

QVariant Zbl::ZDir::tags
read

Definition at line 130 of file ZDir.h.


The documentation for this class was generated from the following files: