-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
169 lines (163 loc) · 11.6 KB
/
index.html
File metadata and controls
169 lines (163 loc) · 11.6 KB
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
<!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.14.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>cpp-strings: Library cpp-string</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>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.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">cpp-strings<span id="projectnumber"> 1.0.0</span>
</div>
<div id="projectbrief">Pythonic c++ strings</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.14.0 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search/",'.html');
</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',true);
$(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(function(){initNavTree('index.html','',''); });
</script>
<div id="container">
<div id="doc-content">
<!-- 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">Library cpp-string </div></div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p><a class="anchor" id="md__e_1_2_git_hub_2pythonic-cpp-strings_2_r_e_a_d_m_e"></a></p>
<p><a href="https://github.com/schmouk/cpprandlib/license"><img src="http://img.shields.io/github/license/schmouk/cpp-strings.svg?style=plastic&labelColor=blueviolet&color=lightblue" alt="license" style="pointer-events: none;" class="inline"/></a> <a href="https://github.com/schmouk/cpprandlib/releases"><img src="http://img.shields.io/github/release/schmouk/cpp-strings.svg?style=plastic&labelColor=blueviolet&color=success" alt="Latest release" style="pointer-events: none;" class="inline"/></a> <img src="https://img.shields.io/badge/code_coverage-100%25-success?style=plastic&labelColor=blueviolet" alt="code_coverage" class="inline"/> <img src="https://img.shields.io/badge/tests-passing-success?style=plastic&labelColor=blueviolet" alt="tests" class="inline"/></p>
<p>What if c++ strings where as easy to use as Python strings?</p>
<p>Let's just use c++ strings as are Python ones, with same API or as similar API as possible. <br />
Library <b>cpp-strings</b> is fully templated. Just download header file <span class="tt">cppstrings.h</span> and put it anywhere in your project. Notice: all of its stuff is declared and defined in namespace <span class="tt">pcs</span> - which stands for <b>P**ythonic **C</b>++ **S**trings.</p>
<ul>
<li>The templated class <span class="tt">pcs::CppStringT<></span> defines all constructors and methods that implement the equivalent of Python strings API. <br />
</li>
<li>Class <span class="tt">pcs::CppString</span> specializes the templated class with <span class="tt">char</span> characters.</li>
<li>Class <span class="tt">pcs::CppWString</span> specializes the templated class with <span class="tt">wchar_t</span> characters.</li>
</ul>
<p><b>cpp-strings</b> is implemented with the currently most recent c++ standard available with gcc, clang and msvc c++ compilers, i.e. standard <b>c++20</b>.</p>
<ul>
<li>directory <span class="tt">cpp-strings</span> contains the header file <span class="tt">cppstring.h</span>. <br />
This is the header file to include in your projects.</li>
<li>directory <span class="tt">cpp-strings-tests</span> contains the unit test file <span class="tt">cpp-strings-tests.cpp</span> <br />
This file tests all the library stuff. It is a valuable code container with so many examples of use of the library, the classes, the methods and the functions it defines.</li>
</ul>
<p>The code has been developed using VS2022 IDE. As such, unitary tests have been coded using Microsoft Visual Studio Cpp Unit Test Framework. The related VS project is provided with this library.</p>
<p>Notice: no clang, gcc or msvc specific declarations or goodies have been use to code library <b>cpp-strings</b>. It should then be compilable with any of these compilers. To be able to use it with your project, just ensure that the c++ standard used with you favorite compiler is <b>c++20</b>:</p><ul>
<li>options <span class="tt">-std=c++20</span> or <span class="tt">-std=c++latest</span> for clang and gcc (v. 10 and above), <br />
or option <span class="tt">-std=c++2a</span> for clang and gcc (v. 9 and earlier);</li>
<li>options <span class="tt">/std=c++20</span> or <span class="tt">/std=c++latest</span> for Visual Studio 2019 and later.</li>
</ul>
<p>If you want to run the unitary tests, well, use the last version of Visual Studio (i.e. VS 2022, by July 2025). The Community free version will truly be fine. <br />
The vcproject associated with the unit tests in <b>cpp-strings</b> is already configured to use the option flag <span class="tt">/std:c++latest</span> since the implemented code uses a very few but very useful c++23 goodies.</p>
<hr />
<h1 class="doxsection"><a class="anchor" id="autotoc_md2"></a>
License</h1>
<pre class="fragment">Library cpp-strings
"What if c++ strings where as easy to use as Python strings?"
Copyright (C) 2023-2025 Philippe Schmouker
contact - ph (dot) schmouker (at) gmail (dot) com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
</pre><hr />
<h1 class="doxsection"><a class="anchor" id="autotoc_md3"></a>
Intro</h1>
<p>The creation of this library has been started with the aim at easing the use of strings in c++. Other projects exist, even aiming also to implement a Python-like strings API, but the only ones we have found were either started but not completed, or were not implementing the whole Python API.</p>
<p>So, we started to work on <b>Pythonic c++ strings</b>. Library <b>cpp-strings</b> is now ready. It fully implements the Python API (even with a c++ implementation of <em>slices</em>) and it is fully tested with <em>unitary tests</em>.</p>
<p>The implementation of library <b>cpp-strings</b> is fully templated and is contained into a single header file: <span class="tt">cpp-strings/cppstrings.h</span>. To take a whole benefit of it, just add this header file to your project and include it in your own files. It very fastly compiles. That's all!</p>
<p>Header file <span class="tt">cpp-strings/cppstrings.h</span> defines:</p><ul>
<li>templated class <span class="tt">template<typename CharT> class pcs::CppStringT</span> which implements all the stuff about pythonic c++ strings. It inherits from c++ STL class <span class="tt">std::basic_string<CharT></span>, so it gets access to all c++ STL methods, functions and goodies about strings;</li>
<li>this class is specialized by <span class="tt">using pcs::CppString> = pcs::CppStringT<char></span> for pythonic c++ strings based on <span class="tt">char</span> characters;</li>
<li>it is also specialized by <span class="tt">using pcs::CppWString> = pcs::CppStringT<wchar_t></span> for pythonic c++ strings based on <span class="tt">wchar_t</span> characters.</li>
</ul>
<p>The unitary tests are provided in directory <span class="tt">cpp-strings-tests/</span>. File <span class="tt">cpp-strings-tests.cpp</span> contains the related code. They has been coded using VS2022 IDE and as such, are using the Microsoft Visual Studio Cpp Unit Test Framework. The related VS project can be found in the same directory. It is already configured to create code for Release as well as for Debug configurations, and for 32-bits or 64-bits platforms at your choice. <br />
This <span class="tt">.cpp file</span> is a great place to see <b>cpp-strings</b> code in action. Each structure, class, method, litteral operator and function being unitary tested, you should find there many examples of their use for all <b>cpp-strings</b> stuff.</p>
<hr />
<h1 class="doxsection"><a class="anchor" id="autotoc_md5"></a>
Latest Release - Release 1.0 (1.0.0.224) 2025/07</h1>
<p>The coding of this project started by March 2023 and had been put in standby mode for some months. The very first release is now availble (since July 2025), as <b>Release 1.0</b>.</p>
<p>This release has been fully tested. It implements all Python strings API but one feature (see below). Python <em>slices</em> are implemented via c++ <span class="tt">operator()</span> as declared and defined in the templated class <span class="tt">pcs::CppStringT<></span>. Python slices have next specific notation: <span class="tt">[start : stop : step]</span> and allow the running through range [start, stop) (notice: stop is excluded from the range) step by step. Operator <span class="tt">(start, stop, step)</span> acts the same way while running through the content of c++ strings. </p>
</div></div><!-- PageDoc -->
<a href="doxygen_crawl.html"></a>
</div><!-- contents -->
</div><!-- doc-content -->
</div><!-- container -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated on <span class="timestamp"></span> for cpp-strings by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.14.0 </li>
</ul>
</div>
</body>
</html>