diff --git a/docs/annotated.html b/docs/annotated.html index 4c6d3fb..f6d0a37 100644 --- a/docs/annotated.html +++ b/docs/annotated.html @@ -65,7 +65,7 @@ $(function() {
Here are the classes, structs, unions and interfaces with brief descriptions:
[detail level 12345]
- + diff --git a/docs/classes.html b/docs/classes.html index 19e6e16..0501786 100644 --- a/docs/classes.html +++ b/docs/classes.html @@ -71,19 +71,19 @@ $(function() { - + + - + + - +
 NMUtils
 NMUtils
 NCPUFetaures
 C_cpu_info_t
 NHash
  u  
_cpu_info_t (MUtils::CPUFetaures)   IPCChannel (MUtils)   RegistryKey (MUtils::Registry)   UpdateChecker (MUtils)   
_cpu_info_t (MUtils::CPUFetaures)   IPCChannel (MUtils)   RegistryKey (MUtils::Registry)   UpdateChecker (MUtils)   
_os_version_t (MUtils::OS::Version)   
  j  
  s  
-
UpdateCheckerInfo (MUtils)   
UpdateCheckerInfo (MUtils)   
  b  
  v  
JobObject (MUtils)   spongeStateStruct (MUtils::Hash::Internal::KeccakImpl)   
JobObject (MUtils)   spongeStateStruct (MUtils::Hash::Internal::KeccakImpl)   
Blake2 (MUtils::Hash)   
  k  
  t  
-
Version (MUtils)   
Version (MUtils)   
Keccak (MUtils::Hash)   Taskbar7 (MUtils)   
Keccak (MUtils::Hash)   Taskbar7 (MUtils)   
_ | b | i | j | k | r | s | t | u | v
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 71f38eb..c2c9734 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 @@ -59,7 +59,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 2cc3e56..ff07b6e 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 @@ -59,7 +59,7 @@ $(function() {
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 46dc3e4..17c030c 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 @@ -59,7 +59,7 @@ $(function() {
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 2adf871..dcd35c3 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 @@ -59,7 +59,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 67915cd..d01f237 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 @@ -59,7 +59,7 @@ $(function() {
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 7d7e471..445138a 100644 --- a/docs/d1/d32/class_m_utils_1_1_version.html +++ b/docs/d1/d32/class_m_utils_1_1_version.html @@ -59,7 +59,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 54099ef..a0914ea 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 @@ -59,7 +59,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 8628013..b8de8d8 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 @@ -59,7 +59,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 e942f77..af8d6d4 100644 --- a/docs/d2/d52/class_m_utils_1_1_taskbar7.html +++ b/docs/d2/d52/class_m_utils_1_1_taskbar7.html @@ -59,7 +59,7 @@ $(function() {
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 cf4a0c6..b9bf2fa 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 @@ -59,7 +59,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 2528491..6d0d488 100644 --- a/docs/d2/db5/_c_p_u_features_8h_source.html +++ b/docs/d2/db5/_c_p_u_features_8h_source.html @@ -67,7 +67,7 @@ $(function() {
CPUFeatures.h
-
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 //MUtils
25 #include <MUtils/Global.h>
26 
27 //Qt
28 #include <QStringList>
29 
30 namespace MUtils
31 {
32  namespace CPUFetaures
33  {
34  //CPU flags
35  static const quint32 FLAG_MMX = 0x01;
36  static const quint32 FLAG_SSE = 0x02;
37  static const quint32 FLAG_SSE2 = 0x04;
38  static const quint32 FLAG_SSE3 = 0x08;
39  static const quint32 FLAG_SSSE3 = 0x10;
40  static const quint32 FLAG_SSE4 = 0x20;
41  static const quint32 FLAG_SSE42 = 0x40;
42  static const quint32 FLAG_AVX = 0x80;
43 
44  //CPU features
45  typedef struct _cpu_info_t
46  {
47  quint32 family;
48  quint32 model;
49  quint32 stepping;
50  quint32 count;
51  quint32 features;
52  bool x64;
53  bool intel;
54  char vendor[0x40];
55  char brand[0x40];
56  }
57  cpu_info_t;
58 
59  MUTILS_API cpu_info_t detect(void);
60  }
61 }
This file contains miscellaneous functions that are generally useful for Qt-based applications...
+
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 //MUtils
25 #include <MUtils/Global.h>
26 
27 //Qt
28 #include <QStringList>
29 
30 namespace MUtils
31 {
32  namespace CPUFetaures
33  {
34  //CPU flags
35  static const quint32 FLAG_MMX = 0x01;
36  static const quint32 FLAG_SSE = 0x02;
37  static const quint32 FLAG_SSE2 = 0x04;
38  static const quint32 FLAG_SSE3 = 0x08;
39  static const quint32 FLAG_SSSE3 = 0x10;
40  static const quint32 FLAG_SSE4 = 0x20;
41  static const quint32 FLAG_SSE42 = 0x40;
42  static const quint32 FLAG_AVX = 0x80;
43 
44  //CPU features
45  typedef struct _cpu_info_t
46  {
47  quint32 family;
48  quint32 model;
49  quint32 stepping;
50  quint32 count;
51  quint32 features;
52  bool x64;
53  bool intel;
54  char vendor[0x40];
55  char brand[0x40];
56  }
57  cpu_info_t;
58 
59  MUTILS_API cpu_info_t detect(void);
60  }
61 }
This file contains miscellaneous functions that are generally useful for Qt-based applications...
Definition: CPUFeatures.h:45
Definition: CPUFeatures.h:30
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 a249db4..91051e6 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 @@ -59,7 +59,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 4db949b..2b6b66c 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 @@ -59,7 +59,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 c785d97..15e97e3 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 @@ -59,7 +59,7 @@ $(function() {
diff --git a/docs/d3/da6/namespace_m_utils.html b/docs/d3/da6/namespace_m_utils.html new file mode 100644 index 0000000..0d71943 --- /dev/null +++ b/docs/d3/da6/namespace_m_utils.html @@ -0,0 +1,830 @@ + + + + + + + +MuldeR's Utilities for Qt: MUtils Namespace Reference + + + + + + + + + +
+
+ + + + + + +
+
MuldeR's Utilities for Qt +
+
MUtilities
+
+
+ + + + + + + + +
+
+ + +
+ +
+ +
+
+ +
+
MUtils Namespace Reference
+
+
+ + + + + + + + + + + + + + +

+Classes

class  IPCChannel
 
class  JobObject
 
class  Taskbar7
 
class  UpdateChecker
 
class  UpdateCheckerInfo
 
class  Version
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Functions

MUTILS_API const QString & temp_folder (void)
 Rerieves the full path of the application's Temp folder. More...
 
MUTILS_API void init_process (QProcess &process, const QString &wokringDir, const bool bReplaceTempDir=true, const QStringList *const extraPaths=NULL)
 Initialize a given QProcess object. More...
 
MUTILS_API quint32 next_rand_u32 (void)
 Generates a random unsigned 32-Bit value. More...
 
MUTILS_API quint64 next_rand_u64 (void)
 Generates a random unsigned 64-Bit value. More...
 
MUTILS_API QString next_rand_str (const bool &bLong=false)
 Generates a random string. More...
 
MUTILS_API QString make_temp_file (const QString &basePath, const QString &extension, const bool placeholder=false)
 Generates a temporary file name. More...
 
MUTILS_API QString make_unique_file (const QString &basePath, const QString &baseName, const QString &extension, const bool fancy=false)
 Generates a unique file name. More...
 
MUTILS_API bool parity (quint32 value)
 Computes the parity of the given unsigned 32-Bit value. More...
 
MUTILS_API bool remove_file (const QString &fileName)
 Deletes the specified file. More...
 
MUTILS_API bool remove_directory (const QString &folderPath, const bool &recursive)
 Recursively deletes the specified directory. More...
 
MUTILS_API QString & trim_right (QString &str)
 Remove trailing white-space characters. More...
 
MUTILS_API QString & trim_left (QString &str)
 Remove leading white-space characters. More...
 
MUTILS_API QString trim_right (const QString &str)
 Remove trailing white-space characters. More...
 
MUTILS_API QString trim_left (const QString &str)
 Remove trailing white-space characters. More...
 
MUTILS_API void natural_string_sort (QStringList &list, const bool bIgnoreCase)
 Sort a list of strings using "natural ordering" algorithm. More...
 
MUTILS_API QString clean_file_name (const QString &name)
 Clean up a file name string. More...
 
MUTILS_API QString clean_file_path (const QString &path)
 Clean up a file path string. More...
 
MUTILS_API bool regexp_parse_uint32 (const QRegExp &regexp, quint32 &value)
 Parse regular expression results. More...
 
MUTILS_API bool regexp_parse_uint32 (const QRegExp &regexp, quint32 *values, const size_t &count)
 Parse regular expression results. More...
 
MUTILS_API QStringList available_codepages (const bool &noAliases=true)
 Retrieve a list of all available codepages. More...
 
+ + + + + + + +

+Variables

+class MUTILS_API IPCChannel_Private
 
+class MUTILS_API JobObject_Private
 
+class MUTILS_API Taskbar7_Private
 
+

Detailed Description

+

INTERNAL

+

Function Documentation

+ +

§ available_codepages()

+ +
+
+ + + + + + + + +
MUTILS_API QStringList MUtils::available_codepages (const bool & noAliases = true)
+
+ +

Retrieve a list of all available codepages.

+

The function generates a list of all codepages that are available on the system. Each codepage name returned by this function may be passed to the QTextCodec::codecForName() function in order to obtain a corresponding QTextCodec object.

+
Parameters
+ + +
noAliasesIf set to true, only distinct codepages are returned, i.e. any codepage aliases are discarded from the list; if set to false, the returned list may (and usually will) also contain codepage aliases.
+
+
+
Returns
If the function succeeds, it returns a QStringList holding the names of all codepages available on the system; otherwise it returns a default-constructed QStringList.
+ +
+
+ +

§ clean_file_name()

+ +
+
+ + + + + + + + +
MUTILS_API QString MUtils::clean_file_name (const QString & name)
+
+ +

Clean up a file name string.

+

This function ensures that the given string is a valid file (or directory) name. It does so by replacing any illegal characters, i.e. any characters not allowed in file names (which explicitly includes directory separators). Furthermore, the function will trim/remove specific characters that are not allowed directly at the beginning or end of a file name. Finally, the function takes care or special "reserved" file names that are forbidden by the file system. You can use this function to convert user inputs into a valid file name.

+
Parameters
+ + +
listA read-only reference to the QString holding the original, potentially invalid file name.
+
+
+
Returns
The function returns a QString holding a valid file name. If, however, the input string was empty or contained only white-space characters, the returned sting can be empty.
+ +
+
+ +

§ clean_file_path()

+ +
+
+ + + + + + + + +
MUTILS_API QString MUtils::clean_file_path (const QString & path)
+
+ +

Clean up a file path string.

+

This function ensures that the given string is a valid file (or directory) path. It does so by replacing any illegal characters, i.e. any characters not allowed in file paths. Directory separators are preserved, but they will be "canonicalized". Furthermore, in each path component, the function will trim/remove specific characters that are not allowed directly at the beginning or end of a path component. Finally, the function takes care or special "reserved" file names that are forbidden by the file system. You can use this function to convert user inputs into a valid file path.

+
Parameters
+ + +
listA read-only reference to the QString holding the original, potentially invalid file path.
+
+
+
Returns
The function returns a QString holding a valid file path. If, however, the input string was empty or contained only white-space characters, the returned sting can be empty.
+ +
+
+ +

§ init_process()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MUTILS_API void MUtils::init_process (QProcess & process,
const QString & wokringDir,
const bool bReplaceTempDir = true,
const QStringList *const extraPaths = NULL 
)
+
+ +

Initialize a given QProcess object.

+

This function prepares a given QProcess object for sub-process creation. It does so by setting up combined stdout and stderr redirection for the sub-process, cleaning up the sub-process' environment variables, as well as setting up the sub-process' working directory. Optionally, the Temp directory for the sub-process can be set to the application-specific Temp directory, which is achieved by overwriting the corresponding environment variables (e.g. TMP and TEMP). Furthermore, additional paths can be added to the PATH environment variable of the sub-process.

+
Parameters
+ + + + + +
processA reference to the QProcess object to be initialized. The QProcess object must be initialized before calling the QProcess::start() method.
processA read-only reference to a QString holding the path of the working directory for the sub-process.
bReplaceTempDirIf set to true, the Temp directory for the sub-process is set to the application-specific Temp directory; if set to false, the default Temp directory is retained.
extraPathsA read-only pointer to a QStringList object containing additional paths that will be added (prepended) to the sub-process' PATH environment variable. This parameter can be NULL, in which case no additional paths are added.
+
+
+ +
+
+ +

§ make_temp_file()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
MUTILS_API QString MUtils::make_temp_file (const QString & basePath,
const QString & extension,
const bool placeholder = false 
)
+
+ +

Generates a temporary file name.

+

The function generates a file name that contains a random component and that is guaranteed to not exist yet. The generated file name follows a "<basedir>/<random>.<ext>" pattern. This is useful (not only) for creating temporary files.

+
Parameters
+ + + + +
basePathSpecifies the "base" directory where the temporary file is supposed to be created. This must be a valid existing directory.
extensionSpecifies the desired file extensions of the temporary file. Do not include a leading dot (.) character.
placeholderIf set to true, the function creates an empty "placeholder" file under the returned file name; if set to false, it does not.
+
+
+
Returns
If the function succeeds, it returns a QString holding the full path of the temporary file; otherwise it returns a default-constructed QString.
+ +
+
+ +

§ make_unique_file()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MUTILS_API QString MUtils::make_unique_file (const QString & basePath,
const QString & baseName,
const QString & extension,
const bool fancy = false 
)
+
+ +

Generates a unique file name.

+

The function generates a unique file name in the specified directory. The function guarantees that the returned file name does not exist yet. If necessary, a counter will be included in the file name in order to ensure its uniqueness.

+
Parameters
+ + + + + +
basePathSpecifies the "base" directory where the unique file is supposed to be created. This must be a valid existing directory.
baseNameSpecifies the desired "base" file name of the unique file. Do not include a file extension.
extensionSpecifies the desired file extensions of the unique file. Do not include a leading dot (.) character.
fancyIf set to true, the unique file name is generated according to the "<basedir>/<basename> (N).<ext>" pattern; if set to false, it is generated according to the "<basedir>/<basename>.XXXX.<ext>" pattern. Also, if set to true, a counter is only included in the file name, if the file name without counter already exists; if set to false, a counter is always included. Finally, if set to true, the counter starts at 2 and is printed in decimal format; if set to false, the counter starts at 0 and is printed in zero-padded hexadecimal format.
+
+
+
Returns
If the function succeeds, it returns a QString holding the full path of the unique file; otherwise it returns a default-constructed QString.
+ +
+
+ +

§ natural_string_sort()

+ +
+
+ + + + + + + + + + + + + + + + + + +
MUTILS_API 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".
bIgnoreCaseIf set to true, the list will be sorted disregarding the character case, i.e. upper-case and lower-case characters (of the same letter) are treated the same; if set to false, the character case is taken into account.
+
+
+ +
+
+ +

§ next_rand_str()

+ +
+
+ + + + + + + + +
MUTILS_API QString MUtils::next_rand_str (const bool & bLong = false)
+
+ +

Generates a random string.

+

The random string is generated using the same PRNG as the next_rand_u64() function. The random bytes are converted to a hexadecimal string and, if necessary, zero-padded to a toal length of 16 or 32 characters. There is no 0x-prefix included in the result.

+
Parameters
+ + +
bLongIf set to true, a "long" random string (32 characters) will be generated; if set to false, a "short" random string (16 characters) is generated.
+
+
+
Returns
The function returns a QString holding a random hexadecimal string
+ +
+
+ +

§ next_rand_u32()

+ +
+
+ + + + + + + + +
MUTILS_API quint32 MUtils::next_rand_u32 (void )
+
+ +

Generates a random unsigned 32-Bit value.

+

The random value is created using a "strong" PRNG of the underlying system, if possible. Otherwise a fallback PRNG is used. It is not required or useful to call srand() or qsrand() prior to using this function. If necessary, the seeding of the PRNG happen automatically on the first call.

+
Returns
The function returns a random unsigned 32-Bit value.
+ +
+
+ +

§ next_rand_u64()

+ +
+
+ + + + + + + + +
MUTILS_API quint64 MUtils::next_rand_u64 (void )
+
+ +

Generates a random unsigned 64-Bit value.

+

The random value is created using a "strong" PRNG of the underlying system, if possible. Otherwise a fallback PRNG is used. It is not required or useful to call srand() or qsrand() prior to using this function. If necessary, the seeding of the PRNG happen automatically on the first call.

+
Returns
The function returns a random unsigned 64-Bit value.
+ +
+
+ +

§ parity()

+ +
+
+ + + + + + + + +
MUTILS_API bool MUtils::parity (quint32 value)
+
+ +

Computes the parity of the given unsigned 32-Bit value.

+
Parameters
+ + +
valueThe 32-Bit unsigned value from which the parity is to be computed.
+
+
+
Returns
The function returns true, if the number of 1 bits in the given value is odd; it returns false, if the number of 1 bits in the given value is even.
+ +
+
+ +

§ regexp_parse_uint32() [1/2]

+ +
+
+ + + + + + + + + + + + + + + + + + +
MUTILS_API bool MUtils::regexp_parse_uint32 (const QRegExp & regexp,
quint32 & value 
)
+
+ +

Parse regular expression results.

+

This function tries to parses the result (capture) of a regular expression as an unsigned 32-Bit value. The given regular expression must contain at least one capture. Only the first capture is considered, additional captures are ignored.

+
Parameters
+ + + +
regexpA read-only reference to the QRegExp object whose result (capture) will be parsed. This QRegExp must already have been successfully matched against the respective input string, e.g. via QRegExp::indexIn(), prior to calling this function.
valueA reference to a variable of type quint32, where the unsigned 32-Bit representation of the result will be stored. The contents of this variable are undefined, if the function failed.
+
+
+
Returns
The function returns true, if the regular expression's capture could be parsed successfully; it returns false, if the capture contains an invalid string or if there are insufficient captures in given the QRegExp object.
+ +
+
+ +

§ regexp_parse_uint32() [2/2]

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
MUTILS_API bool MUtils::regexp_parse_uint32 (const QRegExp & regexp,
quint32 * values,
const size_t & count 
)
+
+ +

Parse regular expression results.

+

This function tries to parses the results (captures) of a regular expression as unsigned 32-Bit values. The given regular expression must contain at least count captures. Only the first count captures are considered, additional captures are ignored.

+
Parameters
+ + + + +
regexpA read-only reference to the QRegExp object whose results (captures) will be parsed. This QRegExp must already have been successfully matched against the respective input string, e.g. via QRegExp::indexIn(), prior to calling this function.
valueA pointer to an array of type quint32, where the unsigned 32-Bit representations of the results will be stored (the n-th result is stored at value[n-1]). The array must be at least count elements in length. The contents of this array are undefined, if the function failed.
countSpecifies the number of results (captures) in the given QRegExp object. The function tries to parse the first count captures and ignores any additional captures that may exist. This parameter also determines the required (minimum) length of the value array.
+
+
+
Returns
The function returns true, if all of the regular expression's captures could be parsed successfully; it returns false, if any of the captures contain an invalid string or if there are insufficient captures in given the QRegExp object.
+ +
+
+ +

§ remove_directory()

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

Recursively deletes the specified directory.

+

The function deletes the specified directory. In recursive 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()

+ +
+
+ + + + + + + + +
MUTILS_API 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()

+ +
+
+ + + + + + + + +
MUTILS_API const QString& MUtils::temp_folder (void )
+
+ +

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 terminates normally, 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]

+ +
+
+ + + + + + + + +
MUTILS_API 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]

+ +
+
+ + + + + + + + +
MUTILS_API 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]

+ +
+
+ + + + + + + + +
MUTILS_API 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]

+ +
+
+ + + + + + + + +
MUTILS_API 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/d3/dc6/class_m_utils_1_1_taskbar7-members.html b/docs/d3/dc6/class_m_utils_1_1_taskbar7-members.html index 3df244d..c660c63 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 @@ -59,7 +59,7 @@ $(function() {
diff --git a/docs/d5/d3b/_global_8h.html b/docs/d5/d3b/_global_8h.html index 6fe6dbf..c3852f6 100644 --- a/docs/d5/d3b/_global_8h.html +++ b/docs/d5/d3b/_global_8h.html @@ -64,6 +64,7 @@ $(function() {
+Namespaces | Macros | Functions
@@ -77,662 +78,108 @@ $(function() {

Go to the source code of this file.

+ + + +

+Namespaces

 MUtils
 
- - - - - - - - - - +#define  + +#define  + +#define  + +#define  + +#define  + +#define  + +#define  +

Macros

-#define MUTILS_API
 
-#define MUTILS_MAKE_STRING_HELPER(X)   #X
 
-#define MUTILS_MAKE_STRING(X)   MUTILS_MAKE_STRING_HELPER(X)
 
-#define MUTILS_COMPILER_WARNING(TXT)   __pragma(message(__FILE__ "(" MUTILS_MAKE_STRING(__LINE__) ") : warning: " TXT))
 
-#define MUTILS_DEBUG   (1)
 
-#define MUTILS_DELETE(PTR)   do { if((PTR)) { delete (PTR); (PTR) = NULL; } } while(0)
MUTILS_DELETE(PTR)   do { if((PTR)) { delete (PTR); (PTR) = NULL; } } while(0)
 Deletes the object, if and only if the given pointer is not NULL. Also sets pointer to NULL after object has been deleted.
 
-#define MUTILS_DELETE_ARRAY(PTR)   do { if((PTR)) { delete [] (PTR); (PTR) = NULL; } } while(0)
MUTILS_DELETE_ARRAY(PTR)   do { if((PTR)) { delete [] (PTR); (PTR) = NULL; } } while(0)
 Deletes the array, if and only if the given pointer is not NULL. Also sets pointer to NULL after array has been deleted.
 
-#define MUTILS_ZERO_MEMORY(PTR)   memset(&(PTR), 0, sizeof((PTR)))
MUTILS_ZERO_MEMORY(PTR)   memset(&(PTR), 0, sizeof((PTR)))
 Clears the specified variable or struct by setting all of its bytes to zero (0x00). Do not use for arrays.
 
-#define MUTILS_WCHR(STR)   (reinterpret_cast<const wchar_t*>((STR).utf16()))
MUTILS_WCHR(STR)   (reinterpret_cast<const wchar_t*>((STR).utf16()))
 Converts a given QString object to a wchar_t* pointer. Does not copy the string data, so do not free the pointer! The returned pointer only remains valid until the underlying QString is modified or goes out of scope.
 
-#define MUTILS_UTF8(STR)   ((STR).toUtf8().constData())
MUTILS_UTF8(STR)   ((STR).toUtf8().constData())
 Converts a given QString object to a char* pointer. The string is converted to UTF-8 encoding. The pointer is valid only while the expression is being evaluated, so do not free or store this pointer! Mainly useful for function calls that require a char* argument.
 
-#define MUTILS_QSTR(STR)   (QString::fromUtf16(reinterpret_cast<const unsigned short*>((STR))))
MUTILS_QSTR(STR)   (QString::fromUtf16(reinterpret_cast<const unsigned short*>((STR))))
 Creates a QString object from a given wchar_t* buffer. The buffer is expected to conatin a NULL-terminated string in UTF-16 encoding. The string data is copied into the new QString object, however the original buffer will not be freed automatically!
 
-#define MUTILS_BOOL2STR(X)   ((X) ? "1" : "0")
MUTILS_BOOL2STR(X)   ((X) ? "1" : "0")
 Converts a boolean expression into a string. A true boolean expression is converted to the string "1"; a false boolean expression is converted to the string "0".
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Functions

const QString & MUtils::temp_folder (void)
 Rerieves the full path of the application's Temp folder. More...
 
-void MUtils::init_process (QProcess &process, const QString &wokringDir, const bool bReplaceTempDir=true, const QStringList *const extraPaths=NULL)
 
quint32 MUtils::next_rand_u32 (void)
 Generates a random unsigned 32-Bit value. More...
 
quint64 MUtils::next_rand_u64 (void)
 Generates a random unsigned 64-Bit value. More...
 
QString MUtils::next_rand_str (const bool &bLong=false)
 Generates a random string. More...
 
QString MUtils::make_temp_file (const QString &basePath, const QString &extension, const bool placeholder=false)
 Generates a temporary file name. More...
 
QString MUtils::make_unique_file (const QString &basePath, const QString &baseName, const QString &extension, const bool fancy=false)
 Generates a unique file name. More...
 
bool MUtils::parity (quint32 value)
 Computes the parity of the given unsigned 32-Bit value. More...
 
bool MUtils::remove_file (const QString &fileName)
 Deletes the specified file. More...
 
bool MUtils::remove_directory (const QString &folderPath, const bool &recursive)
 Recursively deletes the specified directory. More...
 
QString & MUtils::trim_right (QString &str)
 Remove trailing white-space characters. More...
 
QString & MUtils::trim_left (QString &str)
 Remove leading white-space characters. More...
 
QString MUtils::trim_right (const QString &str)
 Remove trailing white-space characters. More...
 
QString MUtils::trim_left (const QString &str)
 Remove trailing white-space characters. More...
 
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)
 
-QString MUtils::clean_file_path (const QString &path)
 
bool MUtils::regexp_parse_uint32 (const QRegExp &regexp, quint32 &value)
 Parse regular expression results. More...
 
bool MUtils::regexp_parse_uint32 (const QRegExp &regexp, quint32 *values, const size_t &count)
 Parse regular expression results. More...
 
QStringList MUtils::available_codepages (const bool &noAliases=true)
 Retrieve a list of all available codepages. More...
 
MUTILS_API const QString & MUtils::temp_folder (void)
 Rerieves the full path of the application's Temp folder. More...
 
MUTILS_API void MUtils::init_process (QProcess &process, const QString &wokringDir, const bool bReplaceTempDir=true, const QStringList *const extraPaths=NULL)
 Initialize a given QProcess object. More...
 
MUTILS_API quint32 MUtils::next_rand_u32 (void)
 Generates a random unsigned 32-Bit value. More...
 
MUTILS_API quint64 MUtils::next_rand_u64 (void)
 Generates a random unsigned 64-Bit value. More...
 
MUTILS_API QString MUtils::next_rand_str (const bool &bLong=false)
 Generates a random string. More...
 
MUTILS_API QString MUtils::make_temp_file (const QString &basePath, const QString &extension, const bool placeholder=false)
 Generates a temporary file name. More...
 
MUTILS_API QString MUtils::make_unique_file (const QString &basePath, const QString &baseName, const QString &extension, const bool fancy=false)
 Generates a unique file name. More...
 
MUTILS_API bool MUtils::parity (quint32 value)
 Computes the parity of the given unsigned 32-Bit value. More...
 
MUTILS_API bool MUtils::remove_file (const QString &fileName)
 Deletes the specified file. More...
 
MUTILS_API bool MUtils::remove_directory (const QString &folderPath, const bool &recursive)
 Recursively deletes the specified directory. More...
 
MUTILS_API QString & MUtils::trim_right (QString &str)
 Remove trailing white-space characters. More...
 
MUTILS_API QString & MUtils::trim_left (QString &str)
 Remove leading white-space characters. More...
 
MUTILS_API QString MUtils::trim_right (const QString &str)
 Remove trailing white-space characters. More...
 
MUTILS_API QString MUtils::trim_left (const QString &str)
 Remove trailing white-space characters. More...
 
MUTILS_API void MUtils::natural_string_sort (QStringList &list, const bool bIgnoreCase)
 Sort a list of strings using "natural ordering" algorithm. More...
 
MUTILS_API QString MUtils::clean_file_name (const QString &name)
 Clean up a file name string. More...
 
MUTILS_API QString MUtils::clean_file_path (const QString &path)
 Clean up a file path string. More...
 
MUTILS_API bool MUtils::regexp_parse_uint32 (const QRegExp &regexp, quint32 &value)
 Parse regular expression results. More...
 
MUTILS_API bool MUtils::regexp_parse_uint32 (const QRegExp &regexp, quint32 *values, const size_t &count)
 Parse regular expression results. More...
 
MUTILS_API QStringList MUtils::available_codepages (const bool &noAliases=true)
 Retrieve a list of all available codepages. More...
 

Detailed Description

This file contains miscellaneous functions that are generally useful for Qt-based applications.

-

Function Documentation

- -

§ available_codepages()

- -
-
- - - - - - - - -
QStringList MUtils::available_codepages (const bool & noAliases = true)
-
- -

Retrieve a list of all available codepages.

-

The function generates a list of all codepages that are available on the system. Each codepage name returned by this function may be passed to the QTextCodec::codecForName() function in order to obtain a corresponding QTextCodec object.

-
Parameters
- - -
noAliasesIf set to true, only distinct codepages are returned, i.e. any codepage aliases are discarded from the list; if set to false, the returned list may (and usually will) also contain codepage aliases.
-
-
-
Returns
If the function succeeds, it returns a QStringList holding the names of all codepages available on the system; otherwise it returns a default-constructed QStringList.
- -
-
- -

§ make_temp_file()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
QString MUtils::make_temp_file (const QString & basePath,
const QString & extension,
const bool placeholder = false 
)
-
- -

Generates a temporary file name.

-

The function generates a file name that contains a random component and that is guaranteed to not exist yet. The generated file name follows a "<basedir>/<random>.<ext>" pattern. This is useful (not only) for creating temporary files.

-
Parameters
- - - - -
basePathSpecifies the "base" directory where the temporary file is supposed to be created. This must be a valid existing directory.
extensionSpecifies the desired file extensions of the temporary file. Do not include a leading dot (.) character.
placeholderIf set to true, the function creates an empty "placeholder" file under the returned file name; if set to false, it does not.
-
-
-
Returns
If the function succeeds, it returns a QString holding the full path of the temporary file; otherwise it returns a default-constructed QString.
- -
-
- -

§ make_unique_file()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
QString MUtils::make_unique_file (const QString & basePath,
const QString & baseName,
const QString & extension,
const bool fancy = false 
)
-
- -

Generates a unique file name.

-

The function generates a unique file name in the specified directory. The function guarantees that the returned file name does not exist yet. If necessary, a counter will be included in the file name in order to ensure its uniqueness.

-
Parameters
- - - - - -
basePathSpecifies the "base" directory where the unique file is supposed to be created. This must be a valid existing directory.
baseNameSpecifies the desired "base" file name of the unique file. Do not include a file extension.
extensionSpecifies the desired file extensions of the unique file. Do not include a leading dot (.) character.
fancyIf set to true, the unique file name is generated according to the "<basedir>/<basename> (N).<ext>" pattern; if set to false, it is generated according to the "<basedir>/<basename>.XXXX.<ext>" pattern. Also, if set to true, a counter is only included in the file name, if the file name without counter already exists; if set to false, a counter is always included. Finally, if set to true, the counter starts at 2 and is printed in decimal format; if set to false, the counter starts at 0 and is printed in zero-padded hexadecimal format.
-
-
-
Returns
If the function succeeds, it returns a QString holding the full path of the unique file; otherwise it returns a default-constructed QString.
- -
-
- -

§ 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".
bIgnoreCaseIf set to true, the list will be sorted disregarding the character case, i.e. upper-case and lower-case characters (of the same letter) are treated the same; if set to false, the character case is taken into account.
-
-
- -
-
- -

§ next_rand_str()

- -
-
- - - - - - - - -
QString MUtils::next_rand_str (const bool & bLong = false)
-
- -

Generates a random string.

-

The random string is generated using the same PRNG as the next_rand_u64() function. The random bytes are converted to a hexadecimal string and, if necessary, zero-padded to a toal length of 16 or 32 characters. There is no 0x-prefix included in the result.

-
Parameters
- - -
bLongIf set to true, a "long" random string (32 characters) will be generated; if set to false, a "short" random string (16 characters) is generated.
-
-
-
Returns
The function returns a QString holding a random hexadecimal string
- -
-
- -

§ next_rand_u32()

- -
-
- - - - - - - - -
quint32 MUtils::next_rand_u32 (void )
-
- -

Generates a random unsigned 32-Bit value.

-

The random value is created using a "strong" PRNG of the underlying system, if possible. Otherwise a fallback PRNG is used. It is not required or useful to call srand() or qsrand() prior to using this function. If necessary, the seeding of the PRNG happen automatically on the first call.

-
Returns
The function returns a random unsigned 32-Bit value.
- -
-
- -

§ next_rand_u64()

- -
-
- - - - - - - - -
quint64 MUtils::next_rand_u64 (void )
-
- -

Generates a random unsigned 64-Bit value.

-

The random value is created using a "strong" PRNG of the underlying system, if possible. Otherwise a fallback PRNG is used. It is not required or useful to call srand() or qsrand() prior to using this function. If necessary, the seeding of the PRNG happen automatically on the first call.

-
Returns
The function returns a random unsigned 64-Bit value.
- -
-
- -

§ parity()

- -
-
- - - - - - - - -
bool MUtils::parity (quint32 value)
-
- -

Computes the parity of the given unsigned 32-Bit value.

-
Parameters
- - -
valueThe 32-Bit unsigned value from which the parity is to be computed.
-
-
-
Returns
The function returns true, if the number of 1 bits in the given value is odd; it returns false, if the number of 1 bits in the given value is even.
- -
-
- -

§ regexp_parse_uint32() [1/2]

- -
-
- - - - - - - - - - - - - - - - - - -
bool MUtils::regexp_parse_uint32 (const QRegExp & regexp,
quint32 & value 
)
-
- -

Parse regular expression results.

-

This function tries to parses the result (capture) of a regular expression as an unsigned 32-Bit value. The given regular expression must contain at least one capture. Only the first capture is considered, additional captures are ignored.

-
Parameters
- - - -
regexpA read-only reference to the QRegExp object whose result (capture) will be parsed. This QRegExp must already have been successfully matched against the respective input string, e.g. via QRegExp::indexIn(), prior to calling this function.
valueA reference to a variable of type quint32, where the unsigned 32-Bit representation of the result will be stored. The contents of this variable are undefined, if the function failed.
-
-
-
Returns
The function returns true, if the regular expression's capture could be parsed successfully; it returns false, if the capture contains an invalid string or if there are insufficient captures in given the QRegExp object.
- -
-
- -

§ regexp_parse_uint32() [2/2]

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
bool MUtils::regexp_parse_uint32 (const QRegExp & regexp,
quint32 * values,
const size_t & count 
)
-
- -

Parse regular expression results.

-

This function tries to parses the results (captures) of a regular expression as unsigned 32-Bit values. The given regular expression must contain at least count captures. Only the first count captures are considered, additional captures are ignored.

-
Parameters
- - - - -
regexpA read-only reference to the QRegExp object whose results (captures) will be parsed. This QRegExp must already have been successfully matched against the respective input string, e.g. via QRegExp::indexIn(), prior to calling this function.
valueA pointer to an array of type quint32, where the unsigned 32-Bit representations of the results will be stored (the n-th result is stored at value[n-1]). The array must be at least count elements in length. The contents of this array are undefined, if the function failed.
countSpecifies the number of results (captures) in the given QRegExp object. The function tries to parse the first count captures and ignores any additional captures that may exist. This parameter also determines the required (minimum) length of the value array.
-
-
-
Returns
The function returns true, if all of the regular expression's captures could be parsed successfully; it returns false, if any of the captures contain an invalid string or if there are insufficient captures in given the QRegExp object.
- -
-
- -

§ remove_directory()

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

Recursively deletes the specified directory.

-

The function deletes the specified directory. In recursive 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()

- -
-
- - - - - - - - -
const QString& MUtils::temp_folder (void )
-
- -

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 terminates normally, 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.
- -
-
-
+