-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
246 lines (244 loc) · 17.2 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.10.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>common_util: common_util</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>
<script type="text/javascript" src="clipboard.js"></script>
<script type="text/javascript" src="cookie.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 id="projectrow">
<td id="projectalign">
<div id="projectname">common_util
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.10.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- 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">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div><div class="header">
<div class="headertitle"><div class="title">common_util </div></div>
</div><!--header-->
<div class="contents">
<div class="textblock"><h2><a class="anchor" id="autotoc_md50"></a>
1. Source code</h2>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">Region </th><th class="markdownTableHeadNone">Platform </th><th class="markdownTableHeadNone">Source Code Repository URL </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">Mainland China </td><td class="markdownTableBodyNone">gitcode </td><td class="markdownTableBodyNone"><a href="https://gitcode.com/luoweifu1/common_util">https://gitcode.com/luoweifu1/common_util</a> </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">Mainland China </td><td class="markdownTableBodyNone">Gitee </td><td class="markdownTableBodyNone"><a href="https://gitee.com/spencer_luo/common_util">https://gitee.com/spencer_luo/common_util</a> </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">International </td><td class="markdownTableBodyNone">Github </td><td class="markdownTableBodyNone"><a href="https://github.com/spencer-luo/common_util">https://github.com/spencer-luo/common_util</a> </td></tr>
</table>
<h2><a class="anchor" id="autotoc_md51"></a>
2. Overview</h2>
<p>common_util is a general-purpose C++ utility library, include the following functions:</p>
<ul>
<li>Time utilities</li>
<li>Function timer</li>
<li>Filepath utilities</li>
<li>Filesystem utilities</li>
<li>String utilities</li>
<li>Data formatting</li>
<li>Singleton pattern macro definition</li>
</ul>
<p>common_util is implemented in modern C++ syntax (C++11 and above), using cutl as the namespace. The naming convention of all interfaces is consistent with the STL, and it can be used as an extensions of C++ standard library. You can use common_util just like using the STL, For example:</p>
<div class="fragment"><div class="line"> ++</div>
<div class="line"><span class="comment">// Data formatting</span></div>
<div class="line">std::cout << <span class="stringliteral">"fmt_uint: "</span> << cutl::fmt_uint(12, 5) << std::endl;</div>
<div class="line">std::cout << <span class="stringliteral">"fmt_double: "</span> << cutl::fmt_double(3.141592653, 4) << std::endl;</div>
<div class="line">std::cout << <span class="stringliteral">"fmt_filesize: "</span> << cutl::fmt_filesize(33600) << std::endl;</div>
<div class="line"><span class="comment">// Get the current system time</span></div>
<div class="line"><span class="keyword">auto</span> now = <a class="code hl_function" href="classcutl_1_1datetime.html#a2f26f17577618f7133b62b0343ecca0c">cutl::datetime::now</a>();</div>
<div class="line">std::cout << <span class="stringliteral">"current time(UTC time): "</span> << now.utctime() << std::endl;</div>
<div class="line">std::cout << <span class="stringliteral">"current time(local time): "</span> << now.format() << std::endl;</div>
<div class="ttc" id="aclasscutl_1_1datetime_html_a2f26f17577618f7133b62b0343ecca0c"><div class="ttname"><a href="classcutl_1_1datetime.html#a2f26f17577618f7133b62b0343ecca0c">cutl::datetime::now</a></div><div class="ttdeci">static datetime now()</div><div class="ttdoc">Get a datetime object for the current system time.</div></div>
</div><!-- fragment --><h2><a class="anchor" id="autotoc_md52"></a>
3. Library Features</h2>
<ul>
<li><b>Simple and lightweigh</b>: Based on basic C++ syntax and STL, it independent on any third-party libraries.</li>
<li><b>Multi-platform support</b>: Supports multiple platforms such as Linux/macOS/Windows, it can be compiled and run on multiple platforms.</li>
<li><b>Clean code</b>: The code style is clean, and the naming convention is consistent with the STL, you can use this library just like use the C++ standard library.</li>
<li><b>Comprehensive documentation</b>: All exported header files have detail comments, it has complete API reference and usage demos.</li>
<li><b>C++ version requirement</b>: C++11 and above versions.</li>
</ul>
<h2><a class="anchor" id="autotoc_md53"></a>
4. Testing Platforms</h2>
<p>This library has been tested and verified on the following platforms:</p>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">Operating System Platform and Version </th><th class="markdownTableHeadNone">C++ Compiler and Version </th><th class="markdownTableHeadNone">Testing Status </th><th class="markdownTableHeadNone">Remarks </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">Windows 10 </td><td class="markdownTableBodyNone">Visual Studio 2015 </td><td class="markdownTableBodyNone">tested </td><td class="markdownTableBodyNone"></td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">Ubuntu 20.04.4 </td><td class="markdownTableBodyNone">GNU GCC 9.4.0 </td><td class="markdownTableBodyNone">tested </td><td class="markdownTableBodyNone"></td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">macOS xxx </td><td class="markdownTableBodyNone">Clang version 15.0.0 </td><td class="markdownTableBodyNone">tested </td><td class="markdownTableBodyNone"></td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">Android </td><td class="markdownTableBodyNone"></td><td class="markdownTableBodyNone">To be tested </td><td class="markdownTableBodyNone"></td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">iOS </td><td class="markdownTableBodyNone"></td><td class="markdownTableBodyNone">To be tested </td><td class="markdownTableBodyNone"></td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">HarmonyOS </td><td class="markdownTableBodyNone"></td><td class="markdownTableBodyNone">To be tested </td><td class="markdownTableBodyNone"></td></tr>
</table>
<h2><a class="anchor" id="autotoc_md54"></a>
5. Related Documents</h2>
<ul>
<li>off-line: <a href="./docs/reference/html/index.html">docs/reference/html/index.html</a></li>
<li>on line : <a href="http://sunlogging.com/docs/common_util/">http://sunlogging.com/docs/common_util/</a></li>
</ul>
<h2><a class="anchor" id="autotoc_md55"></a>
6. Welcome to Collaborate</h2>
<p>We welcome all developers who are interested in this project to join us, whether you are an experienced senior developer or a newcomer just starting out, we look forward to your participation. You can get involved in the project in the following ways:</p>
<ul>
<li><b>Code Contribution:</b> You can fork our code repository, conduct code development, and submit your code via a pull request.</li>
<li><b>Issue Feedback:</b> If you encounter any problems during use or have any suggestions, feel free to raise them in the issue section.</li>
<li><b>Documentation Writing:</b> We welcome you to write documentation for the project, helping other developers better understand and use our project.</li>
<li><b>Testing and Feedback:</b> You can assist us in code testing and provide valuable feedback.</li>
</ul>
<p>If you have any questions or need help, please feel free to contact me through the following methods:</p>
<p>Email: [<a href="#" onclick="location.href='mai'+'lto:'+'spe'+'nc'+'er.'+'lu'+'o@f'+'ox'+'mai'+'l.'+'com'; return false;">spenc<span class="obfuscator">.nosp@m.</span>er.l<span class="obfuscator">.nosp@m.</span>uo@fo<span class="obfuscator">.nosp@m.</span>xmai<span class="obfuscator">.nosp@m.</span>l.com</a>]</p>
<p>Looking forward to your participation!</p>
<h2><a class="anchor" id="autotoc_md56"></a>
7. 源码仓库</h2>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">地区 </th><th class="markdownTableHeadNone">代码托管平台 </th><th class="markdownTableHeadNone">源码仓库地址 </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">中国大陆 </td><td class="markdownTableBodyNone">gitcode </td><td class="markdownTableBodyNone"><a href="https://gitcode.com/luoweifu1/common_util">https://gitcode.com/luoweifu1/common_util</a> </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">中国大陆 </td><td class="markdownTableBodyNone">Gitee </td><td class="markdownTableBodyNone"><a href="https://gitee.com/spencer_luo/common_util">https://gitee.com/spencer_luo/common_util</a> </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">国际站点 </td><td class="markdownTableBodyNone">Github </td><td class="markdownTableBodyNone"><a href="https://github.com/spencer-luo/common_util">https://github.com/spencer-luo/common_util</a> </td></tr>
</table>
<h2><a class="anchor" id="autotoc_md57"></a>
8. 概述</h2>
<p>common_util是C++的一个通用工具库,主要包含以下功能:</p>
<ul>
<li>时间处理</li>
<li>函数计时器</li>
<li>路径处理</li>
<li>文件操作</li>
<li>字符串处理</li>
<li>数据格式化</li>
<li>单例模式宏定义</li>
</ul>
<p>common_util采用现代C++语法(C++11及以上)实现,使用cutl作为命名空间,所有接口的命名方式与STL保持一致,可以作为STL库的一个补充。你可以像使用STL一样使用common_util,如:</p>
<div class="fragment"><div class="line"> ++</div>
<div class="line"><span class="comment">// 数据格式化</span></div>
<div class="line">std::cout << <span class="stringliteral">"fmt_uint: "</span> << cutl::fmt_uint(12, 5) << std::endl;</div>
<div class="line">std::cout << <span class="stringliteral">"fmt_double: "</span> << cutl::fmt_double(3.141592653, 4) << std::endl;</div>
<div class="line">std::cout << <span class="stringliteral">"fmt_filesize: "</span> << cutl::fmt_filesize(33600) << std::endl;</div>
<div class="line"><span class="comment">// 获取系统当前时间</span></div>
<div class="line"><span class="keyword">auto</span> now = <a class="code hl_function" href="classcutl_1_1datetime.html#a2f26f17577618f7133b62b0343ecca0c">cutl::datetime::now</a>();</div>
<div class="line">std::cout << <span class="stringliteral">"current time(UTC time): "</span> << now.utctime() << std::endl;</div>
<div class="line">std::cout << <span class="stringliteral">"current time(local time): "</span> << now.format() << std::endl;</div>
</div><!-- fragment --><h2><a class="anchor" id="autotoc_md58"></a>
9. 设计特点</h2>
<ul>
<li>**轻量极简**: 基于基础C++语法和STL,不依赖任何第三方库。</li>
<li>**多平台支持**: 支持Linux/OS-X/Windows等多个平台,一套代码多平台编译。</li>
<li>**代码整洁**: 代码风格整洁,命名方式与STL保持一致,你可以像使用STL一样使用本库。</li>
<li>**文档规范全面**: 所有对外接口的头文件都有详细的代码注释,且有完整的API文档和使用Demo,可供查阅。</li>
<li>**C++版本要求**: C++11及以上版本。</li>
</ul>
<h2><a class="anchor" id="autotoc_md59"></a>
10. 已验证的平台</h2>
<p>本库在以下平台上测试验证过:</p>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">操作系统平台及版本 </th><th class="markdownTableHeadNone">C++编译器及版本 </th><th class="markdownTableHeadNone">验证状态 </th><th class="markdownTableHeadNone">备注 </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">Windows 10 </td><td class="markdownTableBodyNone">Visual Studio 2015 </td><td class="markdownTableBodyNone">已验证 </td><td class="markdownTableBodyNone"></td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">Ubuntu 20.04.4 </td><td class="markdownTableBodyNone">GNU GCC 9.4.0 </td><td class="markdownTableBodyNone">已验证 </td><td class="markdownTableBodyNone"></td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">macOS xxx </td><td class="markdownTableBodyNone">Clang version 15.0.0 </td><td class="markdownTableBodyNone">已验证 </td><td class="markdownTableBodyNone"></td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">Android </td><td class="markdownTableBodyNone"></td><td class="markdownTableBodyNone">待验证 </td><td class="markdownTableBodyNone"></td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">iOS </td><td class="markdownTableBodyNone"></td><td class="markdownTableBodyNone">待验证 </td><td class="markdownTableBodyNone"></td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">HarmonyOS </td><td class="markdownTableBodyNone"></td><td class="markdownTableBodyNone">待验证 </td><td class="markdownTableBodyNone"></td></tr>
</table>
<h2><a class="anchor" id="autotoc_md60"></a>
11. 相关文档</h2>
<ul>
<li>离线文档: <a href="./docs/reference/html/index.html">docs/reference/html/index.html</a></li>
<li>在线文档: <a href="http://sunlogging.com/docs/common_util/">http://sunlogging.com/docs/common_util/</a></li>
</ul>
<h2><a class="anchor" id="autotoc_md61"></a>
12. 欢迎共建</h2>
<p>我们欢迎所有对此项目感兴趣的开发者加入我们,无论您是经验丰富的资深开发者,还是刚刚入门的新手,我们都期待您的参与。您可以通过以下方式参与到项目中:</p>
<ul>
<li><b>代码贡献:</b> 您可以 fork 我们的代码仓库,进行代码开发,并通过 pull request 提交您的代码。</li>
<li><b>问题反馈:</b> 如果您在使用过程中遇到任何问题或有任何建议,欢迎在 issue 区提出。</li>
<li><b>文档编写:</b> 我们欢迎您为项目编写文档,帮助其他开发者更好地理解和使用我们的项目。</li>
<li><b>测试与反馈:</b> 您可以帮助我们进行代码测试,并提供宝贵的反馈意见。</li>
</ul>
<p>如果您有任何疑问或需要帮助,欢迎通过以下方式联系我:</p>
<p>邮箱:[<a href="#" onclick="location.href='mai'+'lto:'+'spe'+'nc'+'er.'+'lu'+'o@f'+'ox'+'mai'+'l.'+'com'; return false;">spenc<span class="obfuscator">.nosp@m.</span>er.l<span class="obfuscator">.nosp@m.</span>uo@fo<span class="obfuscator">.nosp@m.</span>xmai<span class="obfuscator">.nosp@m.</span>l.com</a>]</p>
<p>期待你的参与! </p>
</div></div><!-- PageDoc -->
<a href="doxygen_crawl.html"/>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.10.0
</small></address>
</body>
</html>