From 674948955974c56ceeb7ba72c17496ae720c47e8 Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Mon, 19 Dec 2016 01:57:41 +0100 Subject: [PATCH] Some documentation updates. --- docs/annotated.html | 2 +- docs/classes.html | 2 +- docs/d0/d8a/class_m_utils_1_1_update_checker.html | 2 +- docs/d0/dd7/_version_8h_source.html | 2 +- ...nal_1_1_keccak_impl_1_1sponge_state_struct.html | 2 +- docs/d1/d01/class_m_utils_1_1_hash_1_1_blake2.html | 2 +- .../d08/class_m_utils_1_1_job_object-members.html | 2 +- docs/d1/d0a/_taskbar7_8h_source.html | 2 +- .../d0d/class_m_utils_1_1_update_checker_info.html | 2 +- docs/d1/d32/class_m_utils_1_1_version.html | 2 +- docs/d1/d37/_hash___blake2_8h_source.html | 2 +- docs/d1/d93/_i_p_c_channel_8h_source.html | 2 +- .../class_m_utils_1_1_hash_1_1_keccak-members.html | 2 +- ...1_c_p_u_fetaures_1_1__cpu__info__t-members.html | 2 +- docs/d2/d13/_startup_8h_source.html | 2 +- docs/d2/d52/class_m_utils_1_1_taskbar7.html | 2 +- .../class_m_utils_1_1_update_checker-members.html | 2 +- docs/d2/db5/_c_p_u_features_8h_source.html | 2 +- ...ss_m_utils_1_1_update_checker_info-members.html | 2 +- docs/d3/d13/class_m_utils_1_1_version-members.html | 2 +- ...keccak_impl_1_1sponge_state_struct-members.html | 2 +- docs/d3/d5c/_registry_8h_source.html | 2 +- docs/d3/dc1/_o_s_support_8h_source.html | 2 +- .../d3/dc6/class_m_utils_1_1_taskbar7-members.html | 2 +- docs/d3/dd5/_error_handler_8h_source.html | 2 +- docs/d4/d85/_job_object_8h_source.html | 2 +- docs/d5/d3b/_global_8h.html | 248 +++++++++++++++++++-- docs/d5/d3b/_global_8h_source.html | 9 +- docs/d5/db0/_sound_8h_source.html | 2 +- ..._s_1_1_version_1_1__os__version__t-members.html | 2 +- docs/d5/dfe/class_m_utils_1_1_i_p_c_channel.html | 2 +- docs/d6/d83/_update_checker_8h_source.html | 2 +- docs/d6/ddd/_terminal_8h_source.html | 2 +- docs/d7/d73/_translation_8h_source.html | 2 +- .../class_m_utils_1_1_i_p_c_channel-members.html | 2 +- ...lass_m_utils_1_1_registry_1_1_registry_key.html | 2 +- docs/da/d5d/_g_u_i_8h_source.html | 2 +- ...ls_1_1_o_s_1_1_version_1_1__os__version__t.html | 2 +- ...tils_1_1_registry_1_1_registry_key-members.html | 2 +- docs/dc/dd3/class_m_utils_1_1_job_object.html | 2 +- .../class_m_utils_1_1_hash_1_1_blake2-members.html | 2 +- docs/dd/d9f/class_m_utils_1_1_hash_1_1_keccak.html | 2 +- ...utils_1_1_c_p_u_fetaures_1_1__cpu__info__t.html | 2 +- docs/dd/dea/_hash___keccak_8h_source.html | 2 +- docs/df/d98/_exception_8h_source.html | 2 +- docs/dir_b076b53667bc06ebb413a190e197fc7b.html | 2 +- docs/dir_d44c64559bbebec7f509842c48db8b23.html | 2 +- docs/files.html | 2 +- docs/hierarchy.html | 2 +- docs/index.html | 2 +- docs/search/all_7.js | 1 + docs/search/all_9.js | 4 +- docs/search/all_b.js | 4 +- docs/search/functions_1.js | 1 + docs/search/functions_3.js | 3 +- docs/search/functions_4.html | 26 +++ docs/search/functions_4.js | 6 + docs/search/searchdata.js | 2 +- include/MUtils/Global.h | 72 +++++- 59 files changed, 398 insertions(+), 74 deletions(-) create mode 100644 docs/search/functions_4.html create mode 100644 docs/search/functions_4.js diff --git a/docs/annotated.html b/docs/annotated.html index b5cb1ec..0191c9d 100644 --- a/docs/annotated.html +++ b/docs/annotated.html @@ -90,7 +90,7 @@ $(function() { diff --git a/docs/classes.html b/docs/classes.html index 590950f..ea51ae1 100644 --- a/docs/classes.html +++ b/docs/classes.html @@ -90,7 +90,7 @@ $(function() { diff --git a/docs/d0/d8a/class_m_utils_1_1_update_checker.html b/docs/d0/d8a/class_m_utils_1_1_update_checker.html index 001ff79..7a5d16f 100644 --- a/docs/d0/d8a/class_m_utils_1_1_update_checker.html +++ b/docs/d0/d8a/class_m_utils_1_1_update_checker.html @@ -158,7 +158,7 @@ void testKnownHosts (v diff --git a/docs/d0/dd7/_version_8h_source.html b/docs/d0/dd7/_version_8h_source.html index 2d7bb06..be549e6 100644 --- a/docs/d0/dd7/_version_8h_source.html +++ b/docs/d0/dd7/_version_8h_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/d0/dd8/struct_m_utils_1_1_hash_1_1_internal_1_1_keccak_impl_1_1sponge_state_struct.html b/docs/d0/dd8/struct_m_utils_1_1_hash_1_1_internal_1_1_keccak_impl_1_1sponge_state_struct.html index 5aa184e..26e338c 100644 --- a/docs/d0/dd8/struct_m_utils_1_1_hash_1_1_internal_1_1_keccak_impl_1_1sponge_state_struct.html +++ b/docs/d0/dd8/struct_m_utils_1_1_hash_1_1_internal_1_1_keccak_impl_1_1sponge_state_struct.html @@ -104,7 +104,7 @@ unsigned int bitsAvailable diff --git a/docs/d1/d01/class_m_utils_1_1_hash_1_1_blake2.html b/docs/d1/d01/class_m_utils_1_1_hash_1_1_blake2.html index c268d03..b8fc95c 100644 --- a/docs/d1/d01/class_m_utils_1_1_hash_1_1_blake2.html +++ b/docs/d1/d01/class_m_utils_1_1_hash_1_1_blake2.html @@ -92,7 +92,7 @@ QByteArray finalize (c diff --git a/docs/d1/d08/class_m_utils_1_1_job_object-members.html b/docs/d1/d08/class_m_utils_1_1_job_object-members.html index 2d5725b..5faa66c 100644 --- a/docs/d1/d08/class_m_utils_1_1_job_object-members.html +++ b/docs/d1/d08/class_m_utils_1_1_job_object-members.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/d1/d0a/_taskbar7_8h_source.html b/docs/d1/d0a/_taskbar7_8h_source.html index 2165272..996eeb6 100644 --- a/docs/d1/d0a/_taskbar7_8h_source.html +++ b/docs/d1/d0a/_taskbar7_8h_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/d1/d0d/class_m_utils_1_1_update_checker_info.html b/docs/d1/d0d/class_m_utils_1_1_update_checker_info.html index be78ace..9dc5571 100644 --- a/docs/d1/d0d/class_m_utils_1_1_update_checker_info.html +++ b/docs/d1/d0d/class_m_utils_1_1_update_checker_info.html @@ -114,7 +114,7 @@ class UpdateChecker diff --git a/docs/d1/d32/class_m_utils_1_1_version.html b/docs/d1/d32/class_m_utils_1_1_version.html index 00fbf8a..59c176b 100644 --- a/docs/d1/d32/class_m_utils_1_1_version.html +++ b/docs/d1/d32/class_m_utils_1_1_version.html @@ -104,7 +104,7 @@ static const char *const c diff --git a/docs/d1/d37/_hash___blake2_8h_source.html b/docs/d1/d37/_hash___blake2_8h_source.html index 3f0698b..dc13245 100644 --- a/docs/d1/d37/_hash___blake2_8h_source.html +++ b/docs/d1/d37/_hash___blake2_8h_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/d1/d93/_i_p_c_channel_8h_source.html b/docs/d1/d93/_i_p_c_channel_8h_source.html index fc68b1e..4684263 100644 --- a/docs/d1/d93/_i_p_c_channel_8h_source.html +++ b/docs/d1/d93/_i_p_c_channel_8h_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/d1/d9c/class_m_utils_1_1_hash_1_1_keccak-members.html b/docs/d1/d9c/class_m_utils_1_1_hash_1_1_keccak-members.html index e9a9d70..d3cb152 100644 --- a/docs/d1/d9c/class_m_utils_1_1_hash_1_1_keccak-members.html +++ b/docs/d1/d9c/class_m_utils_1_1_hash_1_1_keccak-members.html @@ -88,7 +88,7 @@ $(function() { diff --git a/docs/d1/dd9/struct_m_utils_1_1_c_p_u_fetaures_1_1__cpu__info__t-members.html b/docs/d1/dd9/struct_m_utils_1_1_c_p_u_fetaures_1_1__cpu__info__t-members.html index d8f45ef..b8b7865 100644 --- a/docs/d1/dd9/struct_m_utils_1_1_c_p_u_fetaures_1_1__cpu__info__t-members.html +++ b/docs/d1/dd9/struct_m_utils_1_1_c_p_u_fetaures_1_1__cpu__info__t-members.html @@ -82,7 +82,7 @@ $(function() { diff --git a/docs/d2/d13/_startup_8h_source.html b/docs/d2/d13/_startup_8h_source.html index 7337dac..eb9802d 100644 --- a/docs/d2/d13/_startup_8h_source.html +++ b/docs/d2/d13/_startup_8h_source.html @@ -72,7 +72,7 @@ $(function() { diff --git a/docs/d2/d52/class_m_utils_1_1_taskbar7.html b/docs/d2/d52/class_m_utils_1_1_taskbar7.html index 5774247..d21570d 100644 --- a/docs/d2/d52/class_m_utils_1_1_taskbar7.html +++ b/docs/d2/d52/class_m_utils_1_1_taskbar7.html @@ -106,7 +106,7 @@ bool setOverlayIcon (c diff --git a/docs/d2/d7d/class_m_utils_1_1_update_checker-members.html b/docs/d2/d7d/class_m_utils_1_1_update_checker-members.html index 50a49cc..b3c0243 100644 --- a/docs/d2/d7d/class_m_utils_1_1_update_checker-members.html +++ b/docs/d2/d7d/class_m_utils_1_1_update_checker-members.html @@ -96,7 +96,7 @@ $(function() { diff --git a/docs/d2/db5/_c_p_u_features_8h_source.html b/docs/d2/db5/_c_p_u_features_8h_source.html index 400d9b0..ab5e4c8 100644 --- a/docs/d2/db5/_c_p_u_features_8h_source.html +++ b/docs/d2/db5/_c_p_u_features_8h_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/d2/ddd/class_m_utils_1_1_update_checker_info-members.html b/docs/d2/ddd/class_m_utils_1_1_update_checker_info-members.html index abfe064..b35a5a7 100644 --- a/docs/d2/ddd/class_m_utils_1_1_update_checker_info-members.html +++ b/docs/d2/ddd/class_m_utils_1_1_update_checker_info-members.html @@ -84,7 +84,7 @@ $(function() { diff --git a/docs/d3/d13/class_m_utils_1_1_version-members.html b/docs/d3/d13/class_m_utils_1_1_version-members.html index 09d61ff..2fd653c 100644 --- a/docs/d3/d13/class_m_utils_1_1_version-members.html +++ b/docs/d3/d13/class_m_utils_1_1_version-members.html @@ -81,7 +81,7 @@ $(function() { diff --git a/docs/d3/d35/struct_m_utils_1_1_hash_1_1_internal_1_1_keccak_impl_1_1sponge_state_struct-members.html b/docs/d3/d35/struct_m_utils_1_1_hash_1_1_internal_1_1_keccak_impl_1_1sponge_state_struct-members.html index 0d3f280..6c59cb4 100644 --- a/docs/d3/d35/struct_m_utils_1_1_hash_1_1_internal_1_1_keccak_impl_1_1sponge_state_struct-members.html +++ b/docs/d3/d35/struct_m_utils_1_1_hash_1_1_internal_1_1_keccak_impl_1_1sponge_state_struct-members.html @@ -81,7 +81,7 @@ $(function() { diff --git a/docs/d3/d5c/_registry_8h_source.html b/docs/d3/d5c/_registry_8h_source.html index 4949ea3..23d6d4f 100644 --- a/docs/d3/d5c/_registry_8h_source.html +++ b/docs/d3/d5c/_registry_8h_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/d3/dc1/_o_s_support_8h_source.html b/docs/d3/dc1/_o_s_support_8h_source.html index 87a6061..f7aebf7 100644 --- a/docs/d3/dc1/_o_s_support_8h_source.html +++ b/docs/d3/dc1/_o_s_support_8h_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/d3/dc6/class_m_utils_1_1_taskbar7-members.html b/docs/d3/dc6/class_m_utils_1_1_taskbar7-members.html index b7bf94b..0c9de67 100644 --- a/docs/d3/dc6/class_m_utils_1_1_taskbar7-members.html +++ b/docs/d3/dc6/class_m_utils_1_1_taskbar7-members.html @@ -84,7 +84,7 @@ $(function() { diff --git a/docs/d3/dd5/_error_handler_8h_source.html b/docs/d3/dd5/_error_handler_8h_source.html index f576c14..7d69977 100644 --- a/docs/d3/dd5/_error_handler_8h_source.html +++ b/docs/d3/dd5/_error_handler_8h_source.html @@ -72,7 +72,7 @@ $(function() { diff --git a/docs/d4/d85/_job_object_8h_source.html b/docs/d4/d85/_job_object_8h_source.html index 1d416fc..aa12a30 100644 --- a/docs/d4/d85/_job_object_8h_source.html +++ b/docs/d4/d85/_job_object_8h_source.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/d5/d3b/_global_8h.html b/docs/d5/d3b/_global_8h.html index d421f79..a00fe09 100644 --- a/docs/d5/d3b/_global_8h.html +++ b/docs/d5/d3b/_global_8h.html @@ -142,26 +142,26 @@ void MUtils::init_process< bool MUtils::parity (quint32 value)  Computes the parity of the given unsigned 32-Bit value. More...
  - -bool MUtils::remove_file (const QString &fileName) +bool MUtils::remove_file (const QString &fileName) + Deletes the specified file. More...
  - -bool MUtils::remove_directory (const QString &folderPath, const bool &recursive) +bool MUtils::remove_directory (const QString &folderPath, const bool &recursive) + Recursively deletes the specified directory. More...
  - -QString & MUtils::trim_right (QString &str) +QString & MUtils::trim_right (QString &str) + Remove trailing white-space characters. More...
  - -QString & MUtils::trim_left (QString &str) +QString & MUtils::trim_left (QString &str) + Remove leading white-space characters. More...
  - -QString MUtils::trim_right (const QString &str) +QString MUtils::trim_right (const QString &str) + Remove trailing white-space characters. More...
  - -QString MUtils::trim_left (const QString &str) +QString MUtils::trim_left (const QString &str) + Remove trailing white-space characters. More...
  - -void MUtils::natural_string_sort (QStringList &list, const bool bIgnoreCase) +void MUtils::natural_string_sort (QStringList &list, const bool bIgnoreCase) + Sort a list of strings using "natural ordering" algorithm. More...
  QString MUtils::clean_file_name (const QString &name) @@ -284,6 +284,43 @@ int MUtils::Internal::self + +

§ natural_string_sort()

+ +
+
+ + + + + + + + + + + + + + + + + + +
void MUtils::natural_string_sort (QStringList & list,
const bool bIgnoreCase 
)
+
+ +

Sort a list of strings using "natural ordering" algorithm.

+

This function implements a sort algorithm that orders alphanumeric strings in the way a human being would. See Natural Order String Comparison for details!

+
Parameters
+ + +
listA reference to the QStringList object to be sorted. The list will be sorted "in place".
+
+
+ +
+

§ next_rand_str()

@@ -383,6 +420,73 @@ int MUtils::Internal::self + +

§ remove_directory()

+ +
+
+ + + + + + + + + + + + + + + + + + +
bool MUtils::remove_directory (const QString & folderPath,
const bool & recursive 
)
+
+ +

Recursively deletes the specified directory.

+

The function deletes the specified directory. In recusive mode, the directory will be removed including all of its files and sub-directories. Files are deleted using the remove_file() function.

+
Parameters
+ + + +
folderPathThe path to the directory to be deleted. This should be a full path.
recursiveIf set to true the function removes all files and sub-directories in the specified directory; if set to false, the function will not try to delete any files or sub-directories, which means that it will fail on non-empty directories.
+
+
+
Returns
The function returns true, if the directory was deleted successfully or if the directory doesn't exist; it returns false, if the directory could not be deleted.
+ +
+
+ +

§ remove_file()

+ +
+
+ + + + + + + + +
bool MUtils::remove_file (const QString & fileName)
+
+ +

Deletes the specified file.

+

The function deletes the specified file, even if it has the "read only" flag set. If the file is currently locked (e.g. by another process), the function retries multiple times to delete the file before it fails.

+
Parameters
+ + +
fileNameThe path to the file to be deleted. This should be a full path.
+
+
+
Returns
The function returns true, if the file was deleted successfully or if the file doesn't exist; it returns false, if the file could not be deleted.
+ +
+

§ temp_folder()

@@ -400,15 +504,127 @@ int MUtils::Internal::self

Rerieves the full path of the application's Temp folder.

-

The application's Temp folder is a unique application-specific folder, intended to store any temporary files that the application may need. It will be created when this function is called for the first time (lazy initialization); subsequent calls are guaranteed to return the same path. Usually the application's Temp folder will be created as a sub-folder of the system's global Temp folder, as indicated by the TMP or TEMP environment variables. However, it may be created at a different place(e.g. in the users Profile directory), if those environment variables don't point to a usable directory. In any case, this function makes sure that the application's Temp folder exists for the whole lifetime of the application and that it is writable. When the application is about to terminate, the application's Temp folder and all files or sub-directories thereof will be removed automatically!

+

The application's Temp folder is a unique application-specific folder, intended to store any temporary files that the application may need. It will be created when this function is called for the first time (lazy initialization); subsequent calls are guaranteed to return the same path. Usually the application's Temp folder will be created as a sub-folder of the system's global Temp folder, as indicated by the TMP or TEMP environment variables. However, it may be created at a different place (e.g. in the users Profile directory), if those environment variables don't point to a usable directory. In any case, this function makes sure that the application's Temp folder exists for the whole lifetime of the application and that it is writable. When the application is about to terminate, the application's Temp folder and all files or sub-directories thereof will be removed automatically!

Returns
If the function succeeds, it returns a read-only reference to a QString holding the full path of the application's Temp folder; otherwise a read-only reference to a default-constructed QString is returned.
+ +

§ trim_left() [1/2]

+ +
+
+ + + + + + + + +
QString& MUtils::trim_left (QString & str)
+
+ +

Remove leading white-space characters.

+

The function removes all leading white-space characters from the specified string. Trailing white-space characters are not removed. White-space characters are defined by the \s character class.

+
Parameters
+ + +
strA reference to the QString object to be trimmed. This QString object will be modified directly.
+
+
+
Returns
A reference to the trimmed QString object. This is the same QString object that was specified in the str parameter.
+ +
+
+ +

§ trim_left() [2/2]

+ +
+
+ + + + + + + + +
QString MUtils::trim_left (const QString & str)
+
+ +

Remove trailing white-space characters.

+

The function removes all leading white-space characters from the specified string. Trailing white-space characters are not removed. White-space characters are defined by the \s character class.

+
Parameters
+ + +
strA read-only reference to the QString object to be trimmed. The original QString object is not modified.
+
+
+
Returns
A new QString object that equals the original QString object, except that it has all leading white-space characters removed.
+ +
+
+ +

§ trim_right() [1/2]

+ +
+
+ + + + + + + + +
QString& MUtils::trim_right (QString & str)
+
+ +

Remove trailing white-space characters.

+

The function removes all trailing white-space characters from the specified string. Leading white-space characters are not removed. White-space characters are defined by the \s character class.

+
Parameters
+ + +
strA reference to the QString object to be trimmed. This QString object will be modified directly.
+
+
+
Returns
A reference to the trimmed QString object. This is the same QString object that was specified in the str parameter.
+ +
+
+ +

§ trim_right() [2/2]

+ +
+
+ + + + + + + + +
QString MUtils::trim_right (const QString & str)
+
+ +

Remove trailing white-space characters.

+

The function removes all trailing white-space characters from the specified string. Leading white-space characters are not removed. White-space characters are defined by the \s character class.

+
Parameters
+ + +
strA read-only reference to the QString object to be trimmed. The original QString object is not modified.
+
+
+
Returns
A new QString object that equals the original QString object, except that it has all trailing white-space characters removed.
+ +
+
diff --git a/docs/d5/d3b/_global_8h_source.html b/docs/d5/d3b/_global_8h_source.html index 9fa4646..a6e5a30 100644 --- a/docs/d5/d3b/_global_8h_source.html +++ b/docs/d5/d3b/_global_8h_source.html @@ -67,18 +67,23 @@ $(function() {
Global.h
-Go to the documentation of this file.
1 // MuldeR's Utilities for Qt
3 // Copyright (C) 2004-2016 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 
35 
36 //MUtils API
37 #ifdef _MSC_VER
38 # ifdef MUTILS_DLL_EXPORT
39 # define MUTILS_API __declspec(dllexport)
40 # else
41 # ifndef MUTILS_STATIC_LIB
42 # define MUTILS_API __declspec(dllimport)
43 # else
44 # define MUTILS_API /*static lib*/
45 # endif
46 # endif
47 #else
48 # define MUTILS_API
49 #endif
50 
51 //Helper Macros
52 #define MUTILS_MAKE_STRING_HELPER(X) #X
53 #define MUTILS_MAKE_STRING(X) MUTILS_MAKE_STRING_HELPER(X)
54 #define MUTILS_COMPILER_WARNING(TXT) __pragma(message(__FILE__ "(" MUTILS_MAKE_STRING(__LINE__) ") : warning: " TXT))
55 
56 //Check Debug Flags
57 #if defined(_DEBUG) || defined(DEBUG) || (!defined(NDEBUG))
58 # define MUTILS_DEBUG (1)
59 # if defined(NDEBUG) || defined(QT_NO_DEBUG) || (!defined(QT_DEBUG))
60 # error Inconsistent DEBUG flags have been detected!
61 # endif
62 #else
63 # define MUTILS_DEBUG (0)
64 # if (!defined(NDEBUG)) || (!defined(QT_NO_DEBUG)) || defined(QT_DEBUG)
65 # error Inconsistent DEBUG flags have been detected!
66 # endif
67 #endif
68 
69 //Check CPU options
70 #if defined(_MSC_VER) && (!defined(__INTELLISENSE__)) && (!defined(_M_X64)) && defined(_M_IX86_FP)
71  #if (_M_IX86_FP != 0)
72  #error We should not enabled SSE or SSE2 in release builds!
73  #endif
74 #endif
75 
77 
114 namespace MUtils
115 {
123  MUTILS_API const QString& temp_folder(void);
124 
125  //Process Utils
126  MUTILS_API void init_process(QProcess &process, const QString &wokringDir, const bool bReplaceTempDir = true, const QStringList *const extraPaths = NULL);
127 
135  MUTILS_API quint32 next_rand_u32(void);
136 
144  MUTILS_API quint64 next_rand_u64(void);
145 
155  MUTILS_API QString next_rand_str(const bool &bLong = false);
156 
170  MUTILS_API QString make_temp_file(const QString &basePath, const QString &extension, const bool placeholder = false);
171 
187  MUTILS_API QString make_unique_file(const QString &basePath, const QString &baseName, const QString &extension, const bool fancy = false);
188 
196  MUTILS_API bool parity(quint32 value);
197 
198  //Remove File/Dir
199  MUTILS_API bool remove_file(const QString &fileName);
200  MUTILS_API bool remove_directory(const QString &folderPath, const bool &recursive);
201 
202  //String utils
203  MUTILS_API QString& trim_right(QString &str);
204  MUTILS_API QString& trim_left(QString &str);
205  MUTILS_API QString trim_right(const QString &str);
206  MUTILS_API QString trim_left(const QString &str);
207 
208  //String sorting
209  MUTILS_API void natural_string_sort(QStringList &list, const bool bIgnoreCase);
210 
211  //Clean file path
212  MUTILS_API QString clean_file_name(const QString &name);
213  MUTILS_API QString clean_file_path(const QString &path);
214 
215  //Regular expressions
216  MUTILS_API bool regexp_parse_uint32(const QRegExp &regexp, quint32 &value);
217  MUTILS_API bool regexp_parse_uint32(const QRegExp &regexp, quint32 *values, const size_t &count);
218 
219  //Internationalization
220  MUTILS_API QStringList available_codepages(const bool &noAliases = true);
221 
222  //Internal
223  namespace Internal
224  {
225  MUTILS_API int selfTest(const char *const buildKey, const bool debug);
226  static const int s_selfTest = selfTest(__DATE__ "@" __TIME__, MUTILS_DEBUG);
227  }
228 }
229 
231 
232 //Delete helper
233 #define MUTILS_DELETE(PTR) do { if((PTR)) { delete (PTR); (PTR) = NULL; } } while(0)
234 #define MUTILS_DELETE_ARRAY(PTR) do { if((PTR)) { delete [] (PTR); (PTR) = NULL; } } while(0)
235 
236 //Zero memory
237 #define MUTILS_ZERO_MEMORY(PTR) memset(&(PTR), 0, sizeof((PTR)))
238 
239 //String conversion macros
240 #define MUTILS_WCHR(STR) (reinterpret_cast<const wchar_t*>((STR).utf16()))
241 #define MUTILS_UTF8(STR) ((STR).toUtf8().constData())
242 #define MUTILS_QSTR(STR) (QString::fromUtf16(reinterpret_cast<const unsigned short*>((STR))))
243 
244 //Boolean helper
245 #define MUTILS_BOOL2STR(X) ((X) ? "1" : "0")
quint32 next_rand_u32(void)
Generates a random unsigned 32-Bit value.
+Go to the documentation of this file.
1 // MuldeR's Utilities for Qt
3 // Copyright (C) 2004-2016 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 
35 
36 //MUtils API
37 #ifdef _MSC_VER
38 # ifdef MUTILS_DLL_EXPORT
39 # define MUTILS_API __declspec(dllexport)
40 # else
41 # ifndef MUTILS_STATIC_LIB
42 # define MUTILS_API __declspec(dllimport)
43 # else
44 # define MUTILS_API /*static lib*/
45 # endif
46 # endif
47 #else
48 # define MUTILS_API
49 #endif
50 
51 //Helper Macros
52 #define MUTILS_MAKE_STRING_HELPER(X) #X
53 #define MUTILS_MAKE_STRING(X) MUTILS_MAKE_STRING_HELPER(X)
54 #define MUTILS_COMPILER_WARNING(TXT) __pragma(message(__FILE__ "(" MUTILS_MAKE_STRING(__LINE__) ") : warning: " TXT))
55 
56 //Check Debug Flags
57 #if defined(_DEBUG) || defined(DEBUG) || (!defined(NDEBUG))
58 # define MUTILS_DEBUG (1)
59 # if defined(NDEBUG) || defined(QT_NO_DEBUG) || (!defined(QT_DEBUG))
60 # error Inconsistent DEBUG flags have been detected!
61 # endif
62 #else
63 # define MUTILS_DEBUG (0)
64 # if (!defined(NDEBUG)) || (!defined(QT_NO_DEBUG)) || defined(QT_DEBUG)
65 # error Inconsistent DEBUG flags have been detected!
66 # endif
67 #endif
68 
69 //Check CPU options
70 #if defined(_MSC_VER) && (!defined(__INTELLISENSE__)) && (!defined(_M_X64)) && defined(_M_IX86_FP)
71  #if (_M_IX86_FP != 0)
72  #error We should not enabled SSE or SSE2 in release builds!
73  #endif
74 #endif
75 
77 
114 namespace MUtils
115 {
123  MUTILS_API const QString& temp_folder(void);
124 
125  //Process Utils
126  MUTILS_API void init_process(QProcess &process, const QString &wokringDir, const bool bReplaceTempDir = true, const QStringList *const extraPaths = NULL);
127 
135  MUTILS_API quint32 next_rand_u32(void);
136 
144  MUTILS_API quint64 next_rand_u64(void);
145 
155  MUTILS_API QString next_rand_str(const bool &bLong = false);
156 
170  MUTILS_API QString make_temp_file(const QString &basePath, const QString &extension, const bool placeholder = false);
171 
187  MUTILS_API QString make_unique_file(const QString &basePath, const QString &baseName, const QString &extension, const bool fancy = false);
188 
196  MUTILS_API bool parity(quint32 value);
197 
207  MUTILS_API bool remove_file(const QString &fileName);
208 
220  MUTILS_API bool remove_directory(const QString &folderPath, const bool &recursive);
221 
231  MUTILS_API QString& trim_right(QString &str);
232 
242  MUTILS_API QString& trim_left(QString &str);
243 
253  MUTILS_API QString trim_right(const QString &str);
254 
264  MUTILS_API QString trim_left(const QString &str);
265 
273  MUTILS_API void natural_string_sort(QStringList &list, const bool bIgnoreCase);
274 
275  //Clean file path
276  MUTILS_API QString clean_file_name(const QString &name);
277  MUTILS_API QString clean_file_path(const QString &path);
278 
279  //Regular expressions
280  MUTILS_API bool regexp_parse_uint32(const QRegExp &regexp, quint32 &value);
281  MUTILS_API bool regexp_parse_uint32(const QRegExp &regexp, quint32 *values, const size_t &count);
282 
283  //Internationalization
284  MUTILS_API QStringList available_codepages(const bool &noAliases = true);
285 
286  //Internal
287  namespace Internal
288  {
289  MUTILS_API int selfTest(const char *const buildKey, const bool debug);
290  static const int s_selfTest = selfTest(__DATE__ "@" __TIME__, MUTILS_DEBUG);
291  }
292 }
293 
295 
296 //Delete helper
297 #define MUTILS_DELETE(PTR) do { if((PTR)) { delete (PTR); (PTR) = NULL; } } while(0)
298 #define MUTILS_DELETE_ARRAY(PTR) do { if((PTR)) { delete [] (PTR); (PTR) = NULL; } } while(0)
299 
300 //Zero memory
301 #define MUTILS_ZERO_MEMORY(PTR) memset(&(PTR), 0, sizeof((PTR)))
302 
303 //String conversion macros
304 #define MUTILS_WCHR(STR) (reinterpret_cast<const wchar_t*>((STR).utf16()))
305 #define MUTILS_UTF8(STR) ((STR).toUtf8().constData())
306 #define MUTILS_QSTR(STR) (QString::fromUtf16(reinterpret_cast<const unsigned short*>((STR))))
307 
308 //Boolean helper
309 #define MUTILS_BOOL2STR(X) ((X) ? "1" : "0")
bool remove_file(const QString &fileName)
Deletes the specified file.
+
quint32 next_rand_u32(void)
Generates a random unsigned 32-Bit value.
bool parity(quint32 value)
Computes the parity of the given unsigned 32-Bit value.
QString make_unique_file(const QString &basePath, const QString &baseName, const QString &extension, const bool fancy=false)
Generates a unique file name.
const QString & temp_folder(void)
Rerieves the full path of the application&#39;s Temp folder.
Definition: CPUFeatures.h:30
QString next_rand_str(const bool &bLong=false)
Generates a random string.
QString make_temp_file(const QString &basePath, const QString &extension, const bool placeholder=false)
Generates a temporary file name.
+
bool remove_directory(const QString &folderPath, const bool &recursive)
Recursively deletes the specified directory.
+
QString & trim_right(QString &str)
Remove trailing white-space characters.
+
void natural_string_sort(QStringList &list, const bool bIgnoreCase)
Sort a list of strings using "natural ordering" algorithm.
+
QString & trim_left(QString &str)
Remove leading white-space characters.
quint64 next_rand_u64(void)
Generates a random unsigned 64-Bit value.
diff --git a/docs/d5/db0/_sound_8h_source.html b/docs/d5/db0/_sound_8h_source.html index 320cddc..9f09146 100644 --- a/docs/d5/db0/_sound_8h_source.html +++ b/docs/d5/db0/_sound_8h_source.html @@ -72,7 +72,7 @@ $(function() {
diff --git a/docs/d5/de1/struct_m_utils_1_1_o_s_1_1_version_1_1__os__version__t-members.html b/docs/d5/de1/struct_m_utils_1_1_o_s_1_1_version_1_1__os__version__t-members.html index f9744d7..8fe40d3 100644 --- a/docs/d5/de1/struct_m_utils_1_1_o_s_1_1_version_1_1__os__version__t-members.html +++ b/docs/d5/de1/struct_m_utils_1_1_o_s_1_1_version_1_1__os__version__t-members.html @@ -84,7 +84,7 @@ $(function() { diff --git a/docs/d5/dfe/class_m_utils_1_1_i_p_c_channel.html b/docs/d5/dfe/class_m_utils_1_1_i_p_c_channel.html index d5cbc43..3e42b6f 100644 --- a/docs/d5/dfe/class_m_utils_1_1_i_p_c_channel.html +++ b/docs/d5/dfe/class_m_utils_1_1_i_p_c_channel.html @@ -112,7 +112,7 @@ static const quint32 MAX_P diff --git a/docs/d6/d83/_update_checker_8h_source.html b/docs/d6/d83/_update_checker_8h_source.html index 6cfb7ac..36e70ff 100644 --- a/docs/d6/d83/_update_checker_8h_source.html +++ b/docs/d6/d83/_update_checker_8h_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/d6/ddd/_terminal_8h_source.html b/docs/d6/ddd/_terminal_8h_source.html index a55b37f..3cabde2 100644 --- a/docs/d6/ddd/_terminal_8h_source.html +++ b/docs/d6/ddd/_terminal_8h_source.html @@ -72,7 +72,7 @@ $(function() { diff --git a/docs/d7/d73/_translation_8h_source.html b/docs/d7/d73/_translation_8h_source.html index f32c471..ee273bb 100644 --- a/docs/d7/d73/_translation_8h_source.html +++ b/docs/d7/d73/_translation_8h_source.html @@ -72,7 +72,7 @@ $(function() { diff --git a/docs/d7/dee/class_m_utils_1_1_i_p_c_channel-members.html b/docs/d7/dee/class_m_utils_1_1_i_p_c_channel-members.html index 8411fa9..41fc356 100644 --- a/docs/d7/dee/class_m_utils_1_1_i_p_c_channel-members.html +++ b/docs/d7/dee/class_m_utils_1_1_i_p_c_channel-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/docs/da/d35/class_m_utils_1_1_registry_1_1_registry_key.html b/docs/da/d35/class_m_utils_1_1_registry_1_1_registry_key.html index c89107d..5b72fd3 100644 --- a/docs/da/d35/class_m_utils_1_1_registry_1_1_registry_key.html +++ b/docs/da/d35/class_m_utils_1_1_registry_1_1_registry_key.html @@ -104,7 +104,7 @@ bool enum_subkeys (QSt diff --git a/docs/da/d5d/_g_u_i_8h_source.html b/docs/da/d5d/_g_u_i_8h_source.html index af99005..d98de3c 100644 --- a/docs/da/d5d/_g_u_i_8h_source.html +++ b/docs/da/d5d/_g_u_i_8h_source.html @@ -72,7 +72,7 @@ $(function() { diff --git a/docs/dc/d55/struct_m_utils_1_1_o_s_1_1_version_1_1__os__version__t.html b/docs/dc/d55/struct_m_utils_1_1_o_s_1_1_version_1_1__os__version__t.html index e372e90..9c22a68 100644 --- a/docs/dc/d55/struct_m_utils_1_1_o_s_1_1_version_1_1__os__version__t.html +++ b/docs/dc/d55/struct_m_utils_1_1_o_s_1_1_version_1_1__os__version__t.html @@ -117,7 +117,7 @@ bool overrideFlag diff --git a/docs/dc/db3/class_m_utils_1_1_registry_1_1_registry_key-members.html b/docs/dc/db3/class_m_utils_1_1_registry_1_1_registry_key-members.html index 8e116d8..48b31b2 100644 --- a/docs/dc/db3/class_m_utils_1_1_registry_1_1_registry_key-members.html +++ b/docs/dc/db3/class_m_utils_1_1_registry_1_1_registry_key-members.html @@ -82,7 +82,7 @@ $(function() { diff --git a/docs/dc/dd3/class_m_utils_1_1_job_object.html b/docs/dc/dd3/class_m_utils_1_1_job_object.html index 426fb74..3b49be7 100644 --- a/docs/dc/dd3/class_m_utils_1_1_job_object.html +++ b/docs/dc/dd3/class_m_utils_1_1_job_object.html @@ -86,7 +86,7 @@ bool terminateJob (uns diff --git a/docs/dc/df9/class_m_utils_1_1_hash_1_1_blake2-members.html b/docs/dc/df9/class_m_utils_1_1_hash_1_1_blake2-members.html index cd0cbf5..f3e5ccb 100644 --- a/docs/dc/df9/class_m_utils_1_1_hash_1_1_blake2-members.html +++ b/docs/dc/df9/class_m_utils_1_1_hash_1_1_blake2-members.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/dd/d9f/class_m_utils_1_1_hash_1_1_keccak.html b/docs/dd/d9f/class_m_utils_1_1_hash_1_1_keccak.html index ae090b6..247a79b 100644 --- a/docs/dd/d9f/class_m_utils_1_1_hash_1_1_keccak.html +++ b/docs/dd/d9f/class_m_utils_1_1_hash_1_1_keccak.html @@ -122,7 +122,7 @@ QByteArray m_hashResult diff --git a/docs/dd/de2/struct_m_utils_1_1_c_p_u_fetaures_1_1__cpu__info__t.html b/docs/dd/de2/struct_m_utils_1_1_c_p_u_fetaures_1_1__cpu__info__t.html index 20573e1..2496937 100644 --- a/docs/dd/de2/struct_m_utils_1_1_c_p_u_fetaures_1_1__cpu__info__t.html +++ b/docs/dd/de2/struct_m_utils_1_1_c_p_u_fetaures_1_1__cpu__info__t.html @@ -107,7 +107,7 @@ char brand [0x40] diff --git a/docs/dd/dea/_hash___keccak_8h_source.html b/docs/dd/dea/_hash___keccak_8h_source.html index b10e3bf..59a52dd 100644 --- a/docs/dd/dea/_hash___keccak_8h_source.html +++ b/docs/dd/dea/_hash___keccak_8h_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/df/d98/_exception_8h_source.html b/docs/df/d98/_exception_8h_source.html index 71d8fb6..d7e6170 100644 --- a/docs/df/d98/_exception_8h_source.html +++ b/docs/df/d98/_exception_8h_source.html @@ -70,7 +70,7 @@ $(function() {
1 // MuldeR's Utilities for Qt
3 // Copyright (C) 2004-2016 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 #include <stdexcept>
25 
26 #define MUTILS_PRINT_ERROR(FORMAT, ...) do \
27 { \
28  fflush(stdout); \
29  fprintf(stderr, (FORMAT), __VA_ARGS__); \
30  fflush(stderr); \
31 } \
32 while(0)
33 
34 #define MUTILS_EXCEPTION_HANDLER(COMMAND) do \
35 { \
36  try \
37  { \
38  do { COMMAND; } while(0); \
39  } \
40  catch(const std::exception &error) \
41  { \
42  MUTILS_PRINT_ERROR("\nGURU MEDITATION !!!\n\nException error:\n%s\n", error.what()); \
43  MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!"); \
44  } \
45  catch(...) \
46  { \
47  MUTILS_PRINT_ERROR("\nGURU MEDITATION !!!\n\nUnknown exception error!\n"); \
48  MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!"); \
49  } \
50 } \
51 while(0)
52 
53 #define MUTILS_THROW(MESSAGE) do \
54 { \
55  throw std::runtime_error((MESSAGE)); \
56 } \
57 while(0)
58 
59 #define MUTILS_THROW_FMT(MESSAGE, ...) do \
60 { \
61  char _message[256]; \
62  _snprintf_s(_message, 256, _TRUNCATE, (MESSAGE), __VA_ARGS__); \
63  throw std::runtime_error(_message); \
64 } \
65 while(0)
diff --git a/docs/dir_b076b53667bc06ebb413a190e197fc7b.html b/docs/dir_b076b53667bc06ebb413a190e197fc7b.html index cee192c..fc08296 100644 --- a/docs/dir_b076b53667bc06ebb413a190e197fc7b.html +++ b/docs/dir_b076b53667bc06ebb413a190e197fc7b.html @@ -77,7 +77,7 @@ Files diff --git a/docs/dir_d44c64559bbebec7f509842c48db8b23.html b/docs/dir_d44c64559bbebec7f509842c48db8b23.html index 0f48ed4..58f9ac4 100644 --- a/docs/dir_d44c64559bbebec7f509842c48db8b23.html +++ b/docs/dir_d44c64559bbebec7f509842c48db8b23.html @@ -74,7 +74,7 @@ Directories diff --git a/docs/files.html b/docs/files.html index 49886b0..b5dc624 100644 --- a/docs/files.html +++ b/docs/files.html @@ -90,7 +90,7 @@ $(function() { diff --git a/docs/hierarchy.html b/docs/hierarchy.html index 4ac2ef5..f50fc6f 100644 --- a/docs/hierarchy.html +++ b/docs/hierarchy.html @@ -83,7 +83,7 @@ $(function() { diff --git a/docs/index.html b/docs/index.html index 0091191..1837ab0 100644 --- a/docs/index.html +++ b/docs/index.html @@ -73,7 +73,7 @@ $(function() {
MUtilities - MuldeR's Utilities for Qt
Copyright (C) 2004-2016 LoRd_MuldeR <MuldeR2@GMX.de>. Some rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
diff --git a/docs/search/all_7.js b/docs/search/all_7.js index 9802c72..de939ce 100644 --- a/docs/search/all_7.js +++ b/docs/search/all_7.js @@ -1,5 +1,6 @@ var searchData= [ + ['natural_5fstring_5fsort',['natural_string_sort',['../d5/d3b/_global_8h.html#a09e919d419ded903481cf7aba702dcba',1,'MUtils']]], ['next_5frand_5fstr',['next_rand_str',['../d5/d3b/_global_8h.html#a996b60884ddf7728178e94f34ca12570',1,'MUtils']]], ['next_5frand_5fu32',['next_rand_u32',['../d5/d3b/_global_8h.html#a4dc7dccb81653ae28e0d37a7c2f62112',1,'MUtils']]], ['next_5frand_5fu64',['next_rand_u64',['../d5/d3b/_global_8h.html#a15762bf5b0239e5f67a3815d63ed441a',1,'MUtils']]] diff --git a/docs/search/all_9.js b/docs/search/all_9.js index 7bb19da..8f1fc88 100644 --- a/docs/search/all_9.js +++ b/docs/search/all_9.js @@ -1,4 +1,6 @@ var searchData= [ - ['registrykey',['RegistryKey',['../da/d35/class_m_utils_1_1_registry_1_1_registry_key.html',1,'MUtils::Registry']]] + ['registrykey',['RegistryKey',['../da/d35/class_m_utils_1_1_registry_1_1_registry_key.html',1,'MUtils::Registry']]], + ['remove_5fdirectory',['remove_directory',['../d5/d3b/_global_8h.html#ac7d2c9bd5c49230b2fed72e3410c3f7d',1,'MUtils']]], + ['remove_5ffile',['remove_file',['../d5/d3b/_global_8h.html#a12259acdd6aff74ee83819d3aebd8ba9',1,'MUtils']]] ]; diff --git a/docs/search/all_b.js b/docs/search/all_b.js index 29027a0..aaed9d2 100644 --- a/docs/search/all_b.js +++ b/docs/search/all_b.js @@ -1,5 +1,7 @@ var searchData= [ ['taskbar7',['Taskbar7',['../d2/d52/class_m_utils_1_1_taskbar7.html',1,'MUtils']]], - ['temp_5ffolder',['temp_folder',['../d5/d3b/_global_8h.html#a9ddb9a2039585b1ef3429db16ea84292',1,'MUtils']]] + ['temp_5ffolder',['temp_folder',['../d5/d3b/_global_8h.html#a9ddb9a2039585b1ef3429db16ea84292',1,'MUtils']]], + ['trim_5fleft',['trim_left',['../d5/d3b/_global_8h.html#af089c8a40b6ec2e19db3fe612aa81c8c',1,'MUtils::trim_left(QString &str)'],['../d5/d3b/_global_8h.html#a8680aeaeb1118353bd099e26ba7d6123',1,'MUtils::trim_left(const QString &str)']]], + ['trim_5fright',['trim_right',['../d5/d3b/_global_8h.html#a9290a3fe637a05ad2a7515f36fad79bd',1,'MUtils::trim_right(QString &str)'],['../d5/d3b/_global_8h.html#a3eb47d6ca49b2700622e3fe99faf14d8',1,'MUtils::trim_right(const QString &str)']]] ]; diff --git a/docs/search/functions_1.js b/docs/search/functions_1.js index 9802c72..de939ce 100644 --- a/docs/search/functions_1.js +++ b/docs/search/functions_1.js @@ -1,5 +1,6 @@ var searchData= [ + ['natural_5fstring_5fsort',['natural_string_sort',['../d5/d3b/_global_8h.html#a09e919d419ded903481cf7aba702dcba',1,'MUtils']]], ['next_5frand_5fstr',['next_rand_str',['../d5/d3b/_global_8h.html#a996b60884ddf7728178e94f34ca12570',1,'MUtils']]], ['next_5frand_5fu32',['next_rand_u32',['../d5/d3b/_global_8h.html#a4dc7dccb81653ae28e0d37a7c2f62112',1,'MUtils']]], ['next_5frand_5fu64',['next_rand_u64',['../d5/d3b/_global_8h.html#a15762bf5b0239e5f67a3815d63ed441a',1,'MUtils']]] diff --git a/docs/search/functions_3.js b/docs/search/functions_3.js index 2eced32..a2b89ea 100644 --- a/docs/search/functions_3.js +++ b/docs/search/functions_3.js @@ -1,4 +1,5 @@ var searchData= [ - ['temp_5ffolder',['temp_folder',['../d5/d3b/_global_8h.html#a9ddb9a2039585b1ef3429db16ea84292',1,'MUtils']]] + ['remove_5fdirectory',['remove_directory',['../d5/d3b/_global_8h.html#ac7d2c9bd5c49230b2fed72e3410c3f7d',1,'MUtils']]], + ['remove_5ffile',['remove_file',['../d5/d3b/_global_8h.html#a12259acdd6aff74ee83819d3aebd8ba9',1,'MUtils']]] ]; diff --git a/docs/search/functions_4.html b/docs/search/functions_4.html new file mode 100644 index 0000000..9ae34ff --- /dev/null +++ b/docs/search/functions_4.html @@ -0,0 +1,26 @@ + + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/docs/search/functions_4.js b/docs/search/functions_4.js new file mode 100644 index 0000000..f777269 --- /dev/null +++ b/docs/search/functions_4.js @@ -0,0 +1,6 @@ +var searchData= +[ + ['temp_5ffolder',['temp_folder',['../d5/d3b/_global_8h.html#a9ddb9a2039585b1ef3429db16ea84292',1,'MUtils']]], + ['trim_5fleft',['trim_left',['../d5/d3b/_global_8h.html#af089c8a40b6ec2e19db3fe612aa81c8c',1,'MUtils::trim_left(QString &str)'],['../d5/d3b/_global_8h.html#a8680aeaeb1118353bd099e26ba7d6123',1,'MUtils::trim_left(const QString &str)']]], + ['trim_5fright',['trim_right',['../d5/d3b/_global_8h.html#a9290a3fe637a05ad2a7515f36fad79bd',1,'MUtils::trim_right(QString &str)'],['../d5/d3b/_global_8h.html#a3eb47d6ca49b2700622e3fe99faf14d8',1,'MUtils::trim_right(const QString &str)']]] +]; diff --git a/docs/search/searchdata.js b/docs/search/searchdata.js index 42f2299..521e94e 100644 --- a/docs/search/searchdata.js +++ b/docs/search/searchdata.js @@ -3,7 +3,7 @@ var indexSectionsWithContent = 0: "_bgijkmnprstuv", 1: "_bijkrstuv", 2: "g", - 3: "mnpt", + 3: "mnprt", 4: "m" }; diff --git a/include/MUtils/Global.h b/include/MUtils/Global.h index 9ba41fe..cd20c11 100644 --- a/include/MUtils/Global.h +++ b/include/MUtils/Global.h @@ -116,7 +116,7 @@ namespace MUtils /** * \brief Rerieves the full path of the application's *Temp* folder. * - * The application's *Temp* folder is a unique application-specific folder, intended to store any temporary files that the application may need. It will be created when this function is called for the first time (lazy initialization); subsequent calls are guaranteed to return the same path. Usually the application's *Temp* folder will be created as a sub-folder of the system's global *Temp* folder, as indicated by the `TMP` or `TEMP` environment variables. However, it may be created at a different place(e.g. in the users *Profile* directory), if those environment variables don't point to a usable directory. In any case, this function makes sure that the application's *Temp* folder exists for the whole lifetime of the application and that it is writable. When the application is about to terminate, the application's *Temp* folder and all files or sub-directories thereof will be *removed* automatically! + * The application's *Temp* folder is a unique application-specific folder, intended to store any temporary files that the application may need. It will be created when this function is called for the first time (lazy initialization); subsequent calls are guaranteed to return the same path. Usually the application's *Temp* folder will be created as a sub-folder of the system's global *Temp* folder, as indicated by the `TMP` or `TEMP` environment variables. However, it may be created at a different place (e.g. in the users *Profile* directory), if those environment variables don't point to a usable directory. In any case, this function makes sure that the application's *Temp* folder exists for the whole lifetime of the application and that it is writable. When the application is about to terminate, the application's *Temp* folder and all files or sub-directories thereof will be *removed* automatically! * * \return If the function succeeds, it returns a read-only reference to a QString holding the full path of the application's *Temp* folder; otherwise a read-only reference to a default-constructed QString is returned. */ @@ -195,17 +195,81 @@ namespace MUtils */ MUTILS_API bool parity(quint32 value); - //Remove File/Dir + /** + * \brief Deletes the specified file + * + * The function deletes the specified file, even if it has the "read only" flag set. If the file is currently locked (e.g. by another process), the function retries multiple times to delete the file before it fails. + * + * \param fileName The path to the file to be deleted. This should be a full path. + * + * \return The function returns `true`, if the file was deleted successfully or if the file doesn't exist; it returns `false`, if the file could *not* be deleted. + */ MUTILS_API bool remove_file(const QString &fileName); + + /** + * \brief Recursively deletes the specified directory + * + * The function deletes the specified directory. In *recusive* mode, the directory will be removed including all of its files and sub-directories. Files are deleted using the `remove_file()` function. + * + * \param folderPath The path to the directory to be deleted. This should be a full path. + * + * \param recursive If set to `true` the function removes all files and sub-directories in the specified directory; if set to `false`, the function will *not* try to delete any files or sub-directories, which means that it will fail on non-empty directories. + * + * \return The function returns `true`, if the directory was deleted successfully or if the directory doesn't exist; it returns `false`, if the directory could *not* be deleted. + */ MUTILS_API bool remove_directory(const QString &folderPath, const bool &recursive); - //String utils + /** + * \brief Remove *trailing* white-space characters + * + * The function removes all *trailing* white-space characters from the specified string. Leading white-space characters are *not* removed. White-space characters are defined by the `\s` character class. + * + * \param str A reference to the QString object to be trimmed. This QString object will be modified directly. + * + * \return A reference to the trimmed QString object. This is the same QString object that was specified in the `str` parameter. + */ MUTILS_API QString& trim_right(QString &str); + + /** + * \brief Remove *leading* white-space characters + * + * The function removes all *leading* white-space characters from the specified string. Trailing white-space characters are *not* removed. White-space characters are defined by the `\s` character class. + * + * \param str A reference to the QString object to be trimmed. This QString object will be modified directly. + * + * \return A reference to the trimmed QString object. This is the same QString object that was specified in the `str` parameter. + */ MUTILS_API QString& trim_left(QString &str); + + /** + * \brief Remove *trailing* white-space characters + * + * The function removes all *trailing* white-space characters from the specified string. Leading white-space characters are *not* removed. White-space characters are defined by the `\s` character class. + * + * \param str A read-only reference to the QString object to be trimmed. The original QString object is *not* modified. + * + * \return A new QString object that equals the original QString object, except that it has all *trailing* white-space characters removed. + */ MUTILS_API QString trim_right(const QString &str); + + /** + * \brief Remove *trailing* white-space characters + * + * The function removes all *leading* white-space characters from the specified string. Trailing white-space characters are *not* removed. White-space characters are defined by the `\s` character class. + * + * \param str A read-only reference to the QString object to be trimmed. The original QString object is *not* modified. + * + * \return A new QString object that equals the original QString object, except that it has all *leading* white-space characters removed. + */ MUTILS_API QString trim_left(const QString &str); - //String sorting + /** + * \brief Sort a list of strings using "natural ordering" algorithm + * + * This function implements a sort algorithm that orders alphanumeric strings in the way a human being would. See [*Natural Order String Comparison*](http://sourcefrog.net/projects/natsort/) for details! + * + * \param list A reference to the QStringList object to be sorted. The list will be sorted "in place". + */ MUTILS_API void natural_string_sort(QStringList &list, const bool bIgnoreCase); //Clean file path -- 2.11.0