ICF 3.1.1.10
Technical documentation of ICF Libraries
CSystem.h
Go to the documentation of this file.
1/********************************************************************************
2** This file is part of the ICF Framework. Copyright (C) Witold Gantzke & Kirill Lepskiy
3** ICF Framework may be used under the terms of the LGPL License v. 2.1 by the Free Software Foundation.
4********************************************************************************/
5
6#ifndef istd_CSystem_included
7#define istd_CSystem_included
8
9
10// Qt includes
11#include <QtCore/QString>
12#include <QtCore/QMap>
13
14
15namespace istd
16{
17
18
25{
26public:
27 typedef QMap<QString, QString> EnvironmentVariables;
28
30 {
32 : totalBytes(0),
33 freeBytes(0),
34 isValid(false)
35 {
36 }
37
38 bool operator ==(const FileDriveInfo& info) const
39 {
40 return (totalBytes == info.totalBytes) && (freeBytes == info.freeBytes) && (isValid == info.isValid);
41 }
42
43 quint64 totalBytes;
44 quint64 freeBytes;
45 bool isValid;
46 };
47
49 {
51 QString name;
52 QByteArray id;
53
54 bool operator == (const FileDriveDescriptor& driveInfo) const
55 {
56 return (info == driveInfo.info) && (name == driveInfo.name) && (id == driveInfo.id);
57 }
58 };
59
60
61 // static methods
62
66 static QString GetOperationSystemName();
67
75 static bool ConvertToFileName(const QString& fileNameString, QString& fileName, const QString replacingChar = QString());
76
80 static QString GetNormalizedPath(const QString& path);
81
87 static QString GetVariableValue(const QString& varName, bool envVars = true, bool embeddedVars = true);
88
92 static QString GetEnrolledPath(const QString& path, bool envVars = true, bool embeddedVars = true);
93
98
102 static void SetTempDirectoryPath(const QString& tempPath);
103
107 static bool CopyDirectory(const QString &srcPath, const QString &dstPath);
108
112 static bool RemoveDirectory(const QString& directoryPath);
113
117 static bool FileCopy(const QString& source, const QString& result, bool overWrite = false);
118
122 static bool FileMove(const QString& source, const QString& targetFolder, bool overWrite = false);
123
127 static bool EnsurePathExists(const QString& filePath);
128
132 static QString GetCurrentUserName();
133
137 static FileDriveInfo GetFileDriveInfo(const QString& fileDrivePath);
138
144 static QString GetCompilerVariable(const QString& varName);
145
153 static void SetUserVariables(
154 const QString* applicationDirPtr = nullptr,
155 const QString* compilerModePtr = nullptr,
156 const QString* compilerNamePtr = nullptr,
157 const QString* platformCodePtr = nullptr);
158
159private:
160 static QString s_applicationDir;
161 static QString s_compilerMode;
162 static QString s_compilerName;
163 static QString s_platformCode;
164};
165
166
167} // namespace istd
168
169
170#endif // !istd_CSystem_included
171
172
Implementation of global system helpers.
Definition CSystem.h:25
static bool FileMove(const QString &source, const QString &targetFolder, bool overWrite=false)
Move a file to another directory.
static QString GetEnrolledPath(const QString &path, bool envVars=true, bool embeddedVars=true)
Get path with enrolled system variables.
static QString GetVariableValue(const QString &varName, bool envVars=true, bool embeddedVars=true)
Get value of system variables.
static void SetUserVariables(const QString *applicationDirPtr=nullptr, const QString *compilerModePtr=nullptr, const QString *compilerNamePtr=nullptr, const QString *platformCodePtr=nullptr)
Set some user specific variables to override the generated by compiler.
static void SetTempDirectoryPath(const QString &tempPath)
Set path for for temporary data to the current process.
static bool EnsurePathExists(const QString &filePath)
Ensure that the given path exists.
static bool RemoveDirectory(const QString &directoryPath)
Remove a given directory with all contents.
static QString GetNormalizedPath(const QString &path)
Get normalized path with enrolled system variables.
static bool FileCopy(const QString &source, const QString &result, bool overWrite=false)
Copy file to directory.
QMap< QString, QString > EnvironmentVariables
Definition CSystem.h:27
static EnvironmentVariables GetEnvironmentVariables()
Get list of environment valiables related to the current process.
static QString GetCurrentUserName()
Get the name of the currently logged user.
static QString GetOperationSystemName()
Get the name of the operation system currently used.
static bool ConvertToFileName(const QString &fileNameString, QString &fileName, const QString replacingChar=QString())
Make a valid file name from a string.
static QString GetCompilerVariable(const QString &varName)
Get compiler specific variable.
static FileDriveInfo GetFileDriveInfo(const QString &fileDrivePath)
Get the free space information for the given file drive.
static bool CopyDirectory(const QString &srcPath, const QString &dstPath)
Copy files and directories from one folder to another.
Standard library.
Definition IComponent.h:17
bool operator==(const FileDriveDescriptor &driveInfo) const
Definition CSystem.h:54
bool operator==(const FileDriveInfo &info) const
Definition CSystem.h:38

© Witold Gantzke and Kirill Lepskiy