MUtilities/docs/d5/d3b/_global_8h.html

633 lines
42 KiB
HTML
Raw Normal View History

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.12"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>MuldeR&#39;s Utilities for Qt: include/MUtils/Global.h File Reference</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">MuldeR&#39;s Utilities for Qt
</div>
<div id="projectbrief">MUtilities</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.12 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
</script>
<script type="text/javascript" src="../../menudata.js"></script>
<script type="text/javascript" src="../../menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('../../',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="../../dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="../../dir_b076b53667bc06ebb413a190e197fc7b.html">MUtils</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">Global.h File Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>This file contains miscellaneous functions that are generally useful for Qt-based applications.
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &lt;QString&gt;</code><br />
</div>
<p><a href="../../d5/d3b/_global_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a761530893b34e2d324f22ddf7bc31455"><td class="memItemLeft" align="right" valign="top"><a id="a761530893b34e2d324f22ddf7bc31455"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>MUTILS_API</b></td></tr>
<tr class="separator:a761530893b34e2d324f22ddf7bc31455"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad5b14e1c1267ed90263a45bf6d4289ca"><td class="memItemLeft" align="right" valign="top"><a id="ad5b14e1c1267ed90263a45bf6d4289ca"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>MUTILS_MAKE_STRING_HELPER</b>(X)&#160;&#160;&#160;#X</td></tr>
<tr class="separator:ad5b14e1c1267ed90263a45bf6d4289ca"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af2c5f52bf983b10e2078b03ce36efb22"><td class="memItemLeft" align="right" valign="top"><a id="af2c5f52bf983b10e2078b03ce36efb22"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>MUTILS_MAKE_STRING</b>(X)&#160;&#160;&#160;MUTILS_MAKE_STRING_HELPER(X)</td></tr>
<tr class="separator:af2c5f52bf983b10e2078b03ce36efb22"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2b88ab398bf3616fb6826c806f435ddc"><td class="memItemLeft" align="right" valign="top"><a id="a2b88ab398bf3616fb6826c806f435ddc"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>MUTILS_COMPILER_WARNING</b>(TXT)&#160;&#160;&#160;__pragma(message(__FILE__ &quot;(&quot; MUTILS_MAKE_STRING(__LINE__) &quot;) : warning: &quot; TXT))</td></tr>
<tr class="separator:a2b88ab398bf3616fb6826c806f435ddc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a249516197568fbf9bbf980554b4d6d95"><td class="memItemLeft" align="right" valign="top"><a id="a249516197568fbf9bbf980554b4d6d95"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>MUTILS_DEBUG</b>&#160;&#160;&#160;(1)</td></tr>
<tr class="separator:a249516197568fbf9bbf980554b4d6d95"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad42b1946a83df3bd76734d5ab691fd0d"><td class="memItemLeft" align="right" valign="top"><a id="ad42b1946a83df3bd76734d5ab691fd0d"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>MUTILS_DELETE</b>(PTR)&#160;&#160;&#160;do { if((PTR)) { delete (PTR); (PTR) = NULL; } } while(0)</td></tr>
<tr class="separator:ad42b1946a83df3bd76734d5ab691fd0d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa544a37b80f1ab9d86f439a7666e9aa8"><td class="memItemLeft" align="right" valign="top"><a id="aa544a37b80f1ab9d86f439a7666e9aa8"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>MUTILS_DELETE_ARRAY</b>(PTR)&#160;&#160;&#160;do { if((PTR)) { delete [] (PTR); (PTR) = NULL; } } while(0)</td></tr>
<tr class="separator:aa544a37b80f1ab9d86f439a7666e9aa8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1fe39de37351efa3ca46bdc8653e1f25"><td class="memItemLeft" align="right" valign="top"><a id="a1fe39de37351efa3ca46bdc8653e1f25"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>MUTILS_ZERO_MEMORY</b>(PTR)&#160;&#160;&#160;memset(&amp;(PTR), 0, sizeof((PTR)))</td></tr>
<tr class="separator:a1fe39de37351efa3ca46bdc8653e1f25"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af55d43b39d3f41cf090c138ed190ee6e"><td class="memItemLeft" align="right" valign="top"><a id="af55d43b39d3f41cf090c138ed190ee6e"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>MUTILS_WCHR</b>(STR)&#160;&#160;&#160;(reinterpret_cast&lt;const wchar_t*&gt;((STR).utf16()))</td></tr>
<tr class="separator:af55d43b39d3f41cf090c138ed190ee6e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a88b0902153ea537b12d86267af20eb3f"><td class="memItemLeft" align="right" valign="top"><a id="a88b0902153ea537b12d86267af20eb3f"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>MUTILS_UTF8</b>(STR)&#160;&#160;&#160;((STR).toUtf8().constData())</td></tr>
<tr class="separator:a88b0902153ea537b12d86267af20eb3f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a04d63f6f60c90f8e3c4029824a7352b0"><td class="memItemLeft" align="right" valign="top"><a id="a04d63f6f60c90f8e3c4029824a7352b0"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>MUTILS_QSTR</b>(STR)&#160;&#160;&#160;(QString::fromUtf16(reinterpret_cast&lt;const unsigned short*&gt;((STR))))</td></tr>
<tr class="separator:a04d63f6f60c90f8e3c4029824a7352b0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a177ecbfe7701c2ac04bb8bdeb208773a"><td class="memItemLeft" align="right" valign="top"><a id="a177ecbfe7701c2ac04bb8bdeb208773a"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>MUTILS_BOOL2STR</b>(X)&#160;&#160;&#160;((X) ? &quot;1&quot; : &quot;0&quot;)</td></tr>
<tr class="separator:a177ecbfe7701c2ac04bb8bdeb208773a"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a9ddb9a2039585b1ef3429db16ea84292"><td class="memItemLeft" align="right" valign="top">const QString &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/d3b/_global_8h.html#a9ddb9a2039585b1ef3429db16ea84292">MUtils::temp_folder</a> (void)</td></tr>
<tr class="memdesc:a9ddb9a2039585b1ef3429db16ea84292"><td class="mdescLeft">&#160;</td><td class="mdescRight">Rerieves the full path of the application's <em>Temp</em> folder. <a href="../../d5/d3b/_global_8h.html#a9ddb9a2039585b1ef3429db16ea84292">More...</a><br /></td></tr>
<tr class="separator:a9ddb9a2039585b1ef3429db16ea84292"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5a94d9552ee93a19722fdb411e580340"><td class="memItemLeft" align="right" valign="top"><a id="a5a94d9552ee93a19722fdb411e580340"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>MUtils::init_process</b> (QProcess &amp;process, const QString &amp;wokringDir, const bool bReplaceTempDir=true, const QStringList *const extraPaths=NULL)</td></tr>
<tr class="separator:a5a94d9552ee93a19722fdb411e580340"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4dc7dccb81653ae28e0d37a7c2f62112"><td class="memItemLeft" align="right" valign="top">quint32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/d3b/_global_8h.html#a4dc7dccb81653ae28e0d37a7c2f62112">MUtils::next_rand_u32</a> (void)</td></tr>
<tr class="memdesc:a4dc7dccb81653ae28e0d37a7c2f62112"><td class="mdescLeft">&#160;</td><td class="mdescRight">Generates a <em>random</em> unsigned 32-Bit value. <a href="../../d5/d3b/_global_8h.html#a4dc7dccb81653ae28e0d37a7c2f62112">More...</a><br /></td></tr>
<tr class="separator:a4dc7dccb81653ae28e0d37a7c2f62112"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a15762bf5b0239e5f67a3815d63ed441a"><td class="memItemLeft" align="right" valign="top">quint64&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/d3b/_global_8h.html#a15762bf5b0239e5f67a3815d63ed441a">MUtils::next_rand_u64</a> (void)</td></tr>
<tr class="memdesc:a15762bf5b0239e5f67a3815d63ed441a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Generates a <em>random</em> unsigned 64-Bit value. <a href="../../d5/d3b/_global_8h.html#a15762bf5b0239e5f67a3815d63ed441a">More...</a><br /></td></tr>
<tr class="separator:a15762bf5b0239e5f67a3815d63ed441a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a996b60884ddf7728178e94f34ca12570"><td class="memItemLeft" align="right" valign="top">QString&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/d3b/_global_8h.html#a996b60884ddf7728178e94f34ca12570">MUtils::next_rand_str</a> (const bool &amp;bLong=false)</td></tr>
<tr class="memdesc:a996b60884ddf7728178e94f34ca12570"><td class="mdescLeft">&#160;</td><td class="mdescRight">Generates a <em>random</em> string. <a href="../../d5/d3b/_global_8h.html#a996b60884ddf7728178e94f34ca12570">More...</a><br /></td></tr>
<tr class="separator:a996b60884ddf7728178e94f34ca12570"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a67cb16c62b213da5135a6fa076f3f005"><td class="memItemLeft" align="right" valign="top">QString&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/d3b/_global_8h.html#a67cb16c62b213da5135a6fa076f3f005">MUtils::make_temp_file</a> (const QString &amp;basePath, const QString &amp;extension, const bool placeholder=false)</td></tr>
<tr class="memdesc:a67cb16c62b213da5135a6fa076f3f005"><td class="mdescLeft">&#160;</td><td class="mdescRight">Generates a temporary file name. <a href="../../d5/d3b/_global_8h.html#a67cb16c62b213da5135a6fa076f3f005">More...</a><br /></td></tr>
<tr class="separator:a67cb16c62b213da5135a6fa076f3f005"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a390e56e35eb9329d2e67fa9741d07536"><td class="memItemLeft" align="right" valign="top">QString&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/d3b/_global_8h.html#a390e56e35eb9329d2e67fa9741d07536">MUtils::make_unique_file</a> (const QString &amp;basePath, const QString &amp;baseName, const QString &amp;extension, const bool fancy=false)</td></tr>
<tr class="memdesc:a390e56e35eb9329d2e67fa9741d07536"><td class="mdescLeft">&#160;</td><td class="mdescRight">Generates a unique file name. <a href="../../d5/d3b/_global_8h.html#a390e56e35eb9329d2e67fa9741d07536">More...</a><br /></td></tr>
<tr class="separator:a390e56e35eb9329d2e67fa9741d07536"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad1bdb5e416839b1f85f6df68e58ae28c"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/d3b/_global_8h.html#ad1bdb5e416839b1f85f6df68e58ae28c">MUtils::parity</a> (quint32 value)</td></tr>
<tr class="memdesc:ad1bdb5e416839b1f85f6df68e58ae28c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Computes the <em>parity</em> of the given unsigned 32-Bit value. <a href="../../d5/d3b/_global_8h.html#ad1bdb5e416839b1f85f6df68e58ae28c">More...</a><br /></td></tr>
<tr class="separator:ad1bdb5e416839b1f85f6df68e58ae28c"><td class="memSeparator" colspan="2">&#160;</td></tr>
2016-12-19 01:57:41 +01:00
<tr class="memitem:a12259acdd6aff74ee83819d3aebd8ba9"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/d3b/_global_8h.html#a12259acdd6aff74ee83819d3aebd8ba9">MUtils::remove_file</a> (const QString &amp;fileName)</td></tr>
<tr class="memdesc:a12259acdd6aff74ee83819d3aebd8ba9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deletes the specified file. <a href="../../d5/d3b/_global_8h.html#a12259acdd6aff74ee83819d3aebd8ba9">More...</a><br /></td></tr>
<tr class="separator:a12259acdd6aff74ee83819d3aebd8ba9"><td class="memSeparator" colspan="2">&#160;</td></tr>
2016-12-19 01:57:41 +01:00
<tr class="memitem:ac7d2c9bd5c49230b2fed72e3410c3f7d"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/d3b/_global_8h.html#ac7d2c9bd5c49230b2fed72e3410c3f7d">MUtils::remove_directory</a> (const QString &amp;folderPath, const bool &amp;recursive)</td></tr>
<tr class="memdesc:ac7d2c9bd5c49230b2fed72e3410c3f7d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Recursively deletes the specified directory. <a href="../../d5/d3b/_global_8h.html#ac7d2c9bd5c49230b2fed72e3410c3f7d">More...</a><br /></td></tr>
<tr class="separator:ac7d2c9bd5c49230b2fed72e3410c3f7d"><td class="memSeparator" colspan="2">&#160;</td></tr>
2016-12-19 01:57:41 +01:00
<tr class="memitem:a9290a3fe637a05ad2a7515f36fad79bd"><td class="memItemLeft" align="right" valign="top">QString &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/d3b/_global_8h.html#a9290a3fe637a05ad2a7515f36fad79bd">MUtils::trim_right</a> (QString &amp;str)</td></tr>
<tr class="memdesc:a9290a3fe637a05ad2a7515f36fad79bd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Remove <em>trailing</em> white-space characters. <a href="../../d5/d3b/_global_8h.html#a9290a3fe637a05ad2a7515f36fad79bd">More...</a><br /></td></tr>
<tr class="separator:a9290a3fe637a05ad2a7515f36fad79bd"><td class="memSeparator" colspan="2">&#160;</td></tr>
2016-12-19 01:57:41 +01:00
<tr class="memitem:af089c8a40b6ec2e19db3fe612aa81c8c"><td class="memItemLeft" align="right" valign="top">QString &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/d3b/_global_8h.html#af089c8a40b6ec2e19db3fe612aa81c8c">MUtils::trim_left</a> (QString &amp;str)</td></tr>
<tr class="memdesc:af089c8a40b6ec2e19db3fe612aa81c8c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Remove <em>leading</em> white-space characters. <a href="../../d5/d3b/_global_8h.html#af089c8a40b6ec2e19db3fe612aa81c8c">More...</a><br /></td></tr>
<tr class="separator:af089c8a40b6ec2e19db3fe612aa81c8c"><td class="memSeparator" colspan="2">&#160;</td></tr>
2016-12-19 01:57:41 +01:00
<tr class="memitem:a3eb47d6ca49b2700622e3fe99faf14d8"><td class="memItemLeft" align="right" valign="top">QString&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/d3b/_global_8h.html#a3eb47d6ca49b2700622e3fe99faf14d8">MUtils::trim_right</a> (const QString &amp;str)</td></tr>
<tr class="memdesc:a3eb47d6ca49b2700622e3fe99faf14d8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Remove <em>trailing</em> white-space characters. <a href="../../d5/d3b/_global_8h.html#a3eb47d6ca49b2700622e3fe99faf14d8">More...</a><br /></td></tr>
<tr class="separator:a3eb47d6ca49b2700622e3fe99faf14d8"><td class="memSeparator" colspan="2">&#160;</td></tr>
2016-12-19 01:57:41 +01:00
<tr class="memitem:a8680aeaeb1118353bd099e26ba7d6123"><td class="memItemLeft" align="right" valign="top">QString&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/d3b/_global_8h.html#a8680aeaeb1118353bd099e26ba7d6123">MUtils::trim_left</a> (const QString &amp;str)</td></tr>
<tr class="memdesc:a8680aeaeb1118353bd099e26ba7d6123"><td class="mdescLeft">&#160;</td><td class="mdescRight">Remove <em>trailing</em> white-space characters. <a href="../../d5/d3b/_global_8h.html#a8680aeaeb1118353bd099e26ba7d6123">More...</a><br /></td></tr>
<tr class="separator:a8680aeaeb1118353bd099e26ba7d6123"><td class="memSeparator" colspan="2">&#160;</td></tr>
2016-12-19 01:57:41 +01:00
<tr class="memitem:a09e919d419ded903481cf7aba702dcba"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/d3b/_global_8h.html#a09e919d419ded903481cf7aba702dcba">MUtils::natural_string_sort</a> (QStringList &amp;list, const bool bIgnoreCase)</td></tr>
<tr class="memdesc:a09e919d419ded903481cf7aba702dcba"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sort a list of strings using "natural ordering" algorithm. <a href="../../d5/d3b/_global_8h.html#a09e919d419ded903481cf7aba702dcba">More...</a><br /></td></tr>
<tr class="separator:a09e919d419ded903481cf7aba702dcba"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a895e14458df7226110ae70029c1729a9"><td class="memItemLeft" align="right" valign="top"><a id="a895e14458df7226110ae70029c1729a9"></a>
QString&#160;</td><td class="memItemRight" valign="bottom"><b>MUtils::clean_file_name</b> (const QString &amp;name)</td></tr>
<tr class="separator:a895e14458df7226110ae70029c1729a9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac0949226be088ce65a60d5aa4194e1c0"><td class="memItemLeft" align="right" valign="top"><a id="ac0949226be088ce65a60d5aa4194e1c0"></a>
QString&#160;</td><td class="memItemRight" valign="bottom"><b>MUtils::clean_file_path</b> (const QString &amp;path)</td></tr>
<tr class="separator:ac0949226be088ce65a60d5aa4194e1c0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a45cb0d1e6a55cf5ffda3b626c25fd957"><td class="memItemLeft" align="right" valign="top"><a id="a45cb0d1e6a55cf5ffda3b626c25fd957"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>MUtils::regexp_parse_uint32</b> (const QRegExp &amp;regexp, quint32 &amp;value)</td></tr>
<tr class="separator:a45cb0d1e6a55cf5ffda3b626c25fd957"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a367969a260da994876d19c9f7ee40606"><td class="memItemLeft" align="right" valign="top"><a id="a367969a260da994876d19c9f7ee40606"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>MUtils::regexp_parse_uint32</b> (const QRegExp &amp;regexp, quint32 *values, const size_t &amp;count)</td></tr>
<tr class="separator:a367969a260da994876d19c9f7ee40606"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4fcbdafffc1224776616fcc6aec8278b"><td class="memItemLeft" align="right" valign="top"><a id="a4fcbdafffc1224776616fcc6aec8278b"></a>
QStringList&#160;</td><td class="memItemRight" valign="bottom"><b>MUtils::available_codepages</b> (const bool &amp;noAliases=true)</td></tr>
<tr class="separator:a4fcbdafffc1224776616fcc6aec8278b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a00af0daa1ae56f474746443002be6786"><td class="memItemLeft" align="right" valign="top"><a id="a00af0daa1ae56f474746443002be6786"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><b>MUtils::Internal::selfTest</b> (const char *const buildKey, const bool debug)</td></tr>
<tr class="separator:a00af0daa1ae56f474746443002be6786"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>This file contains miscellaneous functions that are generally useful for Qt-based applications. </p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="file_a67cb16c62b213da5135a6fa076f3f005"></a>
<h2 class="memtitle"><span class="permalink"><a href="#file_a67cb16c62b213da5135a6fa076f3f005">&sect;&nbsp;</a></span>make_temp_file()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">QString MUtils::make_temp_file </td>
<td>(</td>
<td class="paramtype">const QString &amp;&#160;</td>
<td class="paramname"><em>basePath</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const QString &amp;&#160;</td>
<td class="paramname"><em>extension</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const bool&#160;</td>
<td class="paramname"><em>placeholder</em> = <code>false</code>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Generates a temporary file name. </p>
<p>The function generates a file name that contains a <em>random</em> component and that is guaranteed to <b>not</b> exist yet. The generated file name follows a <code>"&lt;basedir&gt;/&lt;random&gt;.&lt;ext&gt;"</code> pattern. This is useful (not only) for creating temporary files.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">basePath</td><td>Specifies the "base" directory where the temporary file is supposed to be created. This must be a valid <em>existing</em> directory.</td></tr>
<tr><td class="paramname">extension</td><td>Specifies the desired file extensions of the temporary file. Do <b>not</b> include a leading dot (<code>.</code>) character.</td></tr>
<tr><td class="paramname">placeholder</td><td>If set to <code>true</code>, the function creates an empty "placeholder" file under the returned file name; if set to <code>false</code>, it does <em>not</em>.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>If the function succeeds, it returns a QString holding the full path of the temporary file; otherwise it returns a default-constructed QString. </dd></dl>
</div>
</div>
<a id="file_a390e56e35eb9329d2e67fa9741d07536"></a>
<h2 class="memtitle"><span class="permalink"><a href="#file_a390e56e35eb9329d2e67fa9741d07536">&sect;&nbsp;</a></span>make_unique_file()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">QString MUtils::make_unique_file </td>
<td>(</td>
<td class="paramtype">const QString &amp;&#160;</td>
<td class="paramname"><em>basePath</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const QString &amp;&#160;</td>
<td class="paramname"><em>baseName</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const QString &amp;&#160;</td>
<td class="paramname"><em>extension</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const bool&#160;</td>
<td class="paramname"><em>fancy</em> = <code>false</code>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Generates a unique file name. </p>
2016-12-18 22:44:17 +01:00
<p>The function generates a unique file name in the specified directory. The function guarantees that the returned file name does <em>not</em> exist yet. If necessary, a <em>counter</em> will be included in the file name in order to ensure its uniqueness.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">basePath</td><td>Specifies the "base" directory where the unique file is supposed to be created. This must be a valid <em>existing</em> directory.</td></tr>
<tr><td class="paramname">baseName</td><td>Specifies the desired "base" file name of the unqiue file. Do <b>not</b> include a file extension.</td></tr>
<tr><td class="paramname">extension</td><td>Specifies the desired file extensions of the unqiue file. Do <b>not</b> include a leading dot (<code>.</code>) character.</td></tr>
2016-12-18 22:48:17 +01:00
<tr><td class="paramname">fancy</td><td>If set to <code>true</code>, the file name is generated according to the <code>"&lt;basedir&gt;/&lt;basename&gt; (N).&lt;ext&gt;"</code> pattern; if set to <code>false</code>, the file name is generated according to the <code>"&lt;basedir&gt;/&lt;basename&gt;.XXXX.&lt;ext&gt;"</code> pattern.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>If the function succeeds, it returns a QString holding the full path of the unique file; otherwise it returns a default-constructed QString. </dd></dl>
2016-12-19 01:57:41 +01:00
</div>
</div>
<a id="file_a09e919d419ded903481cf7aba702dcba"></a>
<h2 class="memtitle"><span class="permalink"><a href="#file_a09e919d419ded903481cf7aba702dcba">&sect;&nbsp;</a></span>natural_string_sort()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void MUtils::natural_string_sort </td>
<td>(</td>
<td class="paramtype">QStringList &amp;&#160;</td>
<td class="paramname"><em>list</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const bool&#160;</td>
<td class="paramname"><em>bIgnoreCase</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Sort a list of strings using "natural ordering" algorithm. </p>
<p>This function implements a sort algorithm that orders alphanumeric strings in the way a human being would. See <a href="http://sourcefrog.net/projects/natsort/"><em>Natural Order String Comparison</em></a> for details!</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">list</td><td>A reference to the QStringList object to be sorted. The list will be sorted "in place". </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="file_a996b60884ddf7728178e94f34ca12570"></a>
<h2 class="memtitle"><span class="permalink"><a href="#file_a996b60884ddf7728178e94f34ca12570">&sect;&nbsp;</a></span>next_rand_str()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">QString MUtils::next_rand_str </td>
<td>(</td>
<td class="paramtype">const bool &amp;&#160;</td>
<td class="paramname"><em>bLong</em> = <code>false</code></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Generates a <em>random</em> string. </p>
<p>The random string is generated using the same PRNG as the <code><a class="el" href="../../d5/d3b/_global_8h.html#a15762bf5b0239e5f67a3815d63ed441a" title="Generates a random unsigned 64-Bit value. ">next_rand_u64()</a></code> function. The <em>random</em> bytes are converted to a hexadecimal string and, if necessary, zero-padded to a toal length of 16 or 32 characters. There is <b>no</b> <code>0x</code>-prefix included in the result.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">bLong</td><td>If set to <code>true</code>, a "long" random string (32 characters) will be generated; if set to <code>false</code>, a "short" random string (16 characters) is generated.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The function retruns a QString holding a <em>random</em> hexadecimal string </dd></dl>
</div>
</div>
<a id="file_a4dc7dccb81653ae28e0d37a7c2f62112"></a>
<h2 class="memtitle"><span class="permalink"><a href="#file_a4dc7dccb81653ae28e0d37a7c2f62112">&sect;&nbsp;</a></span>next_rand_u32()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">quint32 MUtils::next_rand_u32 </td>
<td>(</td>
<td class="paramtype">void&#160;</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Generates a <em>random</em> unsigned 32-Bit value. </p>
<p>The <em>random</em> value is created using a "strong" PRNG of the underlying system, if possible. Otherwise a fallback PRNG is used. It is <b>not</b> required or useful to call <code>srand()</code> or <code>qsrand()</code> prior to using this function. If necessary, the seeding of the PRNG happen <em>automatically</em> on the first call.</p>
<dl class="section return"><dt>Returns</dt><dd>The function retruns a <em>random</em> unsigned 32-Bit value. </dd></dl>
</div>
</div>
<a id="file_a15762bf5b0239e5f67a3815d63ed441a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#file_a15762bf5b0239e5f67a3815d63ed441a">&sect;&nbsp;</a></span>next_rand_u64()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">quint64 MUtils::next_rand_u64 </td>
<td>(</td>
<td class="paramtype">void&#160;</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Generates a <em>random</em> unsigned 64-Bit value. </p>
<p>The <em>random</em> value is created using a "strong" PRNG of the underlying system, if possible. Otherwise a fallback PRNG is used. It is <b>not</b> required or useful to call <code>srand()</code> or <code>qsrand()</code> prior to using this function. If necessary, the seeding of the PRNG happen <em>automatically</em> on the first call.</p>
<dl class="section return"><dt>Returns</dt><dd>The function retruns a <em>random</em> unsigned 64-Bit value. </dd></dl>
</div>
</div>
<a id="file_ad1bdb5e416839b1f85f6df68e58ae28c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#file_ad1bdb5e416839b1f85f6df68e58ae28c">&sect;&nbsp;</a></span>parity()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool MUtils::parity </td>
<td>(</td>
<td class="paramtype">quint32&#160;</td>
<td class="paramname"><em>value</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Computes the <em>parity</em> of the given unsigned 32-Bit value. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">value</td><td>The 32-Bit unsigned value from which the parity is to be computed.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The function returns <code>true</code>, if the number of <b>1</b> bits in the given value is <em>odd</em>; it returns <code>false</code>, if the number of <b>1</b> bits in the given value is <em>even</em>. </dd></dl>
2016-12-19 01:57:41 +01:00
</div>
</div>
<a id="file_ac7d2c9bd5c49230b2fed72e3410c3f7d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#file_ac7d2c9bd5c49230b2fed72e3410c3f7d">&sect;&nbsp;</a></span>remove_directory()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool MUtils::remove_directory </td>
<td>(</td>
<td class="paramtype">const QString &amp;&#160;</td>
<td class="paramname"><em>folderPath</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const bool &amp;&#160;</td>
<td class="paramname"><em>recursive</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Recursively deletes the specified directory. </p>
<p>The function deletes the specified directory. In <em>recusive</em> mode, the directory will be removed including all of its files and sub-directories. Files are deleted using the <code><a class="el" href="../../d5/d3b/_global_8h.html#a12259acdd6aff74ee83819d3aebd8ba9" title="Deletes the specified file. ">remove_file()</a></code> function.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">folderPath</td><td>The path to the directory to be deleted. This should be a full path.</td></tr>
<tr><td class="paramname">recursive</td><td>If set to <code>true</code> the function removes all files and sub-directories in the specified directory; if set to <code>false</code>, the function will <em>not</em> try to delete any files or sub-directories, which means that it will fail on non-empty directories.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The function returns <code>true</code>, if the directory was deleted successfully or if the directory doesn't exist; it returns <code>false</code>, if the directory could <em>not</em> be deleted. </dd></dl>
</div>
</div>
<a id="file_a12259acdd6aff74ee83819d3aebd8ba9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#file_a12259acdd6aff74ee83819d3aebd8ba9">&sect;&nbsp;</a></span>remove_file()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool MUtils::remove_file </td>
<td>(</td>
<td class="paramtype">const QString &amp;&#160;</td>
<td class="paramname"><em>fileName</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Deletes the specified file. </p>
<p>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.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">fileName</td><td>The path to the file to be deleted. This should be a full path.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The function returns <code>true</code>, if the file was deleted successfully or if the file doesn't exist; it returns <code>false</code>, if the file could <em>not</em> be deleted. </dd></dl>
</div>
</div>
<a id="file_a9ddb9a2039585b1ef3429db16ea84292"></a>
<h2 class="memtitle"><span class="permalink"><a href="#file_a9ddb9a2039585b1ef3429db16ea84292">&sect;&nbsp;</a></span>temp_folder()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const QString&amp; MUtils::temp_folder </td>
<td>(</td>
<td class="paramtype">void&#160;</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Rerieves the full path of the application's <em>Temp</em> folder. </p>
2016-12-19 01:57:41 +01:00
<p>The application's <em>Temp</em> 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 <em>Temp</em> folder will be created as a sub-folder of the system's global <em>Temp</em> folder, as indicated by the <code>TMP</code> or <code>TEMP</code> environment variables. However, it may be created at a different place (e.g. in the users <em>Profile</em> directory), if those environment variables don't point to a usable directory. In any case, this function makes sure that the application's <em>Temp</em> folder exists for the whole lifetime of the application and that it is writable. When the application is about to terminate, the application's <em>Temp</em> folder and all files or sub-directories thereof will be <em>removed</em> automatically!</p>
<dl class="section return"><dt>Returns</dt><dd>If the function succeeds, it returns a read-only reference to a QString holding the full path of the application's <em>Temp</em> folder; otherwise a read-only reference to a default-constructed QString is returned. </dd></dl>
2016-12-19 01:57:41 +01:00
</div>
</div>
<a id="file_af089c8a40b6ec2e19db3fe612aa81c8c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#file_af089c8a40b6ec2e19db3fe612aa81c8c">&sect;&nbsp;</a></span>trim_left() <span class="overload">[1/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">QString&amp; MUtils::trim_left </td>
<td>(</td>
<td class="paramtype">QString &amp;&#160;</td>
<td class="paramname"><em>str</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Remove <em>leading</em> white-space characters. </p>
<p>The function removes all <em>leading</em> white-space characters from the specified string. Trailing white-space characters are <em>not</em> removed. White-space characters are defined by the <code>\s</code> character class.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">str</td><td>A reference to the QString object to be trimmed. This QString object will be modified directly.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A reference to the trimmed QString object. This is the same QString object that was specified in the <code>str</code> parameter. </dd></dl>
</div>
</div>
<a id="file_a8680aeaeb1118353bd099e26ba7d6123"></a>
<h2 class="memtitle"><span class="permalink"><a href="#file_a8680aeaeb1118353bd099e26ba7d6123">&sect;&nbsp;</a></span>trim_left() <span class="overload">[2/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">QString MUtils::trim_left </td>
<td>(</td>
<td class="paramtype">const QString &amp;&#160;</td>
<td class="paramname"><em>str</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Remove <em>trailing</em> white-space characters. </p>
<p>The function removes all <em>leading</em> white-space characters from the specified string. Trailing white-space characters are <em>not</em> removed. White-space characters are defined by the <code>\s</code> character class.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">str</td><td>A read-only reference to the QString object to be trimmed. The original QString object is <em>not</em> modified.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A new QString object that equals the original QString object, except that it has all <em>leading</em> white-space characters removed. </dd></dl>
</div>
</div>
<a id="file_a9290a3fe637a05ad2a7515f36fad79bd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#file_a9290a3fe637a05ad2a7515f36fad79bd">&sect;&nbsp;</a></span>trim_right() <span class="overload">[1/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">QString&amp; MUtils::trim_right </td>
<td>(</td>
<td class="paramtype">QString &amp;&#160;</td>
<td class="paramname"><em>str</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Remove <em>trailing</em> white-space characters. </p>
<p>The function removes all <em>trailing</em> white-space characters from the specified string. Leading white-space characters are <em>not</em> removed. White-space characters are defined by the <code>\s</code> character class.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">str</td><td>A reference to the QString object to be trimmed. This QString object will be modified directly.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A reference to the trimmed QString object. This is the same QString object that was specified in the <code>str</code> parameter. </dd></dl>
</div>
</div>
<a id="file_a3eb47d6ca49b2700622e3fe99faf14d8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#file_a3eb47d6ca49b2700622e3fe99faf14d8">&sect;&nbsp;</a></span>trim_right() <span class="overload">[2/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">QString MUtils::trim_right </td>
<td>(</td>
<td class="paramtype">const QString &amp;&#160;</td>
<td class="paramname"><em>str</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Remove <em>trailing</em> white-space characters. </p>
<p>The function removes all <em>trailing</em> white-space characters from the specified string. Leading white-space characters are <em>not</em> removed. White-space characters are defined by the <code>\s</code> character class.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">str</td><td>A read-only reference to the QString object to be trimmed. The original QString object is <em>not</em> modified.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A new QString object that equals the original QString object, except that it has all <em>trailing</em> white-space characters removed. </dd></dl>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
2016-12-19 02:43:38 +01:00
Generated on Mon Dec 19 2016 02:43:14 for MuldeR&#39;s Utilities for Qt by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="../../doxygen.png" alt="doxygen"/>
</a> 1.8.12
</small></address>
</body>
</html>