From b1fe06fc33e67f0f5dadcad33413753096fc2232 Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Sat, 18 May 2019 21:15:15 +0200 Subject: [PATCH] Various improvements to known_folder() function, again. --- docs/d0/dd7/_version_8h_source.html | 2 +- docs/d2/df4/namespace_m_utils_1_1_o_s.html | 69 ++++++++++++++---- docs/d3/dc1/_o_s_support_8h.html | 29 ++++++-- docs/d3/dc1/_o_s_support_8h_source.html | 50 ++++++++----- docs/d5/d3b/_global_8h_source.html | 2 +- docs/menudata.js | 6 +- docs/namespacemembers.html | 66 +++++++++++++---- docs/namespacemembers_eval.html | 82 ++++++++++++++++++---- docs/search/all_5.js | 26 +++++-- docs/search/enumvalues_1.js | 26 +++++-- include/MUtils/Global.h | 2 +- include/MUtils/OSSupport.h | 10 +-- src/OSSupport_Win32.cpp | 21 +++--- test/src/GlobalTest.cpp | 14 +++- 14 files changed, 311 insertions(+), 94 deletions(-) diff --git a/docs/d0/dd7/_version_8h_source.html b/docs/d0/dd7/_version_8h_source.html index 258ae95..e1f053d 100644 --- a/docs/d0/dd7/_version_8h_source.html +++ b/docs/d0/dd7/_version_8h_source.html @@ -67,7 +67,7 @@ $(function() {
Version.h
-
1 // MuldeR's Utilities for Qt
3 // Copyright (C) 2004-2019 LoRd_MuldeR <MuldeR2@GMX.de>
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //
19 // http://www.gnu.org/licenses/lgpl-2.1.txt
21 
22 #pragma once
23 
24 //MUtils
25 #include <MUtils/Global.h>
26 
27 //Qt
28 #include <QString>
29 #include <QDate>
30 #include <QTime>
31 
32 namespace MUtils
33 {
34  class Version
35  {
36  public:
37  //Get Library Version Numbers
38  MUTILS_API static const quint32 &lib_version_major(void);
39  MUTILS_API static const quint32 &lib_version_minor(void);
40 
41  //Get Library Build Date/Time
42  MUTILS_API static const QDate lib_build_date(void);
43  MUTILS_API static const QTime lib_build_time(void);
44 
45  //Get Application Build Date/Time
46  MUTILS_API static const QDate app_build_date(const char *const date_str = build_date_raw());
47  MUTILS_API static const QTime app_build_time(const char *const time_str = build_time_raw());
48 
49  //Compiler detection
50  static const char *const compiler_version(void)
51  {
52  static const char *const COMPILER_VERS =
53  #if defined(__INTEL_COMPILER)
54  #if (__INTEL_COMPILER >= 1500)
55  "ICL 15." MUTILS_MAKE_STRING(__INTEL_COMPILER_BUILD_DATE);
56  #elif (__INTEL_COMPILER >= 1400)
57  "ICL 14." MUTILS_MAKE_STRING(__INTEL_COMPILER_BUILD_DATE);
58  #elif (__INTEL_COMPILER >= 1300)
59  "ICL 13." MUTILS_MAKE_STRING(__INTEL_COMPILER_BUILD_DATE);
60  #elif (__INTEL_COMPILER >= 1200)
61  "ICL 12." MUTILS_MAKE_STRING(__INTEL_COMPILER_BUILD_DATE);
62  #elif (__INTEL_COMPILER >= 1100)
63  "ICL 11.x";
64  #elif (__INTEL_COMPILER >= 1000)
65  "ICL 10.x";
66  #else
67  #error Compiler is not supported!
68  #endif
69  #elif defined(_MSC_VER)
70  #if (_MSC_VER == 1920)
71  #if((_MSC_FULL_VER >= 192027508) && (_MSC_FULL_VER <= 192027508))
72  "MSVC 2019.0";
73  #else
74  #error Compiler version is not supported yet!
75  #endif
76  #elif (_MSC_VER == 1916)
77  #if((_MSC_FULL_VER >= 191627024) && (_MSC_FULL_VER <= 191627030))
78  "MSVC 2017.9";
79  #else
80  #error Compiler version is not supported yet!
81  #endif
82  #elif (_MSC_VER == 1915)
83  #if((_MSC_FULL_VER >= 191526726) && (_MSC_FULL_VER <= 191526732))
84  "MSVC 2017.8";
85  #else
86  #error Compiler version is not supported yet!
87  #endif
88  #elif (_MSC_VER == 1914)
89  #if((_MSC_FULL_VER >= 191426430) && (_MSC_FULL_VER <= 191426433))
90  "MSVC 2017.7";
91  #else
92  #error Compiler version is not supported yet!
93  #endif
94  #elif (_MSC_VER == 1913)
95  #if((_MSC_FULL_VER >= 191326128) && (_MSC_FULL_VER <= 191326132))
96  "MSVC 2017.6";
97  #else
98  #error Compiler version is not supported yet!
99  #endif
100  #elif (_MSC_VER == 1912)
101  #if((_MSC_FULL_VER >= 191225830) && (_MSC_FULL_VER <= 191225835))
102  "MSVC 2017.5";
103  #else
104  #error Compiler version is not supported yet!
105  #endif
106  #elif (_MSC_VER == 1911)
107  #if((_MSC_FULL_VER >= 191125542) && (_MSC_FULL_VER <= 191125547))
108  "MSVC 2017.4";
109  #elif((_MSC_FULL_VER >= 191125506) && (_MSC_FULL_VER <= 191125508))
110  "MSVC 2017.3";
111  #else
112  #error Compiler version is not supported yet!
113  #endif
114  #elif (_MSC_VER == 1910)
115  #if ((_MSC_FULL_VER >= 191025017) && (_MSC_FULL_VER <= 191025019))
116  "MSVC 2017.2";
117  #else
118  #error Compiler version is not supported yet!
119  #endif
120  #elif (_MSC_VER == 1900)
121  #if (_MSC_FULL_VER == 190023026)
122  "MSVC 2015";
123  #elif (_MSC_FULL_VER == 190023506)
124  "MSVC 2015.1";
125  #elif (_MSC_FULL_VER == 190023918)
126  "MSVC 2015.2";
127  #elif (_MSC_FULL_VER == 190024210) || (_MSC_FULL_VER == 190024215)
128  "MSVC 2015.3";
129  #else
130  #error Compiler version is not supported yet!
131  #endif
132  #elif (_MSC_VER == 1800)
133  #if (_MSC_FULL_VER == 180021005)
134  "MSVC 2013";
135  #elif (_MSC_FULL_VER == 180030501)
136  "MSVC 2013.2";
137  #elif (_MSC_FULL_VER == 180030723)
138  "MSVC 2013.3";
139  #elif (_MSC_FULL_VER == 180031101)
140  "MSVC 2013.4";
141  #elif (_MSC_FULL_VER == 180040629)
142  "MSVC 2013.5";
143  #else
144  #error Compiler version is not supported yet!
145  #endif
146  #elif (_MSC_VER == 1700)
147  #if (_MSC_FULL_VER == 170050727)
148  "MSVC 2012";
149  #elif (_MSC_FULL_VER == 170051106)
150  "MSVC 2012.1";
151  #elif (_MSC_FULL_VER == 170060315)
152  "MSVC 2012.2";
153  #elif (_MSC_FULL_VER == 170060610)
154  "MSVC 2012.3";
155  #elif (_MSC_FULL_VER == 170061030)
156  "MSVC 2012.4";
157  #else
158  #error Compiler version is not supported yet!
159  #endif
160  #elif (_MSC_VER == 1600)
161  #if (_MSC_FULL_VER >= 160040219)
162  "MSVC 2010-SP1";
163  #else
164  "MSVC 2010";
165  #endif
166  #else
167  #error Compiler is not supported!
168  #endif
169  #else
170  #error Compiler is not supported!
171  #endif
172  return COMPILER_VERS;
173  }
174 
175  //Architecture detection
176  static const char *const compiler_arch(void)
177  {
178  static const char *const COMPILER_ARCH =
179  #if defined(_M_X64)
180  "x64";
181  #elif defined(_M_IX86)
182  "x86";
183  #else
184  #error Architecture is not supported!
185  #endif
186  return COMPILER_ARCH;
187  }
188 
189  private:
190  //Raw Build date
191  static const char *const build_date_raw(void)
192  {
193  static const char *const RAW_BUILD_DATE = __DATE__;
194  return RAW_BUILD_DATE;
195  }
196 
197  //Raw Build time
198  static const char *const build_time_raw(void)
199  {
200  static const char *const RAW_BUILD_TIME = __TIME__;
201  return RAW_BUILD_TIME;
202  }
203 
204  //Disable construction
205  Version(void) { throw 666; }
206  Version(const Version&) { throw 666; }
207  };
208 }
209 
Definition: Version.h:34
+
1 // MuldeR's Utilities for Qt
3 // Copyright (C) 2004-2019 LoRd_MuldeR <MuldeR2@GMX.de>
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //
19 // http://www.gnu.org/licenses/lgpl-2.1.txt
21 
22 #pragma once
23 
24 //MUtils
25 #include <MUtils/Global.h>
26 
27 //Qt
28 #include <QString>
29 #include <QDate>
30 #include <QTime>
31 
32 namespace MUtils
33 {
34  class Version
35  {
36  public:
37  //Get Library Version Numbers
38  MUTILS_API static const quint32 &lib_version_major(void);
39  MUTILS_API static const quint32 &lib_version_minor(void);
40 
41  //Get Library Build Date/Time
42  MUTILS_API static const QDate lib_build_date(void);
43  MUTILS_API static const QTime lib_build_time(void);
44 
45  //Get Application Build Date/Time
46  MUTILS_API static const QDate app_build_date(const char *const date_str = build_date_raw());
47  MUTILS_API static const QTime app_build_time(const char *const time_str = build_time_raw());
48 
49  //Compiler detection
50  static const char *const compiler_version(void)
51  {
52  static const char *const COMPILER_VERS =
53  #if defined(__INTEL_COMPILER)
54  #if (__INTEL_COMPILER >= 1500)
55  "ICL 15." MUTILS_MAKE_STRING(__INTEL_COMPILER_BUILD_DATE);
56  #elif (__INTEL_COMPILER >= 1400)
57  "ICL 14." MUTILS_MAKE_STRING(__INTEL_COMPILER_BUILD_DATE);
58  #elif (__INTEL_COMPILER >= 1300)
59  "ICL 13." MUTILS_MAKE_STRING(__INTEL_COMPILER_BUILD_DATE);
60  #elif (__INTEL_COMPILER >= 1200)
61  "ICL 12." MUTILS_MAKE_STRING(__INTEL_COMPILER_BUILD_DATE);
62  #elif (__INTEL_COMPILER >= 1100)
63  "ICL 11.x";
64  #elif (__INTEL_COMPILER >= 1000)
65  "ICL 10.x";
66  #else
67  #error Compiler is not supported!
68  #endif
69  #elif defined(_MSC_VER)
70  #if (_MSC_VER == 1920)
71  #if((_MSC_FULL_VER >= 192027508) && (_MSC_FULL_VER <= 192027508))
72  "MSVC 2019.0";
73  #else
74  #error Compiler version is not supported yet!
75  #endif
76  #elif (_MSC_VER == 1916)
77  #if((_MSC_FULL_VER >= 191627024) && (_MSC_FULL_VER <= 191627031))
78  "MSVC 2017.9";
79  #else
80  #error Compiler version is not supported yet!
81  #endif
82  #elif (_MSC_VER == 1915)
83  #if((_MSC_FULL_VER >= 191526726) && (_MSC_FULL_VER <= 191526732))
84  "MSVC 2017.8";
85  #else
86  #error Compiler version is not supported yet!
87  #endif
88  #elif (_MSC_VER == 1914)
89  #if((_MSC_FULL_VER >= 191426430) && (_MSC_FULL_VER <= 191426433))
90  "MSVC 2017.7";
91  #else
92  #error Compiler version is not supported yet!
93  #endif
94  #elif (_MSC_VER == 1913)
95  #if((_MSC_FULL_VER >= 191326128) && (_MSC_FULL_VER <= 191326132))
96  "MSVC 2017.6";
97  #else
98  #error Compiler version is not supported yet!
99  #endif
100  #elif (_MSC_VER == 1912)
101  #if((_MSC_FULL_VER >= 191225830) && (_MSC_FULL_VER <= 191225835))
102  "MSVC 2017.5";
103  #else
104  #error Compiler version is not supported yet!
105  #endif
106  #elif (_MSC_VER == 1911)
107  #if((_MSC_FULL_VER >= 191125542) && (_MSC_FULL_VER <= 191125547))
108  "MSVC 2017.4";
109  #elif((_MSC_FULL_VER >= 191125506) && (_MSC_FULL_VER <= 191125508))
110  "MSVC 2017.3";
111  #else
112  #error Compiler version is not supported yet!
113  #endif
114  #elif (_MSC_VER == 1910)
115  #if ((_MSC_FULL_VER >= 191025017) && (_MSC_FULL_VER <= 191025019))
116  "MSVC 2017.2";
117  #else
118  #error Compiler version is not supported yet!
119  #endif
120  #elif (_MSC_VER == 1900)
121  #if (_MSC_FULL_VER == 190023026)
122  "MSVC 2015";
123  #elif (_MSC_FULL_VER == 190023506)
124  "MSVC 2015.1";
125  #elif (_MSC_FULL_VER == 190023918)
126  "MSVC 2015.2";
127  #elif (_MSC_FULL_VER == 190024210) || (_MSC_FULL_VER == 190024215)
128  "MSVC 2015.3";
129  #else
130  #error Compiler version is not supported yet!
131  #endif
132  #elif (_MSC_VER == 1800)
133  #if (_MSC_FULL_VER == 180021005)
134  "MSVC 2013";
135  #elif (_MSC_FULL_VER == 180030501)
136  "MSVC 2013.2";
137  #elif (_MSC_FULL_VER == 180030723)
138  "MSVC 2013.3";
139  #elif (_MSC_FULL_VER == 180031101)
140  "MSVC 2013.4";
141  #elif (_MSC_FULL_VER == 180040629)
142  "MSVC 2013.5";
143  #else
144  #error Compiler version is not supported yet!
145  #endif
146  #elif (_MSC_VER == 1700)
147  #if (_MSC_FULL_VER == 170050727)
148  "MSVC 2012";
149  #elif (_MSC_FULL_VER == 170051106)
150  "MSVC 2012.1";
151  #elif (_MSC_FULL_VER == 170060315)
152  "MSVC 2012.2";
153  #elif (_MSC_FULL_VER == 170060610)
154  "MSVC 2012.3";
155  #elif (_MSC_FULL_VER == 170061030)
156  "MSVC 2012.4";
157  #else
158  #error Compiler version is not supported yet!
159  #endif
160  #elif (_MSC_VER == 1600)
161  #if (_MSC_FULL_VER >= 160040219)
162  "MSVC 2010-SP1";
163  #else
164  "MSVC 2010";
165  #endif
166  #else
167  #error Compiler is not supported!
168  #endif
169  #else
170  #error Compiler is not supported!
171  #endif
172  return COMPILER_VERS;
173  }
174 
175  //Architecture detection
176  static const char *const compiler_arch(void)
177  {
178  static const char *const COMPILER_ARCH =
179  #if defined(_M_X64)
180  "x64";
181  #elif defined(_M_IX86)
182  "x86";
183  #else
184  #error Architecture is not supported!
185  #endif
186  return COMPILER_ARCH;
187  }
188 
189  private:
190  //Raw Build date
191  static const char *const build_date_raw(void)
192  {
193  static const char *const RAW_BUILD_DATE = __DATE__;
194  return RAW_BUILD_DATE;
195  }
196 
197  //Raw Build time
198  static const char *const build_time_raw(void)
199  {
200  static const char *const RAW_BUILD_TIME = __TIME__;
201  return RAW_BUILD_TIME;
202  }
203 
204  //Disable construction
205  Version(void) { throw 666; }
206  Version(const Version&) { throw 666; }
207  };
208 }
209 
Definition: Version.h:34
This file contains miscellaneous functions that are generally useful for Qt-based applications...
Global MUtils namespace.
Definition: CPUFeatures.h:37
diff --git a/docs/d2/df4/namespace_m_utils_1_1_o_s.html b/docs/d2/df4/namespace_m_utils_1_1_o_s.html index 792f481..8977550 100644 --- a/docs/d2/df4/namespace_m_utils_1_1_o_s.html +++ b/docs/d2/df4/namespace_m_utils_1_1_o_s.html @@ -94,13 +94,30 @@ typedef bool(* progress_ca

Enumerations

enum  known_folder_t {
-  FOLDER_ROAMING_DATA = 0, -FOLDER_LOCALAPPDATA = 1, -FOLDER_USER_PROFILE = 2, -FOLDER_PROGRAMFILES = 3, +  FOLDER_PROFILE_USER = 1, +FOLDER_PROFILE_PUBL = 2, +FOLDER_APPDATA_ROAM = 3, +FOLDER_APPDATA_LOCA = 4,
-  FOLDER_SYSTEMFOLDER = 4, -FOLDER_SYSTROOT_DIR = 5 +  FOLDER_DOCS_USER = 5, +FOLDER_DOCS_PUBL = 6, +FOLDER_DESKTOP_USER = 7, +FOLDER_DESKTOP_PUBL = 8, +
+  FOLDER_PICTURES_USER = 9, +FOLDER_PICTURES_PUBL = 10, +FOLDER_MUSIC_USER = 11, +FOLDER_MUSIC_PUBL = 12, +
+  FOLDER_VIDEO_USER = 13, +FOLDER_VIDEO_PUBL = 14, +FOLDER_PROGRAMS_DEF = 15, +FOLDER_PROGRAMS_X86 = 16, +
+  FOLDER_PROGRAMS_X64 = 17, +FOLDER_SYSROOT = 18, +FOLDER_SYSTEM_DEF = 19, +FOLDER_SYSTEM_X86 = 20
} This enumeration specifies "known" folder identifiers. More...
@@ -318,17 +335,45 @@ MUTILS_API void fatal_exit

This enumeration specifies "known" folder identifiers.

- - - - - - + + + + + + + + + + + + + +
Enumerator
FOLDER_ROAMING_DATA 

Application-specific data.

+
Enumerator
FOLDER_PROFILE_USER 

The user's profile folder.

FOLDER_LOCALAPPDATA 

Local application data (non-roaming)

+
FOLDER_PROFILE_PUBL 

The "all users" profile folder.

FOLDER_USER_PROFILE 

The user's profile folder.

+
FOLDER_APPDATA_ROAM 

Application-specific data.

FOLDER_PROGRAMFILES 

Program files.

+
FOLDER_APPDATA_LOCA 

Local application data (non-roaming)

FOLDER_SYSTEMFOLDER 

System directory.

+
FOLDER_DOCS_USER 

The user's Documents directory.

FOLDER_SYSTROOT_DIR 

System "root" directory.

+
FOLDER_DOCS_PUBL 

The "all users" Documents directory.

+
FOLDER_DESKTOP_USER 

The user's Desktop directory.

+
FOLDER_DESKTOP_PUBL 

The "all users" Desktop directory.

+
FOLDER_PICTURES_USER 

The user's Music directory.

+
FOLDER_PICTURES_PUBL 

The user's Music directory.

+
FOLDER_MUSIC_USER 

The user's Music directory.

+
FOLDER_MUSIC_PUBL 

The "all users" Music directory.

+
FOLDER_VIDEO_USER 

The user's Video directory.

+
FOLDER_VIDEO_PUBL 

The "all users" Video directory.

+
FOLDER_PROGRAMS_DEF 

Program files.

+
FOLDER_PROGRAMS_X86 

Program files.

+
FOLDER_PROGRAMS_X64 

Program files.

+
FOLDER_SYSROOT 

System "root" directory.

+
FOLDER_SYSTEM_DEF 

System directory.

+
FOLDER_SYSTEM_X86 

System directory for x86 (32-Bit)

diff --git a/docs/d3/dc1/_o_s_support_8h.html b/docs/d3/dc1/_o_s_support_8h.html index d63494e..8483f93 100644 --- a/docs/d3/dc1/_o_s_support_8h.html +++ b/docs/d3/dc1/_o_s_support_8h.html @@ -124,13 +124,30 @@ Enumerations   enum  MUtils::OS::known_folder_t {
-  MUtils::OS::FOLDER_ROAMING_DATA = 0, -MUtils::OS::FOLDER_LOCALAPPDATA = 1, -MUtils::OS::FOLDER_USER_PROFILE = 2, -MUtils::OS::FOLDER_PROGRAMFILES = 3, +  MUtils::OS::FOLDER_PROFILE_USER = 1, +MUtils::OS::FOLDER_PROFILE_PUBL = 2, +MUtils::OS::FOLDER_APPDATA_ROAM = 3, +MUtils::OS::FOLDER_APPDATA_LOCA = 4,
-  MUtils::OS::FOLDER_SYSTEMFOLDER = 4, -MUtils::OS::FOLDER_SYSTROOT_DIR = 5 +  MUtils::OS::FOLDER_DOCS_USER = 5, +MUtils::OS::FOLDER_DOCS_PUBL = 6, +MUtils::OS::FOLDER_DESKTOP_USER = 7, +MUtils::OS::FOLDER_DESKTOP_PUBL = 8, +
+  MUtils::OS::FOLDER_PICTURES_USER = 9, +MUtils::OS::FOLDER_PICTURES_PUBL = 10, +MUtils::OS::FOLDER_MUSIC_USER = 11, +MUtils::OS::FOLDER_MUSIC_PUBL = 12, +
+  MUtils::OS::FOLDER_VIDEO_USER = 13, +MUtils::OS::FOLDER_VIDEO_PUBL = 14, +MUtils::OS::FOLDER_PROGRAMS_DEF = 15, +MUtils::OS::FOLDER_PROGRAMS_X86 = 16, +
+  MUtils::OS::FOLDER_PROGRAMS_X64 = 17, +MUtils::OS::FOLDER_SYSROOT = 18, +MUtils::OS::FOLDER_SYSTEM_DEF = 19, +MUtils::OS::FOLDER_SYSTEM_X86 = 20
} This enumeration specifies "known" folder identifiers. More...
diff --git a/docs/d3/dc1/_o_s_support_8h_source.html b/docs/d3/dc1/_o_s_support_8h_source.html index 546ae70..aae2084 100644 --- a/docs/d3/dc1/_o_s_support_8h_source.html +++ b/docs/d3/dc1/_o_s_support_8h_source.html @@ -67,49 +67,63 @@ $(function() {
OSSupport.h
-Go to the documentation of this file.
1 // MuldeR's Utilities for Qt
3 // Copyright (C) 2004-2019 LoRd_MuldeR <MuldeR2@GMX.de>
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //
19 // http://www.gnu.org/licenses/lgpl-2.1.txt
21 
27 #pragma once
28 
29 //MUtils
30 #include <MUtils/Global.h>
31 
32 //Qt
33 #include <QString>
34 #include <QMap>
35 #include <QDate>
36 #include <QWidget>
37 
38 //Forward declaration
39 class QFile;
40 
42 
46 namespace MUtils
47 {
51  namespace OS
52  {
56  namespace Version
57  {
61  typedef enum
62  {
63  OS_UNKNOWN = 0,
65  }
66  os_type_t;
67 
71  typedef struct _os_version_t
72  {
73  unsigned int type;
74  unsigned int versionMajor;
75  unsigned int versionMinor;
76  unsigned int versionBuild;
77  unsigned int versionSPack;
78  bool overrideFlag;
79 
80  MUTILS_API bool operator== (const _os_version_t &rhs) const;
81  MUTILS_API bool operator!= (const _os_version_t &rhs) const;
82  MUTILS_API bool operator> (const _os_version_t &rhs) const;
83  MUTILS_API bool operator>= (const _os_version_t &rhs) const;
84  MUTILS_API bool operator< (const _os_version_t &rhs) const;
85  MUTILS_API bool operator<= (const _os_version_t &rhs) const;
86  }
88 
89  //Known Windows NT versions
90  MUTILS_API extern const os_version_t WINDOWS_WIN2K;
91  MUTILS_API extern const os_version_t WINDOWS_WINXP;
92  MUTILS_API extern const os_version_t WINDOWS_XPX64;
93  MUTILS_API extern const os_version_t WINDOWS_VISTA;
94  MUTILS_API extern const os_version_t WINDOWS_WIN70;
95  MUTILS_API extern const os_version_t WINDOWS_WIN80;
96  MUTILS_API extern const os_version_t WINDOWS_WIN81;
97  MUTILS_API extern const os_version_t WINDOWS_WN100;
98 
99  //Unknown OS
100  MUTILS_API extern const os_version_t UNKNOWN_OPSYS;
101  }
102 
106  typedef enum
107  {
114  }
116 
120  typedef enum
121  {
125  }
127 
131  typedef enum
132  {
139  }
140  drive_type_t;
141 
142  //System message
143  MUTILS_API void system_message_nfo(const wchar_t *const title, const wchar_t *const text);
144  MUTILS_API void system_message_wrn(const wchar_t *const title, const wchar_t *const text);
145  MUTILS_API void system_message_err(const wchar_t *const title, const wchar_t *const text);
146 
147  //CLI Arguments
148  typedef QMap<QString,QString> ArgumentMap;
149  MUTILS_API const QStringList crack_command_line(const QString &command_line = QString());
150  MUTILS_API const ArgumentMap &arguments(void);
151 
152  //Copy file
153  typedef bool (*progress_callback_t)(const double &progress, void *const userData);
154  MUTILS_API bool copy_file(const QString &sourcePath, const QString &outputPath, const bool &overwrite = true, const progress_callback_t callback = NULL, void *const userData = NULL);
155 
156  //Get file version
157  MUTILS_API bool get_file_version(const QString fileName, quint16 *const major = NULL, quint16 *const minor = NULL, quint16 *const patch = NULL, quint16 *const build = NULL);
158 
159  //Get the OS version
160  MUTILS_API const Version::os_version_t &os_version(void);
161  MUTILS_API const char *os_friendly_name(const MUtils::OS::Version::os_version_t &os_version);
162  MUTILS_API const bool &running_on_wine(void);
163 
164  //Get known Folder
165  MUTILS_API const QString &known_folder(const known_folder_t folder_id);
166 
167  //Current Date & Time
168  MUTILS_API QDate current_date(void);
169  MUTILS_API quint64 current_file_time(void);
170 
171  //Check for process elevation
172  MUTILS_API bool is_elevated(bool *bIsUacEnabled = NULL);
173  MUTILS_API bool user_is_admin(void);
174 
182  MUTILS_API int network_status(void);
183 
184  //Message handler
185  MUTILS_API bool handle_os_message(const void *const message, long *result);
186 
196  MUTILS_API void sleep_ms(const size_t &duration);
197 
198  //Is executable/library file?
199  MUTILS_API bool is_executable_file(const QString &path);
200  MUTILS_API bool is_library_file(const QString &path);
201 
202  //Shutdown & Hibernation
203  MUTILS_API bool is_hibernation_supported(void);
204  MUTILS_API bool shutdown_computer(const QString &message, const unsigned long timeout, const bool forceShutdown, const bool hibernate);
205 
206  //Free diskspace
207  MUTILS_API bool free_diskspace(const QString &path, quint64 &freeSpace);
208 
220  MUTILS_API drive_type_t get_drive_type(const QString &path, bool *fast_seeking = NULL);
221 
222  //Shell open
223  MUTILS_API bool shell_open(const QWidget *parent, const QString &url, const bool explore = false);
224  MUTILS_API bool shell_open(const QWidget *parent, const QString &url, const QString &parameters, const QString &directory, const bool explore = false);
225 
226  //Open media file
227  MUTILS_API bool open_media_file(const QString &mediaFilePath);
228 
229  //Process priority
230  MUTILS_API bool change_process_priority(const int priority);
231  MUTILS_API bool change_process_priority(const QProcess *proc, const int priority);
232 
233  //Process ID
234  MUTILS_API quint32 process_id(void);
235  MUTILS_API quint32 process_id(const QProcess *const proc);
236 
237  //Thread ID
238  MUTILS_API quint32 thread_id(void);
239  MUTILS_API quint32 thread_id(const QProcess *const proc);
240 
241  //Suspend or resume processv
242  MUTILS_API bool suspend_process(const QProcess *proc, const bool suspend);
243 
244  //System timer resolution
245  MUTILS_API bool setup_timer_resolution(const quint32 &interval = 1);
246  MUTILS_API bool reset_timer_resolution(const quint32 &interval = 1);
247 
248  //Set file time
249  MUTILS_API bool set_file_time(const QFile &file, const QDateTime &created = QDateTime(), const QDateTime &modified = QDateTime(), const QDateTime &accessed = QDateTime());
250  MUTILS_API bool set_file_time(const QString &path, const QDateTime &created = QDateTime(), const QDateTime &modified = QDateTime(), const QDateTime &accessed = QDateTime());
251 
252  //Keyboard support
253  MUTILS_API bool check_key_state_esc(void);
254 
255  //Shell notification
256  MUTILS_API void shell_change_notification(void);
257 
258  //Get file path from descriptor
259  MUTILS_API QString get_file_path(const int &fd);
260 
261  //WOW64 redirection
262  MUTILS_API bool wow64fsredir_disable(uintptr_t &oldValue);
263  MUTILS_API bool wow64fsredir_revert (const uintptr_t oldValue);
264 
265  //Environment variables
266  MUTILS_API QString get_envvar(const QString &name);
267  MUTILS_API bool set_envvar(const QString &name, const QString &value);
268 
269  //NULL device
270  MUTILS_API const QLatin1String &null_device(void);
271 
272  //Check if debugger is present
273  MUTILS_API void check_debugger(void);
274 
275  //Error handling
276  MUTILS_API void fatal_exit(const wchar_t* const errorMessage);
277  }
278 }
279 
MUTILS_API int network_status(void)
Check the network status.
+Go to the documentation of this file.
1 // MuldeR's Utilities for Qt
3 // Copyright (C) 2004-2019 LoRd_MuldeR <MuldeR2@GMX.de>
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //
19 // http://www.gnu.org/licenses/lgpl-2.1.txt
21 
27 #pragma once
28 
29 //MUtils
30 #include <MUtils/Global.h>
31 
32 //Qt
33 #include <QString>
34 #include <QMap>
35 #include <QDate>
36 #include <QWidget>
37 
38 //Forward declaration
39 class QFile;
40 
42 
46 namespace MUtils
47 {
51  namespace OS
52  {
56  namespace Version
57  {
61  typedef enum
62  {
63  OS_UNKNOWN = 0,
65  }
66  os_type_t;
67 
71  typedef struct _os_version_t
72  {
73  unsigned int type;
74  unsigned int versionMajor;
75  unsigned int versionMinor;
76  unsigned int versionBuild;
77  unsigned int versionSPack;
78  bool overrideFlag;
79 
80  MUTILS_API bool operator== (const _os_version_t &rhs) const;
81  MUTILS_API bool operator!= (const _os_version_t &rhs) const;
82  MUTILS_API bool operator> (const _os_version_t &rhs) const;
83  MUTILS_API bool operator>= (const _os_version_t &rhs) const;
84  MUTILS_API bool operator< (const _os_version_t &rhs) const;
85  MUTILS_API bool operator<= (const _os_version_t &rhs) const;
86  }
88 
89  //Known Windows NT versions
90  MUTILS_API extern const os_version_t WINDOWS_WIN2K;
91  MUTILS_API extern const os_version_t WINDOWS_WINXP;
92  MUTILS_API extern const os_version_t WINDOWS_XPX64;
93  MUTILS_API extern const os_version_t WINDOWS_VISTA;
94  MUTILS_API extern const os_version_t WINDOWS_WIN70;
95  MUTILS_API extern const os_version_t WINDOWS_WIN80;
96  MUTILS_API extern const os_version_t WINDOWS_WIN81;
97  MUTILS_API extern const os_version_t WINDOWS_WN100;
98 
99  //Unknown OS
100  MUTILS_API extern const os_version_t UNKNOWN_OPSYS;
101  }
102 
106  typedef enum
107  {
128  }
130 
134  typedef enum
135  {
139  }
141 
145  typedef enum
146  {
153  }
154  drive_type_t;
155 
156  //System message
157  MUTILS_API void system_message_nfo(const wchar_t *const title, const wchar_t *const text);
158  MUTILS_API void system_message_wrn(const wchar_t *const title, const wchar_t *const text);
159  MUTILS_API void system_message_err(const wchar_t *const title, const wchar_t *const text);
160 
161  //CLI Arguments
162  typedef QMap<QString,QString> ArgumentMap;
163  MUTILS_API const QStringList crack_command_line(const QString &command_line = QString());
164  MUTILS_API const ArgumentMap &arguments(void);
165 
166  //Copy file
167  typedef bool (*progress_callback_t)(const double &progress, void *const userData);
168  MUTILS_API bool copy_file(const QString &sourcePath, const QString &outputPath, const bool &overwrite = true, const progress_callback_t callback = NULL, void *const userData = NULL);
169 
170  //Get file version
171  MUTILS_API bool get_file_version(const QString fileName, quint16 *const major = NULL, quint16 *const minor = NULL, quint16 *const patch = NULL, quint16 *const build = NULL);
172 
173  //Get the OS version
174  MUTILS_API const Version::os_version_t &os_version(void);
175  MUTILS_API const char *os_friendly_name(const MUtils::OS::Version::os_version_t &os_version);
176  MUTILS_API const bool &running_on_wine(void);
177 
178  //Get known Folder
179  MUTILS_API const QString &known_folder(const known_folder_t folder_id);
180 
181  //Current Date & Time
182  MUTILS_API QDate current_date(void);
183  MUTILS_API quint64 current_file_time(void);
184 
185  //Check for process elevation
186  MUTILS_API bool is_elevated(bool *bIsUacEnabled = NULL);
187  MUTILS_API bool user_is_admin(void);
188 
196  MUTILS_API int network_status(void);
197 
198  //Message handler
199  MUTILS_API bool handle_os_message(const void *const message, long *result);
200 
210  MUTILS_API void sleep_ms(const size_t &duration);
211 
212  //Is executable/library file?
213  MUTILS_API bool is_executable_file(const QString &path);
214  MUTILS_API bool is_library_file(const QString &path);
215 
216  //Shutdown & Hibernation
217  MUTILS_API bool is_hibernation_supported(void);
218  MUTILS_API bool shutdown_computer(const QString &message, const unsigned long timeout, const bool forceShutdown, const bool hibernate);
219 
220  //Free diskspace
221  MUTILS_API bool free_diskspace(const QString &path, quint64 &freeSpace);
222 
234  MUTILS_API drive_type_t get_drive_type(const QString &path, bool *fast_seeking = NULL);
235 
236  //Shell open
237  MUTILS_API bool shell_open(const QWidget *parent, const QString &url, const bool explore = false);
238  MUTILS_API bool shell_open(const QWidget *parent, const QString &url, const QString &parameters, const QString &directory, const bool explore = false);
239 
240  //Open media file
241  MUTILS_API bool open_media_file(const QString &mediaFilePath);
242 
243  //Process priority
244  MUTILS_API bool change_process_priority(const int priority);
245  MUTILS_API bool change_process_priority(const QProcess *proc, const int priority);
246 
247  //Process ID
248  MUTILS_API quint32 process_id(void);
249  MUTILS_API quint32 process_id(const QProcess *const proc);
250 
251  //Thread ID
252  MUTILS_API quint32 thread_id(void);
253  MUTILS_API quint32 thread_id(const QProcess *const proc);
254 
255  //Suspend or resume processv
256  MUTILS_API bool suspend_process(const QProcess *proc, const bool suspend);
257 
258  //System timer resolution
259  MUTILS_API bool setup_timer_resolution(const quint32 &interval = 1);
260  MUTILS_API bool reset_timer_resolution(const quint32 &interval = 1);
261 
262  //Set file time
263  MUTILS_API bool set_file_time(const QFile &file, const QDateTime &created = QDateTime(), const QDateTime &modified = QDateTime(), const QDateTime &accessed = QDateTime());
264  MUTILS_API bool set_file_time(const QString &path, const QDateTime &created = QDateTime(), const QDateTime &modified = QDateTime(), const QDateTime &accessed = QDateTime());
265 
266  //Keyboard support
267  MUTILS_API bool check_key_state_esc(void);
268 
269  //Shell notification
270  MUTILS_API void shell_change_notification(void);
271 
272  //Get file path from descriptor
273  MUTILS_API QString get_file_path(const int &fd);
274 
275  //WOW64 redirection
276  MUTILS_API bool wow64fsredir_disable(uintptr_t &oldValue);
277  MUTILS_API bool wow64fsredir_revert (const uintptr_t oldValue);
278 
279  //Environment variables
280  MUTILS_API QString get_envvar(const QString &name);
281  MUTILS_API bool set_envvar(const QString &name, const QString &value);
282 
283  //NULL device
284  MUTILS_API const QLatin1String &null_device(void);
285 
286  //Check if debugger is present
287  MUTILS_API void check_debugger(void);
288 
289  //Error handling
290  MUTILS_API void fatal_exit(const wchar_t* const errorMessage);
291  }
292 }
293 
The "all users" Documents directory.
Definition: OSSupport.h:113
+
MUTILS_API int network_status(void)
Check the network status.
MUTILS_API const os_version_t UNKNOWN_OPSYS
Operating system version constant.
-
Local application data (non-roaming)
Definition: OSSupport.h:109
+
Program files.
Definition: OSSupport.h:124
unsigned int versionMinor
The minor version of the underlaying operating system.
Definition: OSSupport.h:75
-
Program files.
Definition: OSSupport.h:111
+
The user&#39;s Music directory.
Definition: OSSupport.h:117
+
The "all users" Video directory.
Definition: OSSupport.h:121
unsigned int versionBuild
The build number of the underlaying operating system.
Definition: OSSupport.h:76
-
System "root" directory.
Definition: OSSupport.h:113
Definition: Version.h:34
This file contains miscellaneous functions that are generally useful for Qt-based applications...
MUTILS_API void sleep_ms(const size_t &duration)
Suspend calling thread.
+
System "root" directory.
Definition: OSSupport.h:125
struct MUtils::OS::Version::_os_version_t os_version_t
This struct contains version information about the underlaying operating system. See _os_version_t fo...
-
Application-specific data.
Definition: OSSupport.h:108
+
The user&#39;s Music directory.
Definition: OSSupport.h:116
unsigned int versionMajor
The major version of the underlaying operating system.
Definition: OSSupport.h:74
-
drive_type_t
This enumeration specifies drive types.
Definition: OSSupport.h:131
+
drive_type_t
This enumeration specifies drive types.
Definition: OSSupport.h:145
+
Local application data (non-roaming)
Definition: OSSupport.h:111
MUTILS_API const os_version_t WINDOWS_WIN70
Operating system version constant.
MUTILS_API const os_version_t WINDOWS_WIN80
Operating system version constant.
+
System directory for x86 (32-Bit)
Definition: OSSupport.h:127
MUTILS_API const os_version_t WINDOWS_WIN2K
Operating system version constant.
-
Hard Disk drive or Solid-State Drive.
Definition: OSSupport.h:135
-
Optical disk srive, e.g. CD or DVD.
Definition: OSSupport.h:137
+
Hard Disk drive or Solid-State Drive.
Definition: OSSupport.h:149
+
The user&#39;s profile folder.
Definition: OSSupport.h:108
+
The user&#39;s Music directory.
Definition: OSSupport.h:118
+
Optical disk srive, e.g. CD or DVD.
Definition: OSSupport.h:151
Unknown operating system.
Definition: OSSupport.h:63
+
Application-specific data.
Definition: OSSupport.h:110
+
The "all users" Music directory.
Definition: OSSupport.h:119
MUTILS_API const os_version_t WINDOWS_WN100
Operating system version constant.
+
Program files.
Definition: OSSupport.h:122
os_type_t
This enumeration specifies the type of the underlaying operating system.
Definition: OSSupport.h:61
MUTILS_API const os_version_t WINDOWS_WIN81
Operating system version constant.
This struct contains version information about the underlaying operating system. See _os_version_t fo...
Definition: OSSupport.h:71
unsigned int versionSPack
The service pack version of the underlaying operating system.
Definition: OSSupport.h:77
-
Remote/Network drive.
Definition: OSSupport.h:136
+
The "all users" Desktop directory.
Definition: OSSupport.h:115
+
The user&#39;s Video directory.
Definition: OSSupport.h:120
+
Remote/Network drive.
Definition: OSSupport.h:150
MUTILS_API const os_version_t WINDOWS_VISTA
Operating system version constant.
Global MUtils namespace.
Definition: CPUFeatures.h:37
-
Computer is not connected to a network.
Definition: OSSupport.h:123
-
The drive type cannot be determined.
Definition: OSSupport.h:133
-
The user&#39;s profile folder.
Definition: OSSupport.h:110
+
Computer is not connected to a network.
Definition: OSSupport.h:137
+
System directory.
Definition: OSSupport.h:126
+
The drive type cannot be determined.
Definition: OSSupport.h:147
+
The user&#39;s Documents directory.
Definition: OSSupport.h:112
MUTILS_API const os_version_t WINDOWS_WINXP
Operating system version constant.
-
Floppy Drive, or Flash Card reader.
Definition: OSSupport.h:134
-
RAM disk.
Definition: OSSupport.h:138
+
Floppy Drive, or Flash Card reader.
Definition: OSSupport.h:148
+
The user&#39;s Desktop directory.
Definition: OSSupport.h:114
+
The "all users" profile folder.
Definition: OSSupport.h:109
+
RAM disk.
Definition: OSSupport.h:152
MUTILS_API drive_type_t get_drive_type(const QString &path, bool *fast_seeking=NULL)
Detect drive type.
-
network_type_t
This enumeration specifies network connection types.
Definition: OSSupport.h:120
-
Computer is connected to a network.
Definition: OSSupport.h:124
-
System directory.
Definition: OSSupport.h:112
+
network_type_t
This enumeration specifies network connection types.
Definition: OSSupport.h:134
+
Computer is connected to a network.
Definition: OSSupport.h:138
Microsoft(R) Windows.
Definition: OSSupport.h:64
unsigned int type
The type of the underlaying operating system, as os_type_t
Definition: OSSupport.h:73
+
Program files.
Definition: OSSupport.h:123
known_folder_t
This enumeration specifies "known" folder identifiers.
Definition: OSSupport.h:106
MUTILS_API const os_version_t WINDOWS_XPX64
Operating system version constant.
-
Network connection is unknown.
Definition: OSSupport.h:122
+
Network connection is unknown.
Definition: OSSupport.h:136
-Go to the documentation of this file.
1 // MuldeR's Utilities for Qt
3 // Copyright (C) 2004-2019 LoRd_MuldeR <MuldeR2@GMX.de>
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //
19 // http://www.gnu.org/licenses/lgpl-2.1.txt
21 
27 #pragma once
28 
29 #include <QString>
30 
31 //Forward Declarations
32 class QProcess;
33 class QDir;
34 template<typename K, typename V> class QHash;
35 
37 
41  //Interface version
42 #define MUTILS_INTERFACE 2
43 
44 //MUtils API
45 #ifdef _MSC_VER
46 # ifdef MUTILS_DLL_EXPORT
47 # define MUTILS_API __declspec(dllexport)
48 # else
49 # ifndef MUTILS_STATIC_LIB
50 # define MUTILS_API __declspec(dllimport)
51 # else
52 # define MUTILS_API /*static lib*/
53 # endif
54 # endif
55 #else
56 # define MUTILS_API
57 #endif
58 
59 //Check Debug Flags
60 #if defined(_DEBUG) || defined(DEBUG) || (!defined(NDEBUG))
61 # define MUTILS_DEBUG (1)
62 # if defined(NDEBUG) || defined(QT_NO_DEBUG) || (!defined(QT_DEBUG))
63 # error Inconsistent DEBUG flags have been detected!
64 # endif
65 #else
66 # define MUTILS_DEBUG (0)
67 # if (!defined(NDEBUG)) || (!defined(QT_NO_DEBUG)) || defined(QT_DEBUG)
68 # error Inconsistent DEBUG flags have been detected!
69 # endif
70 #endif
71 
72 //Check CPU options
73 #if defined(_MSC_VER) && (!defined(__INTELLISENSE__)) && (!defined(_M_X64)) && defined(_M_IX86_FP)
74  #if (_M_IX86_FP != 0)
75  #error We should not enabled SSE or SSE2 in release builds!
76  #endif
77 #endif
78 
79 //Library initializer
80 #define MUTILS_GLUE_NAME_HELPER(X,Y) X##Y
81 #define MUTILS_GLUE_NAME(X,Y) MUTILS_GLUE_NAME_HELPER(X,Y)
82 #if MUTILS_DEBUG
83 #define MUTILS_INITIALIZER MUTILS_GLUE_NAME(initialize_d, MUTILS_INTERFACE)
84 #else
85 #define MUTILS_INITIALIZER MUTILS_GLUE_NAME(initialize_r, MUTILS_INTERFACE)
86 #endif
87 
88 //Compiler warnings
89 #define MUTILS_MAKE_STRING_HELPER(X) #X
90 #define MUTILS_MAKE_STRING(X) MUTILS_MAKE_STRING_HELPER(X)
91 #define MUTILS_COMPILER_WARNING(TXT) __pragma(message(__FILE__ "(" MUTILS_MAKE_STRING(__LINE__) ") : warning: " TXT))
92 
96 
101 namespace MUtils
102 {
106  typedef struct _fp_parts_t { double parts[2]; } fp_parts_t;
107 
115  MUTILS_API const QString& temp_folder(void);
116 
130  MUTILS_API void init_process(QProcess &process, const QString &wokringDir, const bool bReplaceTempDir = true, const QStringList *const extraPaths = NULL, const QHash<QString, QString> *const extraEnv = NULL);
131 
139  MUTILS_API quint32 next_rand_u32(void);
140  MUTILS_API quint32 next_rand_u32(const quint32 max);
141 
149  MUTILS_API quint64 next_rand_u64(void);
150 
160  MUTILS_API QString next_rand_str(const bool &bLong = false);
161 
175  MUTILS_API QString make_temp_file(const QString &basePath, const QString &extension, const bool placeholder = false);
176  MUTILS_API QString make_temp_file(const QDir &basePath, const QString &extension, const bool placeholder = false);
177 
193  MUTILS_API QString make_unique_file(const QString &basePath, const QString &baseName, const QString &extension, const bool fancy = false, const bool placeholder = false);
194  MUTILS_API QString make_unique_file(const QDir &basePath, const QString &baseName, const QString &extension, const bool fancy = false, const bool placeholder = false);
195 
203  MUTILS_API bool parity(quint32 value);
204 
214  MUTILS_API bool remove_file(const QString &fileName);
215 
227  MUTILS_API bool remove_directory(const QString &folderPath, const bool &recursive);
228 
238  MUTILS_API QString& trim_right(QString &str);
239 
249  MUTILS_API QString& trim_left(QString &str);
250 
260  MUTILS_API QString trim_right(const QString &str);
261 
271  MUTILS_API QString trim_left(const QString &str);
272 
282  MUTILS_API void natural_string_sort(QStringList &list, const bool bIgnoreCase);
283 
295  MUTILS_API QString clean_file_name(const QString &name, const bool &pretty);
296 
308  MUTILS_API QString clean_file_path(const QString &path, const bool &pretty);
309 
321  MUTILS_API bool regexp_parse_uint32(const QRegExp &regexp, quint32 &value);
322  MUTILS_API bool regexp_parse_int32(const QRegExp &regexp, qint32 &value);
323  MUTILS_API bool regexp_parse_uint32(const QRegExp &regexp, quint32 &value, const size_t &offset);
324  MUTILS_API bool regexp_parse_int32(const QRegExp &regexp, qint32 &value, const size_t &offset);
325 
339  MUTILS_API bool regexp_parse_uint32(const QRegExp &regexp, quint32 *values, const size_t &count);
340  MUTILS_API bool regexp_parse_int32(const QRegExp &regexp, qint32 *values, const size_t &count);
341  MUTILS_API bool regexp_parse_uint32(const QRegExp &regexp, quint32 *values, const size_t &offset, const size_t &count);
342  MUTILS_API bool regexp_parse_int32(const QRegExp &regexp, qint32 *values, const size_t &offset, const size_t &count);
343 
353  MUTILS_API QStringList available_codepages(const bool &noAliases = true);
354 
364  MUTILS_API fp_parts_t break_fp(const double value);
365 
366  //Internal (do *not* call directly!)
367  namespace Internal
368  {
369  MUTILS_API unsigned int MUTILS_INITIALIZER(const unsigned int interfaceId);
370  static const unsigned int init_flag = MUTILS_INITIALIZER(MUTILS_INTERFACE);
371  }
372 }
373 
375 
378 #define MUTILS_DELETE(PTR) do { if((PTR)) { delete (PTR); (PTR) = NULL; } } while(0)
379 
382 #define MUTILS_DELETE_ARRAY(PTR) do { if((PTR)) { delete [] (PTR); (PTR) = NULL; } } while(0)
383 
386 #define MUTILS_ZERO_MEMORY(PTR) memset(&(PTR), 0, sizeof((PTR)))
387 
390 #define MUTILS_WCHR(STR) (reinterpret_cast<const wchar_t*>((STR).utf16()))
391 
394 #define MUTILS_UTF8(STR) ((STR).toUtf8().constData())
395 
398 #define MUTILS_L1STR(STR) ((STR).toLatin1().constData())
399 
402 #define MUTILS_QSTR(STR) (QString::fromUtf16(reinterpret_cast<const unsigned short*>((STR))))
403 
406 #define MUTILS_BOOL2STR(X) ((X) ? "1" : "0")
407 
410 #define MUTILS_BOOLIFY(X) (!(!(X)))
411 
414 #define MUTILS_ARR2LEN(X) (sizeof((X)) / sizeof((X)[0]))
415 
418 #define MUTILS_NO_COPY(CLASS) \
419  CLASS(const CLASS &) { throw "Copy constructor is disabled!"; } \
420  CLASS &operator=(const CLASS &) { throw "Assignment operator is disabled!"; }
MUTILS_API QStringList available_codepages(const bool &noAliases=true)
Retrieve a list of all available codepages.
+Go to the documentation of this file.
1 // MuldeR's Utilities for Qt
3 // Copyright (C) 2004-2019 LoRd_MuldeR <MuldeR2@GMX.de>
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //
19 // http://www.gnu.org/licenses/lgpl-2.1.txt
21 
27 #pragma once
28 
29 #include <QString>
30 
31 //Forward Declarations
32 class QProcess;
33 class QDir;
34 template<typename K, typename V> class QHash;
35 
37 
41  //Interface version
42 #define MUTILS_INTERFACE 3
43 
44 //MUtils API
45 #ifdef _MSC_VER
46 # ifdef MUTILS_DLL_EXPORT
47 # define MUTILS_API __declspec(dllexport)
48 # else
49 # ifndef MUTILS_STATIC_LIB
50 # define MUTILS_API __declspec(dllimport)
51 # else
52 # define MUTILS_API /*static lib*/
53 # endif
54 # endif
55 #else
56 # define MUTILS_API
57 #endif
58 
59 //Check Debug Flags
60 #if defined(_DEBUG) || defined(DEBUG) || (!defined(NDEBUG))
61 # define MUTILS_DEBUG (1)
62 # if defined(NDEBUG) || defined(QT_NO_DEBUG) || (!defined(QT_DEBUG))
63 # error Inconsistent DEBUG flags have been detected!
64 # endif
65 #else
66 # define MUTILS_DEBUG (0)
67 # if (!defined(NDEBUG)) || (!defined(QT_NO_DEBUG)) || defined(QT_DEBUG)
68 # error Inconsistent DEBUG flags have been detected!
69 # endif
70 #endif
71 
72 //Check CPU options
73 #if defined(_MSC_VER) && (!defined(__INTELLISENSE__)) && (!defined(_M_X64)) && defined(_M_IX86_FP)
74  #if (_M_IX86_FP != 0)
75  #error We should not enabled SSE or SSE2 in release builds!
76  #endif
77 #endif
78 
79 //Library initializer
80 #define MUTILS_GLUE_NAME_HELPER(X,Y) X##Y
81 #define MUTILS_GLUE_NAME(X,Y) MUTILS_GLUE_NAME_HELPER(X,Y)
82 #if MUTILS_DEBUG
83 #define MUTILS_INITIALIZER MUTILS_GLUE_NAME(initialize_d, MUTILS_INTERFACE)
84 #else
85 #define MUTILS_INITIALIZER MUTILS_GLUE_NAME(initialize_r, MUTILS_INTERFACE)
86 #endif
87 
88 //Compiler warnings
89 #define MUTILS_MAKE_STRING_HELPER(X) #X
90 #define MUTILS_MAKE_STRING(X) MUTILS_MAKE_STRING_HELPER(X)
91 #define MUTILS_COMPILER_WARNING(TXT) __pragma(message(__FILE__ "(" MUTILS_MAKE_STRING(__LINE__) ") : warning: " TXT))
92 
96 
101 namespace MUtils
102 {
106  typedef struct _fp_parts_t { double parts[2]; } fp_parts_t;
107 
115  MUTILS_API const QString& temp_folder(void);
116 
130  MUTILS_API void init_process(QProcess &process, const QString &wokringDir, const bool bReplaceTempDir = true, const QStringList *const extraPaths = NULL, const QHash<QString, QString> *const extraEnv = NULL);
131 
139  MUTILS_API quint32 next_rand_u32(void);
140  MUTILS_API quint32 next_rand_u32(const quint32 max);
141 
149  MUTILS_API quint64 next_rand_u64(void);
150 
160  MUTILS_API QString next_rand_str(const bool &bLong = false);
161 
175  MUTILS_API QString make_temp_file(const QString &basePath, const QString &extension, const bool placeholder = false);
176  MUTILS_API QString make_temp_file(const QDir &basePath, const QString &extension, const bool placeholder = false);
177 
193  MUTILS_API QString make_unique_file(const QString &basePath, const QString &baseName, const QString &extension, const bool fancy = false, const bool placeholder = false);
194  MUTILS_API QString make_unique_file(const QDir &basePath, const QString &baseName, const QString &extension, const bool fancy = false, const bool placeholder = false);
195 
203  MUTILS_API bool parity(quint32 value);
204 
214  MUTILS_API bool remove_file(const QString &fileName);
215 
227  MUTILS_API bool remove_directory(const QString &folderPath, const bool &recursive);
228 
238  MUTILS_API QString& trim_right(QString &str);
239 
249  MUTILS_API QString& trim_left(QString &str);
250 
260  MUTILS_API QString trim_right(const QString &str);
261 
271  MUTILS_API QString trim_left(const QString &str);
272 
282  MUTILS_API void natural_string_sort(QStringList &list, const bool bIgnoreCase);
283 
295  MUTILS_API QString clean_file_name(const QString &name, const bool &pretty);
296 
308  MUTILS_API QString clean_file_path(const QString &path, const bool &pretty);
309 
321  MUTILS_API bool regexp_parse_uint32(const QRegExp &regexp, quint32 &value);
322  MUTILS_API bool regexp_parse_int32(const QRegExp &regexp, qint32 &value);
323  MUTILS_API bool regexp_parse_uint32(const QRegExp &regexp, quint32 &value, const size_t &offset);
324  MUTILS_API bool regexp_parse_int32(const QRegExp &regexp, qint32 &value, const size_t &offset);
325 
339  MUTILS_API bool regexp_parse_uint32(const QRegExp &regexp, quint32 *values, const size_t &count);
340  MUTILS_API bool regexp_parse_int32(const QRegExp &regexp, qint32 *values, const size_t &count);
341  MUTILS_API bool regexp_parse_uint32(const QRegExp &regexp, quint32 *values, const size_t &offset, const size_t &count);
342  MUTILS_API bool regexp_parse_int32(const QRegExp &regexp, qint32 *values, const size_t &offset, const size_t &count);
343 
353  MUTILS_API QStringList available_codepages(const bool &noAliases = true);
354 
364  MUTILS_API fp_parts_t break_fp(const double value);
365 
366  //Internal (do *not* call directly!)
367  namespace Internal
368  {
369  MUTILS_API unsigned int MUTILS_INITIALIZER(const unsigned int interfaceId);
370  static const unsigned int init_flag = MUTILS_INITIALIZER(MUTILS_INTERFACE);
371  }
372 }
373 
375 
378 #define MUTILS_DELETE(PTR) do { if((PTR)) { delete (PTR); (PTR) = NULL; } } while(0)
379 
382 #define MUTILS_DELETE_ARRAY(PTR) do { if((PTR)) { delete [] (PTR); (PTR) = NULL; } } while(0)
383 
386 #define MUTILS_ZERO_MEMORY(PTR) memset(&(PTR), 0, sizeof((PTR)))
387 
390 #define MUTILS_WCHR(STR) (reinterpret_cast<const wchar_t*>((STR).utf16()))
391 
394 #define MUTILS_UTF8(STR) ((STR).toUtf8().constData())
395 
398 #define MUTILS_L1STR(STR) ((STR).toLatin1().constData())
399 
402 #define MUTILS_QSTR(STR) (QString::fromUtf16(reinterpret_cast<const unsigned short*>((STR))))
403 
406 #define MUTILS_BOOL2STR(X) ((X) ? "1" : "0")
407 
410 #define MUTILS_BOOLIFY(X) (!(!(X)))
411 
414 #define MUTILS_ARR2LEN(X) (sizeof((X)) / sizeof((X)[0]))
415 
418 #define MUTILS_NO_COPY(CLASS) \
419  CLASS(const CLASS &) { throw "Copy constructor is disabled!"; } \
420  CLASS &operator=(const CLASS &) { throw "Assignment operator is disabled!"; }
MUTILS_API QStringList available_codepages(const bool &noAliases=true)
Retrieve a list of all available codepages.
struct MUtils::_fp_parts_t fp_parts_t
This struct containes the parts (integral and fractional part) of a floating-point number...
MUTILS_API QString next_rand_str(const bool &bLong=false)
Generates a random string.
MUTILS_API bool remove_file(const QString &fileName)
Deletes the specified file.
diff --git a/docs/menudata.js b/docs/menudata.js index 3ba07ae..71feb37 100644 --- a/docs/menudata.js +++ b/docs/menudata.js @@ -26,7 +26,11 @@ var menudata={children:[ {text:'Variables',url:'namespacemembers_vars.html'}, {text:'Typedefs',url:'namespacemembers_type.html'}, {text:'Enumerations',url:'namespacemembers_enum.html'}, -{text:'Enumerator',url:'namespacemembers_eval.html'}]}]}, +{text:'Enumerator',url:'namespacemembers_eval.html',children:[ +{text:'d',url:'namespacemembers_eval.html#index_d'}, +{text:'f',url:'namespacemembers_eval.html#index_f'}, +{text:'n',url:'namespacemembers_eval.html#index_n'}, +{text:'o',url:'namespacemembers_eval.html#index_o'}]}]}]}, {text:'Classes',url:'annotated.html',children:[ {text:'Class List',url:'annotated.html'}, {text:'Class Index',url:'classes.html'}, diff --git a/docs/namespacemembers.html b/docs/namespacemembers.html index 7075284..d3482c3 100644 --- a/docs/namespacemembers.html +++ b/docs/namespacemembers.html @@ -153,23 +153,65 @@ $(function() {
  • FLAG_SSSE3 : MUtils::CPUFetaures
  • -
  • FOLDER_LOCALAPPDATA -: MUtils::OS +
  • FOLDER_APPDATA_LOCA +: MUtils::OS
  • -
  • FOLDER_PROGRAMFILES -: MUtils::OS +
  • FOLDER_APPDATA_ROAM +: MUtils::OS
  • -
  • FOLDER_ROAMING_DATA -: MUtils::OS +
  • FOLDER_DESKTOP_PUBL +: MUtils::OS
  • -
  • FOLDER_SYSTEMFOLDER -: MUtils::OS +
  • FOLDER_DESKTOP_USER +: MUtils::OS
  • -
  • FOLDER_SYSTROOT_DIR -: MUtils::OS +
  • FOLDER_DOCS_PUBL +: MUtils::OS
  • -
  • FOLDER_USER_PROFILE -: MUtils::OS +
  • FOLDER_DOCS_USER +: MUtils::OS +
  • +
  • FOLDER_MUSIC_PUBL +: MUtils::OS +
  • +
  • FOLDER_MUSIC_USER +: MUtils::OS +
  • +
  • FOLDER_PICTURES_PUBL +: MUtils::OS +
  • +
  • FOLDER_PICTURES_USER +: MUtils::OS +
  • +
  • FOLDER_PROFILE_PUBL +: MUtils::OS +
  • +
  • FOLDER_PROFILE_USER +: MUtils::OS +
  • +
  • FOLDER_PROGRAMS_DEF +: MUtils::OS +
  • +
  • FOLDER_PROGRAMS_X64 +: MUtils::OS +
  • +
  • FOLDER_PROGRAMS_X86 +: MUtils::OS +
  • +
  • FOLDER_SYSROOT +: MUtils::OS +
  • +
  • FOLDER_SYSTEM_DEF +: MUtils::OS +
  • +
  • FOLDER_SYSTEM_X86 +: MUtils::OS +
  • +
  • FOLDER_VIDEO_PUBL +: MUtils::OS +
  • +
  • FOLDER_VIDEO_USER +: MUtils::OS
  • fp_parts_t : MUtils diff --git a/docs/namespacemembers_eval.html b/docs/namespacemembers_eval.html index 170b432..263a70b 100644 --- a/docs/namespacemembers_eval.html +++ b/docs/namespacemembers_eval.html @@ -59,7 +59,9 @@ $(function() {
    • +  + +

      - d -

      + + +

      - f -

      + + +

      - n -

      + + +

      - o -

      • OS_UNKNOWN : MUtils::OS::Version
      • diff --git a/docs/search/all_5.js b/docs/search/all_5.js index 074916f..6ad2dae 100644 --- a/docs/search/all_5.js +++ b/docs/search/all_5.js @@ -14,11 +14,25 @@ var searchData= ['flag_5fsse41',['FLAG_SSE41',['../d3/d02/namespace_m_utils_1_1_c_p_u_fetaures.html#a425bc8f89d64bf6dafdbd00c89b9874b',1,'MUtils::CPUFetaures']]], ['flag_5fsse42',['FLAG_SSE42',['../d3/d02/namespace_m_utils_1_1_c_p_u_fetaures.html#afcb03b5edb1518bfca9984ff9ccc4f99',1,'MUtils::CPUFetaures']]], ['flag_5fssse3',['FLAG_SSSE3',['../d3/d02/namespace_m_utils_1_1_c_p_u_fetaures.html#a5125a29c37e57656f45ad168e654fd05',1,'MUtils::CPUFetaures']]], - ['folder_5flocalappdata',['FOLDER_LOCALAPPDATA',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54a0fb64b1e975f9ff0cc97df6e3b7f8110',1,'MUtils::OS']]], - ['folder_5fprogramfiles',['FOLDER_PROGRAMFILES',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54abb6f5bd0b6564b2f093f5a2d1c055183',1,'MUtils::OS']]], - ['folder_5froaming_5fdata',['FOLDER_ROAMING_DATA',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54ab1f55647ec7567aa2160383bc26539d5',1,'MUtils::OS']]], - ['folder_5fsystemfolder',['FOLDER_SYSTEMFOLDER',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54a7c25655022efd34417acfaa11f8491b3',1,'MUtils::OS']]], - ['folder_5fsystroot_5fdir',['FOLDER_SYSTROOT_DIR',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54af32b4c27ec428ad2bf69d8c8802de21c',1,'MUtils::OS']]], - ['folder_5fuser_5fprofile',['FOLDER_USER_PROFILE',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54a77c4c8768676d49c26bcec33dcf23b1e',1,'MUtils::OS']]], + ['folder_5fappdata_5floca',['FOLDER_APPDATA_LOCA',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54af000386a72d8444c5ad0783ba8077ce1',1,'MUtils::OS']]], + ['folder_5fappdata_5froam',['FOLDER_APPDATA_ROAM',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54a6f3aef740ec77b6ddea8e3eeea8d2951',1,'MUtils::OS']]], + ['folder_5fdesktop_5fpubl',['FOLDER_DESKTOP_PUBL',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54a8c639c3e3075fe0859034334ac9b24d8',1,'MUtils::OS']]], + ['folder_5fdesktop_5fuser',['FOLDER_DESKTOP_USER',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54a15eb1ce4cbc1e819ef61380d8567f8fc',1,'MUtils::OS']]], + ['folder_5fdocs_5fpubl',['FOLDER_DOCS_PUBL',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54ac60998b86c14fd99fb7606a7f5631039',1,'MUtils::OS']]], + ['folder_5fdocs_5fuser',['FOLDER_DOCS_USER',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54a24fe95c218f2f96f79ed4331816d1bf2',1,'MUtils::OS']]], + ['folder_5fmusic_5fpubl',['FOLDER_MUSIC_PUBL',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54a945615852ec433d54bd660e7d06e7eba',1,'MUtils::OS']]], + ['folder_5fmusic_5fuser',['FOLDER_MUSIC_USER',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54a5eb537ab772312644d490ee5597a57ae',1,'MUtils::OS']]], + ['folder_5fpictures_5fpubl',['FOLDER_PICTURES_PUBL',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54a9cb1691e4de71331189728945692e6e9',1,'MUtils::OS']]], + ['folder_5fpictures_5fuser',['FOLDER_PICTURES_USER',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54abf17b1a0f30e2ff38990973a778e6ee9',1,'MUtils::OS']]], + ['folder_5fprofile_5fpubl',['FOLDER_PROFILE_PUBL',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54ad9e442fb54bdee21838b485b51399ea2',1,'MUtils::OS']]], + ['folder_5fprofile_5fuser',['FOLDER_PROFILE_USER',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54a31103048fccf15ef2af81b75357ebb70',1,'MUtils::OS']]], + ['folder_5fprograms_5fdef',['FOLDER_PROGRAMS_DEF',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54a089096fbc0c16f0a08c85c9ad3ecd4d4',1,'MUtils::OS']]], + ['folder_5fprograms_5fx64',['FOLDER_PROGRAMS_X64',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54af76af3d9c84eff178c323768779d69b7',1,'MUtils::OS']]], + ['folder_5fprograms_5fx86',['FOLDER_PROGRAMS_X86',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54a9fc4296b5058087caf97d4547fe4063a',1,'MUtils::OS']]], + ['folder_5fsysroot',['FOLDER_SYSROOT',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54af8584f32060415349b71d2369a16515a',1,'MUtils::OS']]], + ['folder_5fsystem_5fdef',['FOLDER_SYSTEM_DEF',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54aafb108d0830bacd39c55ea054689857a',1,'MUtils::OS']]], + ['folder_5fsystem_5fx86',['FOLDER_SYSTEM_X86',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54af50a26cb638902ca94fd88c0a797abb9',1,'MUtils::OS']]], + ['folder_5fvideo_5fpubl',['FOLDER_VIDEO_PUBL',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54a33e99fdb7c830d5581ed15d92415c848',1,'MUtils::OS']]], + ['folder_5fvideo_5fuser',['FOLDER_VIDEO_USER',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54a4a71f200b12a3a45f4bb092b262c3cc1',1,'MUtils::OS']]], ['fp_5fparts_5ft',['fp_parts_t',['../d3/da6/namespace_m_utils.html#a75209365a097871cb2bb8fc3a21ce14b',1,'MUtils']]] ]; diff --git a/docs/search/enumvalues_1.js b/docs/search/enumvalues_1.js index 0011085..2c0ba33 100644 --- a/docs/search/enumvalues_1.js +++ b/docs/search/enumvalues_1.js @@ -1,9 +1,23 @@ var searchData= [ - ['folder_5flocalappdata',['FOLDER_LOCALAPPDATA',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54a0fb64b1e975f9ff0cc97df6e3b7f8110',1,'MUtils::OS']]], - ['folder_5fprogramfiles',['FOLDER_PROGRAMFILES',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54abb6f5bd0b6564b2f093f5a2d1c055183',1,'MUtils::OS']]], - ['folder_5froaming_5fdata',['FOLDER_ROAMING_DATA',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54ab1f55647ec7567aa2160383bc26539d5',1,'MUtils::OS']]], - ['folder_5fsystemfolder',['FOLDER_SYSTEMFOLDER',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54a7c25655022efd34417acfaa11f8491b3',1,'MUtils::OS']]], - ['folder_5fsystroot_5fdir',['FOLDER_SYSTROOT_DIR',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54af32b4c27ec428ad2bf69d8c8802de21c',1,'MUtils::OS']]], - ['folder_5fuser_5fprofile',['FOLDER_USER_PROFILE',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54a77c4c8768676d49c26bcec33dcf23b1e',1,'MUtils::OS']]] + ['folder_5fappdata_5floca',['FOLDER_APPDATA_LOCA',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54af000386a72d8444c5ad0783ba8077ce1',1,'MUtils::OS']]], + ['folder_5fappdata_5froam',['FOLDER_APPDATA_ROAM',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54a6f3aef740ec77b6ddea8e3eeea8d2951',1,'MUtils::OS']]], + ['folder_5fdesktop_5fpubl',['FOLDER_DESKTOP_PUBL',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54a8c639c3e3075fe0859034334ac9b24d8',1,'MUtils::OS']]], + ['folder_5fdesktop_5fuser',['FOLDER_DESKTOP_USER',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54a15eb1ce4cbc1e819ef61380d8567f8fc',1,'MUtils::OS']]], + ['folder_5fdocs_5fpubl',['FOLDER_DOCS_PUBL',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54ac60998b86c14fd99fb7606a7f5631039',1,'MUtils::OS']]], + ['folder_5fdocs_5fuser',['FOLDER_DOCS_USER',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54a24fe95c218f2f96f79ed4331816d1bf2',1,'MUtils::OS']]], + ['folder_5fmusic_5fpubl',['FOLDER_MUSIC_PUBL',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54a945615852ec433d54bd660e7d06e7eba',1,'MUtils::OS']]], + ['folder_5fmusic_5fuser',['FOLDER_MUSIC_USER',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54a5eb537ab772312644d490ee5597a57ae',1,'MUtils::OS']]], + ['folder_5fpictures_5fpubl',['FOLDER_PICTURES_PUBL',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54a9cb1691e4de71331189728945692e6e9',1,'MUtils::OS']]], + ['folder_5fpictures_5fuser',['FOLDER_PICTURES_USER',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54abf17b1a0f30e2ff38990973a778e6ee9',1,'MUtils::OS']]], + ['folder_5fprofile_5fpubl',['FOLDER_PROFILE_PUBL',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54ad9e442fb54bdee21838b485b51399ea2',1,'MUtils::OS']]], + ['folder_5fprofile_5fuser',['FOLDER_PROFILE_USER',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54a31103048fccf15ef2af81b75357ebb70',1,'MUtils::OS']]], + ['folder_5fprograms_5fdef',['FOLDER_PROGRAMS_DEF',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54a089096fbc0c16f0a08c85c9ad3ecd4d4',1,'MUtils::OS']]], + ['folder_5fprograms_5fx64',['FOLDER_PROGRAMS_X64',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54af76af3d9c84eff178c323768779d69b7',1,'MUtils::OS']]], + ['folder_5fprograms_5fx86',['FOLDER_PROGRAMS_X86',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54a9fc4296b5058087caf97d4547fe4063a',1,'MUtils::OS']]], + ['folder_5fsysroot',['FOLDER_SYSROOT',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54af8584f32060415349b71d2369a16515a',1,'MUtils::OS']]], + ['folder_5fsystem_5fdef',['FOLDER_SYSTEM_DEF',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54aafb108d0830bacd39c55ea054689857a',1,'MUtils::OS']]], + ['folder_5fsystem_5fx86',['FOLDER_SYSTEM_X86',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54af50a26cb638902ca94fd88c0a797abb9',1,'MUtils::OS']]], + ['folder_5fvideo_5fpubl',['FOLDER_VIDEO_PUBL',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54a33e99fdb7c830d5581ed15d92415c848',1,'MUtils::OS']]], + ['folder_5fvideo_5fuser',['FOLDER_VIDEO_USER',['../d2/df4/namespace_m_utils_1_1_o_s.html#a62a1b72ba9a7accee438d19212785e54a4a71f200b12a3a45f4bb092b262c3cc1',1,'MUtils::OS']]] ]; diff --git a/include/MUtils/Global.h b/include/MUtils/Global.h index 41e1180..ca7fe75 100644 --- a/include/MUtils/Global.h +++ b/include/MUtils/Global.h @@ -39,7 +39,7 @@ template class QHash; */ //Interface version -#define MUTILS_INTERFACE 2 +#define MUTILS_INTERFACE 3 //MUtils API #ifdef _MSC_VER diff --git a/include/MUtils/OSSupport.h b/include/MUtils/OSSupport.h index ca2cae9..2f2d7f2 100644 --- a/include/MUtils/OSSupport.h +++ b/include/MUtils/OSSupport.h @@ -119,10 +119,12 @@ namespace MUtils FOLDER_MUSIC_PUBL = 12, ///< The "all users" Music directory FOLDER_VIDEO_USER = 13, ///< The user's Video directory FOLDER_VIDEO_PUBL = 14, ///< The "all users" Video directory - FOLDER_PROGRAMFILES = 15, ///< Program files - FOLDER_SYSROOT = 16, ///< System "root" directory - FOLDER_SYSTEM_DEF = 17, ///< System directory - FOLDER_SYSTEM_X86 = 18, ///< System directory for x86 (32-Bit) + FOLDER_PROGRAMS_DEF = 15, ///< Program files + FOLDER_PROGRAMS_X86 = 16, ///< Program files + FOLDER_PROGRAMS_X64 = 17, ///< Program files + FOLDER_SYSROOT = 18, ///< System "root" directory + FOLDER_SYSTEM_DEF = 19, ///< System directory + FOLDER_SYSTEM_X86 = 20, ///< System directory for x86 (32-Bit) } known_folder_t; diff --git a/src/OSSupport_Win32.cpp b/src/OSSupport_Win32.cpp index d8e7563..a1fe52a 100644 --- a/src/OSSupport_Win32.cpp +++ b/src/OSSupport_Win32.cpp @@ -702,20 +702,22 @@ static const struct s_known_folders_lut[] = { { MUtils::OS::FOLDER_PROFILE_USER, 0x0028, { 0x5E6C858F, 0x0E22, 0x4760, { 0x9A, 0xFE, 0xEA, 0x33, 0x17, 0xB6, 0x71, 0x73 } } }, //CSIDL_PROFILE - { MUtils::OS::FOLDER_PROFILE_PUBL, 0x0000, { 0XDFDF76A2, 0XC82A, 0X4D63, { 0X90, 0X6A, 0X56, 0X44, 0XAC, 0X45, 0X73, 0X85 } } }, //FOLDERID_Public + { MUtils::OS::FOLDER_PROFILE_PUBL, 0x0000, { 0xDFDF76A2, 0xC82A, 0x4D63, { 0x90, 0x6A, 0x56, 0x44, 0xAC, 0x45, 0x73, 0x85 } } }, //FOLDERID_Public { MUtils::OS::FOLDER_APPDATA_ROAM, 0x001A, { 0x3EB685DB, 0x65F9, 0x4CF6, { 0xA0, 0x3A, 0xE3, 0xEF, 0x65, 0x72, 0x9F, 0x3D } } }, //CSIDL_APPDATA { MUtils::OS::FOLDER_APPDATA_LOCA, 0x001C, { 0xF1B32785, 0x6FBA, 0x4FCF, { 0x9D, 0x55, 0x7B, 0x8E, 0x7F, 0x15, 0x70, 0x91 } } }, //CSIDL_LOCAL_APPDATA { MUtils::OS::FOLDER_DOCS_USER, 0x0005, { 0xFDD39AD0, 0x238F, 0x46AF, { 0xAD, 0xB4, 0x6C, 0x85, 0x48, 0x03, 0x69, 0xC7 } } }, //CSIDL_MYDOCUMENTS { MUtils::OS::FOLDER_DOCS_PUBL, 0x002E, { 0xED4824AF, 0xDCE4, 0x45A8, { 0x81, 0xE2, 0xFC, 0x79, 0x65, 0x08, 0x36, 0x34 } } }, //CSIDL_COMMON_DOCUMENTS { MUtils::OS::FOLDER_DESKTOP_USER, 0x0010, { 0xB4BFCC3A, 0xDB2C, 0x424C, { 0xB0, 0x29, 0x7F, 0xE9, 0x9A, 0x87, 0xC6, 0x41 } } }, //CSIDL_DESKTOPDIRECTORY { MUtils::OS::FOLDER_DESKTOP_PUBL, 0x0019, { 0xC4AA340D, 0xF20F, 0x4863, { 0xAF, 0xEF, 0xF8, 0x7E, 0xF2, 0xE6, 0xBA, 0x25 } } }, //CSIDL_COMMON_DESKTOPDIRECTORY - { MUtils::OS::FOLDER_PICTURES_USER, 0x0027, { 0X33E28130, 0X4E1E, 0X4676, { 0X83, 0X5A, 0X98, 0X39, 0X5C, 0X3B, 0XC3, 0XBB } } }, //CSIDL_MYPICTURES - { MUtils::OS::FOLDER_PICTURES_PUBL, 0x0036, { 0XB6EBFB86, 0X6907, 0X413C, { 0X9A, 0XF7, 0X4F, 0XC2, 0XAB, 0XF0, 0X7C, 0XC5 } } }, //CSIDL_COMMON_PICTURES - { MUtils::OS::FOLDER_MUSIC_USER, 0x000D, { 0X4BD8D571, 0X6D19, 0X48D3, { 0XBE, 0X97, 0X42, 0X22, 0X20, 0X08, 0X0E, 0X43 } } }, //CSIDL_MYMUSIC - { MUtils::OS::FOLDER_MUSIC_PUBL, 0x0035, { 0X3214FAB5, 0X9757, 0X4298, { 0XBB, 0X61, 0X92, 0XA9, 0XDE, 0XAA, 0X44, 0XFF } } }, //CSIDL_COMMON_MUSIC - { MUtils::OS::FOLDER_VIDEO_USER, 0X000E, { 0X18989B1D, 0X99B5, 0X455B, { 0X84, 0X1C, 0XAB, 0X7C, 0X74, 0XE4, 0XDD, 0XFC } } }, //CSIDL_MYVIDEO - { MUtils::OS::FOLDER_VIDEO_PUBL, 0x0037, { 0X2400183A, 0X6185, 0X49FB, { 0XA2, 0XD8, 0X4A, 0X39, 0X2A, 0X60, 0X2B, 0XA3 } } }, //CSIDL_COMMON_VIDEO - { MUtils::OS::FOLDER_PROGRAMFILES, 0x0026, { 0x905E63B6, 0xC1BF, 0x494E, { 0xB2, 0x9C, 0x65, 0xB7, 0x32, 0xD3, 0xD2, 0x1A } } }, //CSIDL_PROGRAM_FILES + { MUtils::OS::FOLDER_PICTURES_USER, 0x0027, { 0x33E28130, 0x4E1E, 0x4676, { 0x83, 0x5A, 0x98, 0x39, 0x5C, 0x3B, 0xC3, 0xBB } } }, //CSIDL_MYPICTURES + { MUtils::OS::FOLDER_PICTURES_PUBL, 0x0036, { 0xB6EBFB86, 0x6907, 0x413C, { 0x9A, 0xF7, 0x4F, 0xC2, 0xAB, 0xF0, 0x7C, 0xC5 } } }, //CSIDL_COMMON_PICTURES + { MUtils::OS::FOLDER_MUSIC_USER, 0x000D, { 0x4BD8D571, 0x6D19, 0x48D3, { 0xBE, 0x97, 0x42, 0x22, 0x20, 0x08, 0x0E, 0x43 } } }, //CSIDL_MYMUSIC + { MUtils::OS::FOLDER_MUSIC_PUBL, 0x0035, { 0x3214FAB5, 0x9757, 0x4298, { 0xBB, 0x61, 0x92, 0xA9, 0xDE, 0xAA, 0x44, 0xFF } } }, //CSIDL_COMMON_MUSIC + { MUtils::OS::FOLDER_VIDEO_USER, 0x000E, { 0x18989B1D, 0x99B5, 0x455B, { 0x84, 0x1C, 0xAB, 0x7C, 0x74, 0xE4, 0xDD, 0xFC } } }, //CSIDL_MYVIDEO + { MUtils::OS::FOLDER_VIDEO_PUBL, 0x0037, { 0x2400183A, 0x6185, 0x49FB, { 0xA2, 0xD8, 0x4A, 0x39, 0x2A, 0x60, 0x2B, 0xA3 } } }, //CSIDL_COMMON_VIDEO + { MUtils::OS::FOLDER_PROGRAMS_DEF, 0x0026, { 0x905E63B6, 0xC1BF, 0x494E, { 0xB2, 0x9C, 0x65, 0xB7, 0x32, 0xD3, 0xD2, 0x1A } } }, //CSIDL_PROGRAM_FILES + { MUtils::OS::FOLDER_PROGRAMS_X86, 0x002A, { 0x7C5A40EF, 0xA0FB, 0x4BFC, { 0x87, 0x4A, 0xC0, 0xF2, 0xE0, 0xB9, 0xFA, 0x8E } } }, //CSIDL_PROGRAM_FILESX86 + { MUtils::OS::FOLDER_PROGRAMS_X64, 0x0000, { 0x6D809377, 0x6AF0, 0x444B, { 0x89, 0x57, 0xA3, 0x77, 0x3F, 0x02, 0x20, 0x0E } } }, //FOLDERID_ProgramFilesX64 (not supported for 32-bit applications) { MUtils::OS::FOLDER_SYSROOT, 0x0024, { 0xF38BF404, 0x1D43, 0x42F2, { 0x93, 0x05, 0x67, 0xDE, 0x0B, 0x28, 0xFC, 0x23 } } }, //CSIDL_WINDOWS { MUtils::OS::FOLDER_SYSTEM_DEF, 0x0025, { 0x1AC14E77, 0x02E7, 0x4E5D, { 0xB7, 0x44, 0x2E, 0xB1, 0xAE, 0x51, 0x98, 0xB7 } } }, //CSIDL_SYSTEM { MUtils::OS::FOLDER_SYSTEM_X86, 0x0029, { 0xD65231B0, 0xB2F1, 0x4857, { 0xA4, 0xCE, 0xA8, 0xE7, 0xC6, 0xEA, 0x7D, 0x27 } } }, //CSIDL_SYSTEMX86 @@ -724,7 +726,6 @@ s_known_folders_lut[] = static QString known_folder_verify(const wchar_t *const path) { - CSIDL_PROFILE; const QDir folderPath = QDir(QDir::fromNativeSeparators(MUTILS_QSTR(path))); if (folderPath.exists()) { @@ -768,7 +769,7 @@ static QString known_folder_fallback(const size_t folderId) { if (getFolderPath(NULL, s_known_folders_lut[folderId].csidl | s_shgfpFlags[j], NULL, s_shgfpTypes[i], pathBuffer.data()) == S_OK) { - //MessageBoxW(0, path, L"SHGetFolderPathW", MB_TOPMOST); + //MessageBoxW(0, pathBuffer.data(), L"SHGetFolderPathW", MB_TOPMOST); const QString folderPath = known_folder_verify(pathBuffer.data()); if (!folderPath.isEmpty()) { diff --git a/test/src/GlobalTest.cpp b/test/src/GlobalTest.cpp index a6160f3..1fbeb77 100644 --- a/test/src/GlobalTest.cpp +++ b/test/src/GlobalTest.cpp @@ -55,9 +55,17 @@ protected: #define TEST_RANDOM(X,Y) do \ { \ QSet test; \ - for (size_t i = 0; i < TEST_RANDOM_MAX; ++i) \ - { \ - test.insert(MUtils::next_rand_##Y()); \ + for (size_t retry = 0; retry < 8; ++retry) \ + { \ + test.clear(); \ + for (size_t i = 0; i < TEST_RANDOM_MAX; ++i) \ + { \ + test.insert(MUtils::next_rand_##Y()); \ + } \ + if(test.count() == TEST_RANDOM_MAX) \ + { \ + break; \ + } \ } \ ASSERT_EQ(test.count(), TEST_RANDOM_MAX); \ } \