PyPartMC 2.1.2__cp315-cp315-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- PyPartMC/_PyPartMC.pyd +0 -0
- PyPartMC/__generate_si.py +37 -0
- PyPartMC/__init__.py +78 -0
- PyPartMC/cmake/PyPartMCConfig.cmake +65 -0
- PyPartMC/include/PyPartMC/aero_binned.hpp +117 -0
- PyPartMC/include/PyPartMC/aero_data.hpp +283 -0
- PyPartMC/include/PyPartMC/aero_dist.hpp +85 -0
- PyPartMC/include/PyPartMC/aero_mode.hpp +359 -0
- PyPartMC/include/PyPartMC/aero_particle.hpp +275 -0
- PyPartMC/include/PyPartMC/aero_state.hpp +664 -0
- PyPartMC/include/PyPartMC/bin_grid.hpp +143 -0
- PyPartMC/include/PyPartMC/camp_core.hpp +31 -0
- PyPartMC/include/PyPartMC/condense.hpp +35 -0
- PyPartMC/include/PyPartMC/env_state.hpp +161 -0
- PyPartMC/include/PyPartMC/gas_data.hpp +105 -0
- PyPartMC/include/PyPartMC/gas_state.hpp +129 -0
- PyPartMC/include/PyPartMC/getters.hpp +55 -0
- PyPartMC/include/PyPartMC/input_guard.hpp +155 -0
- PyPartMC/include/PyPartMC/json_resource.hpp +363 -0
- PyPartMC/include/PyPartMC/output.hpp +96 -0
- PyPartMC/include/PyPartMC/photolysis.hpp +29 -0
- PyPartMC/include/PyPartMC/pmc_resource.hpp +42 -0
- PyPartMC/include/PyPartMC/rand.hpp +12 -0
- PyPartMC/include/PyPartMC/run_exact.hpp +34 -0
- PyPartMC/include/PyPartMC/run_exact_opt.hpp +46 -0
- PyPartMC/include/PyPartMC/run_part.hpp +110 -0
- PyPartMC/include/PyPartMC/run_part_opt.hpp +72 -0
- PyPartMC/include/PyPartMC/run_sect.hpp +34 -0
- PyPartMC/include/PyPartMC/run_sect_opt.hpp +54 -0
- PyPartMC/include/PyPartMC/scenario.hpp +220 -0
- PyPartMC/include/PyPartMC/si.hpp +118 -0
- PyPartMC/include/PyPartMC/util.hpp +22 -0
- PyPartMC/include/PyPartMC.hpp +28 -0
- PyPartMC/include/aero_data_parameters.hpp +27 -0
- PyPartMC/include/bpstd/detail/string_view.inl +925 -0
- PyPartMC/include/bpstd/string_view.hpp +498 -0
- PyPartMC/include/gas_data_parameters.hpp +14 -0
- PyPartMC/include/nanobind_json/nanobind_json.h +226 -0
- PyPartMC/include/nlohmann/adl_serializer.hpp +55 -0
- PyPartMC/include/nlohmann/byte_container_with_subtype.hpp +103 -0
- PyPartMC/include/nlohmann/detail/abi_macros.hpp +100 -0
- PyPartMC/include/nlohmann/detail/conversions/from_json.hpp +497 -0
- PyPartMC/include/nlohmann/detail/conversions/to_chars.hpp +1118 -0
- PyPartMC/include/nlohmann/detail/conversions/to_json.hpp +446 -0
- PyPartMC/include/nlohmann/detail/exceptions.hpp +257 -0
- PyPartMC/include/nlohmann/detail/hash.hpp +129 -0
- PyPartMC/include/nlohmann/detail/input/binary_reader.hpp +3009 -0
- PyPartMC/include/nlohmann/detail/input/input_adapters.hpp +492 -0
- PyPartMC/include/nlohmann/detail/input/json_sax.hpp +727 -0
- PyPartMC/include/nlohmann/detail/input/lexer.hpp +1633 -0
- PyPartMC/include/nlohmann/detail/input/parser.hpp +519 -0
- PyPartMC/include/nlohmann/detail/input/position_t.hpp +37 -0
- PyPartMC/include/nlohmann/detail/iterators/internal_iterator.hpp +35 -0
- PyPartMC/include/nlohmann/detail/iterators/iter_impl.hpp +751 -0
- PyPartMC/include/nlohmann/detail/iterators/iteration_proxy.hpp +242 -0
- PyPartMC/include/nlohmann/detail/iterators/iterator_traits.hpp +61 -0
- PyPartMC/include/nlohmann/detail/iterators/json_reverse_iterator.hpp +130 -0
- PyPartMC/include/nlohmann/detail/iterators/primitive_iterator.hpp +132 -0
- PyPartMC/include/nlohmann/detail/json_custom_base_class.hpp +39 -0
- PyPartMC/include/nlohmann/detail/json_pointer.hpp +988 -0
- PyPartMC/include/nlohmann/detail/json_ref.hpp +78 -0
- PyPartMC/include/nlohmann/detail/macro_scope.hpp +482 -0
- PyPartMC/include/nlohmann/detail/macro_unscope.hpp +45 -0
- PyPartMC/include/nlohmann/detail/meta/call_std/begin.hpp +17 -0
- PyPartMC/include/nlohmann/detail/meta/call_std/end.hpp +17 -0
- PyPartMC/include/nlohmann/detail/meta/cpp_future.hpp +171 -0
- PyPartMC/include/nlohmann/detail/meta/detected.hpp +70 -0
- PyPartMC/include/nlohmann/detail/meta/identity_tag.hpp +21 -0
- PyPartMC/include/nlohmann/detail/meta/is_sax.hpp +159 -0
- PyPartMC/include/nlohmann/detail/meta/std_fs.hpp +29 -0
- PyPartMC/include/nlohmann/detail/meta/type_traits.hpp +795 -0
- PyPartMC/include/nlohmann/detail/meta/void_t.hpp +24 -0
- PyPartMC/include/nlohmann/detail/output/binary_writer.hpp +1838 -0
- PyPartMC/include/nlohmann/detail/output/output_adapters.hpp +147 -0
- PyPartMC/include/nlohmann/detail/output/serializer.hpp +988 -0
- PyPartMC/include/nlohmann/detail/string_concat.hpp +146 -0
- PyPartMC/include/nlohmann/detail/string_escape.hpp +72 -0
- PyPartMC/include/nlohmann/detail/value_t.hpp +118 -0
- PyPartMC/include/nlohmann/json.hpp +5258 -0
- PyPartMC/include/nlohmann/json_fwd.hpp +75 -0
- PyPartMC/include/nlohmann/ordered_map.hpp +359 -0
- PyPartMC/include/nlohmann/thirdparty/hedley/hedley.hpp +2045 -0
- PyPartMC/include/nlohmann/thirdparty/hedley/hedley_undef.hpp +158 -0
- PyPartMC/include/output_parameters.hpp +25 -0
- PyPartMC/include/tcb/span.hpp +617 -0
- PyPartMC/include/tl/optional.hpp +2062 -0
- PyPartMC/lib/libpartmclib.a +0 -0
- pypartmc-2.1.2.dist-info/METADATA +494 -0
- pypartmc-2.1.2.dist-info/RECORD +91 -0
- pypartmc-2.1.2.dist-info/WHEEL +5 -0
- pypartmc-2.1.2.dist-info/licenses/LICENSE +674 -0
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* \file string_view.hpp
|
|
3
|
+
*
|
|
4
|
+
* \brief This header contains the definition of the string_view type, as
|
|
5
|
+
* described by the C++17 standard.
|
|
6
|
+
*
|
|
7
|
+
* \author Matthew Rodusek (matthew.rodusek@gmail.com)
|
|
8
|
+
* \copyright Matthew Rodusek
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/*
|
|
12
|
+
* The MIT License (MIT)
|
|
13
|
+
*
|
|
14
|
+
* Licensed under the MIT License <http://opensource.org/licenses/MIT>.
|
|
15
|
+
* Copyright (c) 2016 Matthew Rodusek <http://rodusek.me>
|
|
16
|
+
*
|
|
17
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
18
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
19
|
+
* in the Software without restriction, including without limitation the rights
|
|
20
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
21
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
22
|
+
* furnished to do so, subject to the following conditions:
|
|
23
|
+
*
|
|
24
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
25
|
+
* copies or substantial portions of the Software.
|
|
26
|
+
*
|
|
27
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
28
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
29
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
30
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
31
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
32
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
|
+
* SOFTWARE.
|
|
34
|
+
*/
|
|
35
|
+
#ifndef BPSTD_STRING_VIEW_HPP
|
|
36
|
+
#define BPSTD_STRING_VIEW_HPP
|
|
37
|
+
|
|
38
|
+
#include <algorithm> // std::
|
|
39
|
+
#include <string> // std::char_traits
|
|
40
|
+
#include <ostream> // std::basic_ostream
|
|
41
|
+
#include <cstddef> // std::size_t
|
|
42
|
+
#include <memory> // std::allocator
|
|
43
|
+
#include <stdexcept> // std::out_of_range
|
|
44
|
+
#include <iterator> // std::reverse_iterator
|
|
45
|
+
namespace bpstd { // back-port std
|
|
46
|
+
|
|
47
|
+
////////////////////////////////////////////////////////////////////////////
|
|
48
|
+
/// \brief A wrapper around non-owned strings.
|
|
49
|
+
///
|
|
50
|
+
/// This is an implementation of the C++17 string_view proposal
|
|
51
|
+
///
|
|
52
|
+
/// \ingroup core
|
|
53
|
+
////////////////////////////////////////////////////////////////////////////
|
|
54
|
+
template<
|
|
55
|
+
typename CharT,
|
|
56
|
+
typename Traits = std::char_traits<CharT>
|
|
57
|
+
>
|
|
58
|
+
class basic_string_view final
|
|
59
|
+
{
|
|
60
|
+
//------------------------------------------------------------------------
|
|
61
|
+
// Public Member Types
|
|
62
|
+
//------------------------------------------------------------------------
|
|
63
|
+
public:
|
|
64
|
+
|
|
65
|
+
using char_type = CharT;
|
|
66
|
+
using traits_type = Traits;
|
|
67
|
+
using size_type = std::size_t;
|
|
68
|
+
|
|
69
|
+
using value_type = CharT;
|
|
70
|
+
using reference = value_type&;
|
|
71
|
+
using const_reference = const value_type&;
|
|
72
|
+
using pointer = value_type*;
|
|
73
|
+
using const_pointer = const value_type*;
|
|
74
|
+
|
|
75
|
+
using iterator = const CharT*;
|
|
76
|
+
using const_iterator = const CharT*;
|
|
77
|
+
using reverse_iterator = std::reverse_iterator<iterator>;
|
|
78
|
+
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
|
79
|
+
|
|
80
|
+
//------------------------------------------------------------------------
|
|
81
|
+
// Public Members
|
|
82
|
+
//------------------------------------------------------------------------
|
|
83
|
+
public:
|
|
84
|
+
|
|
85
|
+
static constexpr size_type npos = size_type(-1);
|
|
86
|
+
|
|
87
|
+
//------------------------------------------------------------------------
|
|
88
|
+
// Constructors
|
|
89
|
+
//------------------------------------------------------------------------
|
|
90
|
+
public:
|
|
91
|
+
|
|
92
|
+
/// \brief Default constructs a basic_string_view without any content
|
|
93
|
+
constexpr basic_string_view() noexcept;
|
|
94
|
+
|
|
95
|
+
/// \brief Constructs a basic_string_view by copying another one
|
|
96
|
+
///
|
|
97
|
+
/// \param other the string view being copied
|
|
98
|
+
constexpr basic_string_view(const basic_string_view& other) noexcept = default;
|
|
99
|
+
|
|
100
|
+
/// \brief Constructs a basic_string_view by moving anothe rone
|
|
101
|
+
///
|
|
102
|
+
/// \param other the string view being moved
|
|
103
|
+
constexpr basic_string_view(basic_string_view&& other) noexcept = default;
|
|
104
|
+
|
|
105
|
+
/// \brief Constructs a basic_string_view from a std::basic_string
|
|
106
|
+
///
|
|
107
|
+
/// \param str the string to view
|
|
108
|
+
template<typename Allocator>
|
|
109
|
+
basic_string_view(const std::basic_string<CharT,Traits,Allocator>& str) noexcept;
|
|
110
|
+
|
|
111
|
+
/// \brief Constructs a basic_string_view from an ansi-string
|
|
112
|
+
///
|
|
113
|
+
/// \param str the string to view
|
|
114
|
+
constexpr basic_string_view(const char_type* str) noexcept;
|
|
115
|
+
|
|
116
|
+
/// \brief Constructs a basic_string_view from an ansi string of a given size
|
|
117
|
+
///
|
|
118
|
+
/// \param str the string to view
|
|
119
|
+
/// \param count the size of the string
|
|
120
|
+
constexpr basic_string_view(const char_type* str, size_type count) noexcept;
|
|
121
|
+
|
|
122
|
+
//------------------------------------------------------------------------
|
|
123
|
+
// Assignment
|
|
124
|
+
//------------------------------------------------------------------------
|
|
125
|
+
public:
|
|
126
|
+
|
|
127
|
+
/// \brief Assigns a basic_string_view from an ansi-string
|
|
128
|
+
///
|
|
129
|
+
/// \param view the string to view
|
|
130
|
+
/// \return reference to \c (*this)
|
|
131
|
+
basic_string_view& operator=(const basic_string_view& view) = default;
|
|
132
|
+
|
|
133
|
+
//------------------------------------------------------------------------
|
|
134
|
+
// Capacity
|
|
135
|
+
//------------------------------------------------------------------------
|
|
136
|
+
public:
|
|
137
|
+
|
|
138
|
+
/// \brief Returns the length of the string, in terms of bytes
|
|
139
|
+
///
|
|
140
|
+
/// \return the length of the string, in terms of bytes
|
|
141
|
+
constexpr size_type size() const noexcept;
|
|
142
|
+
|
|
143
|
+
/// \copydoc basic_string_view::size
|
|
144
|
+
constexpr size_type length() const noexcept;
|
|
145
|
+
|
|
146
|
+
/// \brief The largest possible number of char-like objects that can be
|
|
147
|
+
/// referred to by a basic_string_view.
|
|
148
|
+
/// \return Maximum number of characters
|
|
149
|
+
constexpr size_type max_size() const noexcept;
|
|
150
|
+
|
|
151
|
+
/// \brief Returns whether the basic_string_view is empty
|
|
152
|
+
/// (i.e. whether its length is 0).
|
|
153
|
+
///
|
|
154
|
+
/// \return whether the basic_string_view is empty
|
|
155
|
+
constexpr bool empty() const noexcept;
|
|
156
|
+
|
|
157
|
+
//------------------------------------------------------------------------
|
|
158
|
+
// Element Access
|
|
159
|
+
//------------------------------------------------------------------------
|
|
160
|
+
public:
|
|
161
|
+
|
|
162
|
+
/// \brief Gets the ansi-string of the current basic_string_view
|
|
163
|
+
///
|
|
164
|
+
/// \return the ansi-string pointer
|
|
165
|
+
constexpr const char_type* c_str() const noexcept;
|
|
166
|
+
|
|
167
|
+
/// \brief Gets the data of the current basic_string_view
|
|
168
|
+
///
|
|
169
|
+
/// \note This is an alias of #c_str
|
|
170
|
+
///
|
|
171
|
+
/// \return the data this basic_string_view contains
|
|
172
|
+
constexpr const char_type* data() const noexcept;
|
|
173
|
+
|
|
174
|
+
/// \brief Accesses the element at index \p pos
|
|
175
|
+
///
|
|
176
|
+
/// \param pos the index to access
|
|
177
|
+
/// \return const reference to the character
|
|
178
|
+
constexpr const_reference operator[](size_type pos) const noexcept;
|
|
179
|
+
|
|
180
|
+
/// \brief Accesses the element at index \p pos
|
|
181
|
+
///
|
|
182
|
+
/// \param pos the index to access
|
|
183
|
+
/// \return const reference to the character
|
|
184
|
+
constexpr const_reference at(size_type pos) const;
|
|
185
|
+
|
|
186
|
+
/// \brief Access the first character of the string
|
|
187
|
+
///
|
|
188
|
+
/// \note Undefined behavior if basic_string_view is empty
|
|
189
|
+
///
|
|
190
|
+
/// \return reference to the first character of the string
|
|
191
|
+
constexpr const_reference front() const noexcept;
|
|
192
|
+
|
|
193
|
+
/// \brief References the last character of the string
|
|
194
|
+
///
|
|
195
|
+
/// \note Undefined behavior if basic_string_view is empty
|
|
196
|
+
///
|
|
197
|
+
/// \return reference to the last character of the string
|
|
198
|
+
constexpr const_reference back() const noexcept;
|
|
199
|
+
|
|
200
|
+
//------------------------------------------------------------------------
|
|
201
|
+
// Modifiers
|
|
202
|
+
//------------------------------------------------------------------------
|
|
203
|
+
public:
|
|
204
|
+
|
|
205
|
+
/// \brief Moves the start of the view forward by n characters.
|
|
206
|
+
///
|
|
207
|
+
/// The behavior is undefined if n > size().
|
|
208
|
+
///
|
|
209
|
+
/// \param n number of characters to remove from the start of the view
|
|
210
|
+
void remove_prefix(size_type n) noexcept;
|
|
211
|
+
|
|
212
|
+
/// \brief Moves the end of the view back by n characters.
|
|
213
|
+
///
|
|
214
|
+
/// The behavior is undefined if n > size().
|
|
215
|
+
///
|
|
216
|
+
/// \param n number of characters to remove from the end of the view
|
|
217
|
+
void remove_suffix(size_type n) noexcept;
|
|
218
|
+
|
|
219
|
+
/// \brief Exchanges the view with that of v.
|
|
220
|
+
///
|
|
221
|
+
/// \param v view to swap with
|
|
222
|
+
void swap(basic_string_view& v) noexcept;
|
|
223
|
+
|
|
224
|
+
//------------------------------------------------------------------------
|
|
225
|
+
// Conversions
|
|
226
|
+
//------------------------------------------------------------------------
|
|
227
|
+
public:
|
|
228
|
+
|
|
229
|
+
/// \brief Creates a basic_string with a copy of the content of the current view.
|
|
230
|
+
///
|
|
231
|
+
/// \tparam Allocator type used to allocate internal storage
|
|
232
|
+
/// \param a Allocator instance to use for allocating the new string
|
|
233
|
+
///
|
|
234
|
+
/// \return A basic_string containing a copy of the characters of the current view.
|
|
235
|
+
template<class Allocator = std::allocator<CharT>>
|
|
236
|
+
constexpr std::basic_string<CharT, Traits, Allocator>
|
|
237
|
+
to_string(const Allocator& a = Allocator()) const;
|
|
238
|
+
|
|
239
|
+
/// \copydoc basic_string_view::to_string
|
|
240
|
+
template<class Allocator>
|
|
241
|
+
explicit constexpr operator std::basic_string<CharT, Traits, Allocator>() const;
|
|
242
|
+
|
|
243
|
+
//------------------------------------------------------------------------
|
|
244
|
+
// Operations
|
|
245
|
+
//------------------------------------------------------------------------
|
|
246
|
+
public:
|
|
247
|
+
|
|
248
|
+
/// \brief Copies the substring [pos, pos + rcount) to the character string pointed
|
|
249
|
+
/// to by dest, where rcount is the smaller of count and size() - pos.
|
|
250
|
+
///
|
|
251
|
+
/// \param dest pointer to the destination character string
|
|
252
|
+
/// \param count requested substring length
|
|
253
|
+
/// \param pos position of the first character
|
|
254
|
+
size_type copy( char_type* dest,
|
|
255
|
+
size_type count = npos,
|
|
256
|
+
size_type pos = 0 ) const;
|
|
257
|
+
|
|
258
|
+
/// \brief Returns a substring of this viewed string
|
|
259
|
+
///
|
|
260
|
+
/// \param pos the position of the first character in the substring
|
|
261
|
+
/// \param len the length of the substring
|
|
262
|
+
/// \return the created substring
|
|
263
|
+
basic_string_view substr(size_t pos = 0, size_t len = npos) const;
|
|
264
|
+
|
|
265
|
+
//------------------------------------------------------------------------
|
|
266
|
+
|
|
267
|
+
/// \brief Compares two character sequences
|
|
268
|
+
///
|
|
269
|
+
/// \param v view to compare
|
|
270
|
+
/// \return negative value if this view is less than the other character
|
|
271
|
+
/// sequence, zero if the both character sequences are equal, positive
|
|
272
|
+
/// value if this view is greater than the other character sequence.
|
|
273
|
+
int compare(basic_string_view v) const noexcept;
|
|
274
|
+
|
|
275
|
+
/// \brief Compares two character sequences
|
|
276
|
+
///
|
|
277
|
+
/// \param pos position of the first character in this view to compare
|
|
278
|
+
/// \param count number of characters of this view to compare
|
|
279
|
+
/// \param v view to compare
|
|
280
|
+
/// \return negative value if this view is less than the other character
|
|
281
|
+
/// sequence, zero if the both character sequences are equal, positive
|
|
282
|
+
/// value if this view is greater than the other character sequence.
|
|
283
|
+
int compare(size_type pos, size_type count, basic_string_view v) const;
|
|
284
|
+
|
|
285
|
+
/// \brief Compares two character sequences
|
|
286
|
+
///
|
|
287
|
+
/// \param pos1 position of the first character in this view to compare
|
|
288
|
+
/// \param count1 number of characters of this view to compare
|
|
289
|
+
/// \param v view to compare
|
|
290
|
+
/// \param pos2 position of the second character in this view to compare
|
|
291
|
+
/// \param count2 number of characters of the given view to compare
|
|
292
|
+
/// \return negative value if this view is less than the other character
|
|
293
|
+
/// sequence, zero if the both character sequences are equal, positive
|
|
294
|
+
/// value if this view is greater than the other character sequence.
|
|
295
|
+
int compare( size_type pos1, size_type count1, basic_string_view v,
|
|
296
|
+
size_type pos2, size_type count2 ) const;
|
|
297
|
+
|
|
298
|
+
/// \brief Compares two character sequences
|
|
299
|
+
///
|
|
300
|
+
/// \param s pointer to the character string to compare to
|
|
301
|
+
/// \return negative value if this view is less than the other character
|
|
302
|
+
/// sequence, zero if the both character sequences are equal, positive
|
|
303
|
+
/// value if this view is greater than the other character sequence.
|
|
304
|
+
int compare(const char_type* s) const;
|
|
305
|
+
|
|
306
|
+
/// \brief Compares two character sequences
|
|
307
|
+
///
|
|
308
|
+
/// \param pos position of the first character in this view to compare
|
|
309
|
+
/// \param count number of characters of this view to compare
|
|
310
|
+
/// \param s pointer to the character string to compare to
|
|
311
|
+
/// \return negative value if this view is less than the other character
|
|
312
|
+
/// sequence, zero if the both character sequences are equal, positive
|
|
313
|
+
/// value if this view is greater than the other character sequence.
|
|
314
|
+
int compare(size_type pos, size_type count, const char_type* s) const;
|
|
315
|
+
|
|
316
|
+
/// \brief Compares two character sequences
|
|
317
|
+
///
|
|
318
|
+
/// \param pos position of the first character in this view to compare
|
|
319
|
+
/// \param count1 number of characters of this view to compare
|
|
320
|
+
/// \param s pointer to the character string to compare to
|
|
321
|
+
/// \param count2 number of characters of the given view to compare
|
|
322
|
+
/// \return negative value if this view is less than the other character
|
|
323
|
+
/// sequence, zero if the both character sequences are equal, positive
|
|
324
|
+
/// value if this view is greater than the other character sequence.
|
|
325
|
+
int compare( size_type pos, size_type count1, const char_type* s,
|
|
326
|
+
size_type count2 ) const;
|
|
327
|
+
|
|
328
|
+
//------------------------------------------------------------------------
|
|
329
|
+
|
|
330
|
+
size_type find(basic_string_view v, size_type pos = 0) const;
|
|
331
|
+
|
|
332
|
+
size_type find(char_type c, size_type pos = 0) const;
|
|
333
|
+
|
|
334
|
+
size_type find(const char_type* s, size_type pos, size_type count) const;
|
|
335
|
+
|
|
336
|
+
size_type find(const char_type* s, size_type pos = 0) const;
|
|
337
|
+
|
|
338
|
+
//------------------------------------------------------------------------
|
|
339
|
+
|
|
340
|
+
size_type rfind(basic_string_view v, size_type pos = npos) const;
|
|
341
|
+
|
|
342
|
+
size_type rfind(char_type c, size_type pos = npos) const;
|
|
343
|
+
|
|
344
|
+
size_type rfind(const char_type* s, size_type pos, size_type count) const;
|
|
345
|
+
|
|
346
|
+
size_type rfind(const char_type* s, size_type pos = npos) const;
|
|
347
|
+
|
|
348
|
+
//------------------------------------------------------------------------
|
|
349
|
+
|
|
350
|
+
size_type find_first_of(basic_string_view v, size_type pos = 0) const;
|
|
351
|
+
|
|
352
|
+
size_type find_first_of(char_type c, size_type pos = 0) const;
|
|
353
|
+
|
|
354
|
+
size_type find_first_of(const char_type* s, size_type pos, size_type count) const;
|
|
355
|
+
|
|
356
|
+
size_type find_first_of(const char_type* s, size_type pos = 0) const;
|
|
357
|
+
|
|
358
|
+
//------------------------------------------------------------------------
|
|
359
|
+
|
|
360
|
+
size_type find_last_of(basic_string_view v, size_type pos = npos) const;
|
|
361
|
+
|
|
362
|
+
size_type find_last_of(char_type c, size_type pos = npos) const;
|
|
363
|
+
|
|
364
|
+
size_type find_last_of(const char_type* s, size_type pos, size_type count) const;
|
|
365
|
+
|
|
366
|
+
size_type find_last_of(const char_type* s, size_type pos = npos) const;
|
|
367
|
+
|
|
368
|
+
//------------------------------------------------------------------------
|
|
369
|
+
|
|
370
|
+
size_type find_first_not_of(basic_string_view v, size_type pos = 0) const;
|
|
371
|
+
|
|
372
|
+
size_type find_first_not_of(char_type c, size_type pos = 0) const;
|
|
373
|
+
|
|
374
|
+
size_type find_first_not_of(const char_type* s, size_type pos, size_type count) const;
|
|
375
|
+
|
|
376
|
+
size_type find_first_not_of(const char_type* s, size_type pos = 0) const;
|
|
377
|
+
|
|
378
|
+
//------------------------------------------------------------------------
|
|
379
|
+
|
|
380
|
+
size_type find_last_not_of(basic_string_view v, size_type pos = npos) const;
|
|
381
|
+
|
|
382
|
+
size_type find_last_not_of(char_type c, size_type pos = npos) const;
|
|
383
|
+
|
|
384
|
+
size_type find_last_not_of(const char_type* s, size_type pos, size_type count) const;
|
|
385
|
+
|
|
386
|
+
size_type find_last_not_of(const char_type* s, size_type pos = npos) const;
|
|
387
|
+
|
|
388
|
+
//------------------------------------------------------------------------
|
|
389
|
+
// Iterators
|
|
390
|
+
//------------------------------------------------------------------------
|
|
391
|
+
public:
|
|
392
|
+
|
|
393
|
+
/// \{
|
|
394
|
+
/// \brief Retrieves the begin iterator for this basic_string_view
|
|
395
|
+
///
|
|
396
|
+
/// \return the begin iterator
|
|
397
|
+
const_iterator begin() const noexcept;
|
|
398
|
+
const_iterator cbegin() const noexcept;
|
|
399
|
+
/// \}
|
|
400
|
+
|
|
401
|
+
/// \{
|
|
402
|
+
/// \brief Retrieves the end iterator for this basic_string_view
|
|
403
|
+
///
|
|
404
|
+
/// \return the end iterator
|
|
405
|
+
const_iterator end() const noexcept;
|
|
406
|
+
const_iterator cend() const noexcept;
|
|
407
|
+
/// \}
|
|
408
|
+
|
|
409
|
+
/// \{
|
|
410
|
+
/// \brief Retrieves the reverse begin iterator for this basic_string_view
|
|
411
|
+
///
|
|
412
|
+
/// \return the reverse begin iterator
|
|
413
|
+
const_reverse_iterator rbegin() const noexcept;
|
|
414
|
+
const_reverse_iterator rend() const noexcept;
|
|
415
|
+
/// \}
|
|
416
|
+
|
|
417
|
+
/// \{
|
|
418
|
+
/// \brief Retrieves the reverse end iterator for this basic_string_view
|
|
419
|
+
///
|
|
420
|
+
/// \return the reverse end iterator
|
|
421
|
+
const_reverse_iterator crbegin() const noexcept;
|
|
422
|
+
const_reverse_iterator crend() const noexcept;
|
|
423
|
+
/// \}
|
|
424
|
+
|
|
425
|
+
//------------------------------------------------------------------------
|
|
426
|
+
// Private Member
|
|
427
|
+
//------------------------------------------------------------------------
|
|
428
|
+
private:
|
|
429
|
+
|
|
430
|
+
const char_type* m_str; ///< The internal string type
|
|
431
|
+
size_type m_size; ///< The size of this string
|
|
432
|
+
|
|
433
|
+
/// \brief Checks whether \p c is one of the characters in \p str
|
|
434
|
+
///
|
|
435
|
+
/// \param c the character to check
|
|
436
|
+
/// \param str the characters to compare against
|
|
437
|
+
/// \return true if \p c is one of the characters in \p str
|
|
438
|
+
static bool is_one_of(CharT c, basic_string_view str);
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
template <typename CharT, typename Traits>
|
|
442
|
+
const typename basic_string_view<CharT,Traits>::size_type
|
|
443
|
+
basic_string_view<CharT,Traits>::npos;
|
|
444
|
+
|
|
445
|
+
//--------------------------------------------------------------------------
|
|
446
|
+
// Public Functions
|
|
447
|
+
//--------------------------------------------------------------------------
|
|
448
|
+
|
|
449
|
+
/// \brief Overload for ostream output of basic_string_view
|
|
450
|
+
///
|
|
451
|
+
/// \param o The output stream to print to
|
|
452
|
+
/// \param str the string to print
|
|
453
|
+
/// \return reference to the output stream
|
|
454
|
+
template<typename CharT, typename Traits>
|
|
455
|
+
std::basic_ostream<CharT,Traits>& operator<<(std::basic_ostream<CharT,Traits>& o,
|
|
456
|
+
const basic_string_view<CharT,Traits>& str);
|
|
457
|
+
|
|
458
|
+
template<typename CharT, typename Traits>
|
|
459
|
+
void swap(basic_string_view<CharT,Traits>& lhs,
|
|
460
|
+
basic_string_view<CharT,Traits>& rhs) noexcept;
|
|
461
|
+
|
|
462
|
+
//--------------------------------------------------------------------------
|
|
463
|
+
// Comparison Functions
|
|
464
|
+
//--------------------------------------------------------------------------
|
|
465
|
+
|
|
466
|
+
template<typename CharT, typename Traits>
|
|
467
|
+
bool operator==(const basic_string_view<CharT,Traits>& lhs,
|
|
468
|
+
const basic_string_view<CharT,Traits>& rhs) noexcept;
|
|
469
|
+
template<typename CharT, typename Traits>
|
|
470
|
+
bool operator!=(const basic_string_view<CharT,Traits>& lhs,
|
|
471
|
+
const basic_string_view<CharT,Traits>& rhs) noexcept;
|
|
472
|
+
template<typename CharT, typename Traits>
|
|
473
|
+
bool operator<(const basic_string_view<CharT,Traits>& lhs,
|
|
474
|
+
const basic_string_view<CharT,Traits>& rhs) noexcept;
|
|
475
|
+
template<typename CharT, typename Traits>
|
|
476
|
+
bool operator>(const basic_string_view<CharT,Traits>& lhs,
|
|
477
|
+
const basic_string_view<CharT,Traits>& rhs) noexcept;
|
|
478
|
+
template<typename CharT, typename Traits>
|
|
479
|
+
bool operator<=(const basic_string_view<CharT,Traits>& lhs,
|
|
480
|
+
const basic_string_view<CharT,Traits>& rhs) noexcept;
|
|
481
|
+
template<typename CharT, typename Traits>
|
|
482
|
+
bool operator>=(const basic_string_view<CharT,Traits>& lhs,
|
|
483
|
+
const basic_string_view<CharT,Traits>& rhs) noexcept;
|
|
484
|
+
|
|
485
|
+
//--------------------------------------------------------------------------
|
|
486
|
+
// Type Aliases
|
|
487
|
+
//--------------------------------------------------------------------------
|
|
488
|
+
|
|
489
|
+
using string_view = basic_string_view<char>;
|
|
490
|
+
using wstring_view = basic_string_view<wchar_t>;
|
|
491
|
+
using u16string_view = basic_string_view<char16_t>;
|
|
492
|
+
using u32string_view = basic_string_view<char32_t>;
|
|
493
|
+
|
|
494
|
+
} // namespace bpstd
|
|
495
|
+
|
|
496
|
+
#include "detail/string_view.inl"
|
|
497
|
+
|
|
498
|
+
#endif /* BPSTD_STRING_VIEW_HPP */
|