18#ifndef BIMHOMEBASE_FILEINFO_H
19#define BIMHOMEBASE_FILEINFO_H
21#include <boost/filesystem.hpp>
24#include <Base/TimeInfo.h>
52 sWord = QString::fromLocal8Bit(
"");
149 static std::string
getTempFileName(
const char* FileName=
nullptr,
const char* path=
nullptr);
176 static double getNormalFontWidth(
const QString& fontFamily,
const QString& text,
double fontheight,
double widthFactor);
177 static double getFontWidth(
const QString& fontFamily,
const QString& text,
double fontheight,
double widthFactor);
179 static bool calcExpress(
const std::string& sExpress,
const std::map<std::string, double>& paramMap,
double& dValue);
static void gb2312ToUtf8(const std::string &src, std::string &result)
bool renameFile(const char *NewName)
Rename the file
std::string completeExtension() const
Returns the complete extension of the file.
static boost::filesystem::path stringToPath(const std::string &str)
Convert from string to filesystem path
std::string FileName
Definition FileInfo.h:185
static bool calcExpress(const std::string &sExpress, const std::map< std::string, double > ¶mMap, double &dValue)
std::string extension() const
Returns the extension of the file.
bool createDirectories() const
Creates a directory and all its parent directories. Returns true if successful; otherwise returns fal...
std::string dirPath() const
Returns the dir path name (which may be absolute or relative).
void setFile(const std::string &name)
Set a new file name
Definition FileInfo.h:65
static std::string ConvertFromWideString(const std::wstring &string)
std::string fileName() const
Returns the name of the file, excluding the path, including the extension.
bool isFile() const
Checks if it is a file (not a directory)
static bool isDigit(const QString &str)
bool hasExtension(const char *Ext) const
Checks for a special extension, NOT case sensitive
static std::string wstring2string(std::wstring wstr)
static void gb2312ToUnicode(const std::string &src, std::wstring &result)
Permissions
Definition FileInfo.h:41
unsigned int size() const
The size of the file
std::string filePath() const
Returns the file name, including the path (which may be absolute or relative).
FileInfo(const std::string &_FileName)
static std::string getTempFileName(const char *FileName=nullptr, const char *path=nullptr)
Get a unique File Name in the given or (if 0) in the temp path
static std::wstring string2wstring(std::string str)
bool createDirectory() const
Creates a directory. Returns true if successful; otherwise returns false.
bool deleteFile() const
Delete the file
FileInfo(const char *_FileName="")
Construction
static bool isLetter(const QString &str)
bool isWritable() const
Checks if the file exist and is writable
void setFile(const char *name)
Set a new file name
static std::string pathToString(const boost::filesystem::path &p)
Convert from filesystem path to string
TimeInfo lastRead() const
Returns the time when the file was last read (accessed).
static bool isSymbol(const QString &str)
static FontInfoVec getFontFileInfo(const QString &fontFamily)
static void utf8ToGB2312(const char *utf8, char *&gb2312)
static const std::string & getTempPath()
Get the path to the dir which is considered to temp files
bool exists() const
Does the file exist?
static void eraseVectorMinDistance(std::vector< double > &vec, const double &error)
TimeInfo lastModified() const
Returns the time when the file was last modified.
static void unicodeToUTF8(const std::wstring &src, std::string &result)
QMap< QString, FontCalculate > FontInfoVec
Definition FileInfo.h:58
static std::string GbkToUtf8(std::string str)
static bool isChinese(const QString &str)
bool copyTo(const char *NewName) const
Rename the file
static double getNormalFontWidth(const QString &fontFamily, const QString &text, double fontheight, double widthFactor)
bool isDir() const
Checks if it is a directory (not a file)
static double getFontWidth(const QString &fontFamily, const QString &text, double fontheight, double widthFactor)
std::vector< Base::FileInfo > getDirectoryContent() const
Get a list of the directory content
bool setPermissions(Permissions)
Tries to set the file permission
bool isReadable() const
Checks if the file exist and is readable
static std::string gb2312ToUtf8(const std::string &src)
std::wstring toStdWString() const
Convert the path name into a UTF-16 encoded wide string format.
static std::wstring ConvertToWideString(const std::string &string)
std::string fileNamePure() const
Returns the name of the file, excluding the path and the extension.
bool deleteDirectoryRecursive() const
Delete a directory and all its content.
bool deleteDirectory() const
Delete an empty directory
File name unification This class handles everything related to file names the file names are internal...
Definition FileInfo.h:38
TimeInfo 类,用于表示时间信息
Definition TimeInfo.h:36
Definition BaseFigureFactory.h:24
double sFontHeight
Definition FileInfo.h:48
double sWidthFactor
Definition FileInfo.h:49
FontCalculate()
Definition FileInfo.h:51
double sFontWidth
Definition FileInfo.h:50
QString sWord
Definition FileInfo.h:47