ACF $AcfVersion:0$
CSystem.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ACF-Commercial
2#pragma once
3
4
5// Qt includes
6#include <QtCore/QString>
7#include <QtCore/QMap>
8
9
10#if defined(Sleep)
11#undef Sleep
12#endif
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 void Sleep(double seconds);
108
112 static bool CopyDirectory(const QString& sourcePath, const QString& destinationPath);
113
117 static bool RemoveDirectory(const QString& directoryPath);
118
122 static bool FileCopy(const QString& source, const QString& result, bool overWrite = false);
123
127 static bool FileMove(const QString& source, const QString& targetFolder, bool overWrite = false);
128
132 static bool EnsurePathExists(const QString& filePath);
133
137 static QString GetCurrentUserName();
138
142 static FileDriveInfo GetFileDriveInfo(const QString& fileDrivePath);
143
149 static QString GetCompilerVariable(const QString& varName);
150
157 static void SetUserVariables(const QString& compilerMode, const QString &acfQtVersion, const QString& compilerName, const QString& platformCode);
158
162 static QString ConvertNetworkPathToUnc(const QString& localPath);
163
167 static QString GetCompilerInfo();
168
169private:
170 static QString s_compilerMode;
171 static QString s_compilerName;
172 static QString s_platformCode;
173 static QString s_acfQtVersion;
174};
175
176
177} // namespace istd
178
179
180
181
Implementation of global system helpers.
Definition CSystem.h:25
static QString GetCompilerInfo()
Get the comiler info.
static bool ConvertToFileName(const QString &fileNameString, QString &fileName, const QString &replacingChar=QString())
Make a valid file name from a string.
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 void Sleep(double seconds)
Sleep current thread.
static QString GetVariableValue(const QString &varName, bool envVars=true, bool embeddedVars=true)
Get value of system variables.
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 void SetUserVariables(const QString &compilerMode, const QString &acfQtVersion, const QString &compilerName, const QString &platformCode)
Set some user specific variables to override the generated by compiler.
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.
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 QString ConvertNetworkPathToUnc(const QString &localPath)
Convert a mapped network path to UNC representation.
static QString GetCompilerVariable(const QString &varName)
Get compiler specific variable.
static bool CopyDirectory(const QString &sourcePath, const QString &destinationPath)
Copy files and directories from one folder to another.
QMap< QString, QString > EnvironmentVariables
Definition CSystem.h:27
static FileDriveInfo GetFileDriveInfo(const QString &fileDrivePath)
Get the free space information for the given file drive.
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