Qx v0.5.8
Qt Extensions Library
Loading...
Searching...
No Matches
qx-common-io.h File Reference

The qx-common-io header file provides various types, variables, and functions related to file IO. More...

#include "qx/io/qx_io_export.h"
#include <QFlags>
#include <QChar>
#include <QFile>
#include <QSaveFile>
#include <QDirIterator>
#include <QCryptographicHash>
#include "qx/io/qx-ioopreport.h"
#include "qx/io/qx-textpos.h"
#include "qx/io/qx-textquery.h"
#include "qx/core/qx-index.h"
Include dependency graph for qx-common-io.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  Qx
 The Qx namespace is the main namespace through which all non-global functionality of the Qx library is accessed.
 

Typedefs

typedef QFlags< ReadOptionQx::ReadOptions
 
typedef QFlags< WriteOptionQx::WriteOptions
 

Enumerations

enum  Qx::PathType {
  Qx::Absolute ,
  Qx::Relative
}
 
enum  Qx::ReadOption {
  Qx::NoReadOptions = 0x0 ,
  Qx::IgnoreTrailingBreak = 0x1
}
 
enum  Qx::ReplaceMode {
  Qx::Replace ,
  Qx::Skip ,
  Qx::Stop
}
 
enum  Qx::WriteMode {
  Qx::Insert ,
  Qx::Overwrite ,
  Qx::Append ,
  Qx::Truncate
}
 
enum  Qx::WriteOption {
  Qx::NoWriteOptions = 0x0 ,
  Qx::CreatePath = 0x1 ,
  Qx::ExistingOnly = 0x2 ,
  Qx::NewOnly = 0x4 ,
  Qx::EnsureBreak = 0x8 ,
  Qx::Pad = 0x10 ,
  Qx::Unbuffered = 0x20
}
 

Functions

IoOpReport Qx::calculateFileChecksum (QString &returnBuffer, QFile &file, QCryptographicHash::Algorithm hashAlgorithm)
 
IoOpReport Qx::copyDirectory (const QDir &directory, const QDir &destination, bool recursive, ReplaceMode replaceMode)
 
IoOpReport Qx::deleteTextFromFile (QFile &textFile, TextPos startPos, TextPos endPos)
 
IoOpReport Qx::dirContainsFiles (bool &returnBuffer, const QDir &directory, QDirIterator::IteratorFlags iteratorFlags)
 
bool Qx::dirContainsFiles (const QDir &directory, QDirIterator::IteratorFlags iteratorFlags)
 
IoOpReport Qx::dirContentInfoList (QFileInfoList &returnBuffer, const QDir &directory, QStringList nameFilters, QDir::Filters filters, QDirIterator::IteratorFlags flags)
 
IoOpReport Qx::dirContentList (QStringList &returnBuffer, const QDir &directory, QStringList nameFilters, QDir::Filters filters, QDirIterator::IteratorFlags flags, PathType pathType)
 
IoOpReport Qx::fileContainsString (bool &returnBuffer, QFile &textFile, const QString &query, Qt::CaseSensitivity cs, bool allowSplit)
 
IoOpReport Qx::fileIsEmpty (bool &returnBuffer, const QFile &file)
 
bool Qx::fileIsEmpty (const QFile &file)
 
IoOpReport Qx::fileMatchesChecksum (bool &returnBuffer, QFile &file, QString checksum, QCryptographicHash::Algorithm hashAlgorithm)
 
IoOpReport Qx::findStringInFile (QList< TextPos > &returnBuffer, QFile &textFile, const TextQuery &query, ReadOptions readOptions)
 
QString Qx::kosherizeFileName (QString fileName)
 
IoOpReport Qx::readBytesFromFile (QByteArray &returnBuffer, QFile &file, Index64 startPos, Index64 endPos)
 
IoOpReport Qx::readTextFromFile (QString &returnBuffer, QFile &textFile, TextPos startPos, int count, ReadOptions readOptions)
 
IoOpReport Qx::readTextFromFile (QString &returnBuffer, QFile &textFile, TextPos startPos, TextPos endPos, ReadOptions readOptions)
 
IoOpReport Qx::readTextFromFile (QStringList &returnBuffer, QFile &textFile, Index32 startLine, Index32 endLine, ReadOptions readOptions)
 
IoOpReport Qx::textFileAbsolutePosition (TextPos &textPos, QFile &textFile, bool ignoreTrailingEmpty)
 
IoOpReport Qx::textFileEndsWithNewline (bool &returnBuffer, QFile &textFile)
 
IoOpReport Qx::textFileLayout (QList< int > &returnBuffer, QFile &textFile, bool ignoreTrailingEmpty)
 
IoOpReport Qx::textFileLineCount (int &returnBuffer, QFile &textFile, bool ignoreTrailingEmpty)
 
IoOpReport Qx::writeBytesToFile (QFile &file, const QByteArray &bytes, WriteMode writeMode, Index64 startPos, WriteOptions writeOptions)
 
IoOpReport Qx::writeBytesToFile (QSaveFile &file, const QByteArray &bytes, WriteMode writeMode, Index64 startPos, WriteOptions writeOptions)
 
IoOpReport Qx::writeStringToFile (QFile &textFile, const QString &text, WriteMode writeMode, TextPos startPos, WriteOptions writeOptions)
 
IoOpReport Qx::writeStringToFile (QSaveFile &textFile, const QString &text, WriteMode writeMode, TextPos startPos, WriteOptions writeOptions)
 

Variables

const QChar Qx::ENDL = '\n'
 
const QString Qx::LIST_ITEM_PREFIX = u"- "_s
 

Detailed Description

Most functions in this file return an IoOpReport that details the success or failure of their actions.

Note
All functions in this header that require a file to be opened handle the opening and closing of the file automatically. The file will be reopened in the correct mode if it is already opened, and the file will always be closed when the function returns.