|
BIMHome v1.0.0
BIMHome接口文档说明
|
File name unification This class handles everything related to file names the file names are internal generally UTF-8 encoded on all platforms. 更多...
#include <FileInfo.h>
类 | |
| struct | FontCalculate |
Public 类型 | |
| typedef QMap< QString, FontCalculate > | FontInfoVec |
| enum | Permissions { WriteOnly = 0x01 , ReadOnly = 0x02 , ReadWrite = 0x03 } |
Public 成员函数 | |
| FileInfo (const char *_FileName="") | |
| Construction | |
| FileInfo (const std::string &_FileName) | |
| void | setFile (const char *name) |
| Set a new file name | |
| void | setFile (const std::string &name) |
| Set a new file name | |
extraction of information | |
| std::string | filePath () const |
| Returns the file name, including the path (which may be absolute or relative). | |
| std::string | dirPath () const |
| Returns the dir path name (which may be absolute or relative). | |
| std::string | fileName () const |
| Returns the name of the file, excluding the path, including the extension. | |
| std::string | fileNamePure () const |
| Returns the name of the file, excluding the path and the extension. | |
| std::wstring | toStdWString () const |
| Convert the path name into a UTF-16 encoded wide string format. | |
| std::string | extension () const |
| Returns the extension of the file. | |
| std::string | completeExtension () const |
| Returns the complete extension of the file. | |
| bool | hasExtension (const char *Ext) const |
| Checks for a special extension, NOT case sensitive | |
methods to test the status of the file or dir | |
| bool | exists () const |
| Does the file exist? | |
| bool | isReadable () const |
| Checks if the file exist and is readable | |
| bool | isWritable () const |
| Checks if the file exist and is writable | |
| bool | setPermissions (Permissions) |
| Tries to set the file permission | |
| bool | isFile () const |
| Checks if it is a file (not a directory) | |
| bool | isDir () const |
| Checks if it is a directory (not a file) | |
| unsigned int | size () const |
| The size of the file | |
| TimeInfo | lastModified () const |
| Returns the time when the file was last modified. | |
| TimeInfo | lastRead () const |
| Returns the time when the file was last read (accessed). | |
Directory management | |
| bool | createDirectory () const |
| Creates a directory. Returns true if successful; otherwise returns false. | |
| bool | createDirectories () const |
| Creates a directory and all its parent directories. Returns true if successful; otherwise returns false. | |
| std::vector< Base::FileInfo > | getDirectoryContent () const |
| Get a list of the directory content | |
| bool | deleteDirectory () const |
| Delete an empty directory | |
| bool | deleteDirectoryRecursive () const |
| Delete a directory and all its content. | |
| bool | deleteFile () const |
| Delete the file | |
| bool | renameFile (const char *NewName) |
| Rename the file | |
| bool | copyTo (const char *NewName) const |
| Rename the file | |
Tools | |
| 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 const std::string & | getTempPath () |
| Get the path to the dir which is considered to temp files | |
| static std::string | pathToString (const boost::filesystem::path &p) |
| Convert from filesystem path to string | |
| static boost::filesystem::path | stringToPath (const std::string &str) |
| Convert from string to filesystem path | |
| static std::string | ConvertFromWideString (const std::wstring &string) |
| static std::wstring | ConvertToWideString (const std::string &string) |
| static void | unicodeToUTF8 (const std::wstring &src, std::string &result) |
| static void | gb2312ToUnicode (const std::string &src, std::wstring &result) |
| static std::string | GbkToUtf8 (std::string str) |
| static void | gb2312ToUtf8 (const std::string &src, std::string &result) |
| static std::string | gb2312ToUtf8 (const std::string &src) |
| static std::wstring | string2wstring (std::string str) |
| static std::string | wstring2string (std::wstring wstr) |
| static void | utf8ToGB2312 (const char *utf8, char *&gb2312) |
| static bool | isLetter (const QString &str) |
| static bool | isDigit (const QString &str) |
| static bool | isSymbol (const QString &str) |
| static bool | isChinese (const QString &str) |
| static FontInfoVec | getFontFileInfo (const QString &fontFamily) |
| static double | getNormalFontWidth (const QString &fontFamily, const QString &text, double fontheight, double widthFactor) |
| static double | getFontWidth (const QString &fontFamily, const QString &text, double fontheight, double widthFactor) |
| static bool | calcExpress (const std::string &sExpress, const std::map< std::string, double > ¶mMap, double &dValue) |
| static void | eraseVectorMinDistance (std::vector< double > &vec, const double &error) |
File name unification This class handles everything related to file names the file names are internal generally UTF-8 encoded on all platforms.