|
1 | 1 | // -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
|
2 | 2 | //-----------------------------------------------------------------------------
|
3 |
| -// Copyright 2000-2022 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com) |
| 3 | +// Copyright 2000-2025 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com) |
4 | 4 | // See the top-level COPYRIGHT file for details.
|
5 | 5 | // SPDX-License-Identifier: Apache-2.0
|
6 | 6 | //-----------------------------------------------------------------------------
|
7 | 7 | /*---------------------------------------------------------------------------*/
|
8 |
| -/* StringView.cc (C) 2000-2021 */ |
| 8 | +/* StringView.cc (C) 2000-2025 */ |
9 | 9 | /* */
|
10 | 10 | /* Vue sur une chaîne de caractères UTF-8. */
|
11 | 11 | /*---------------------------------------------------------------------------*/
|
@@ -33,6 +33,26 @@ writeBytes(std::ostream& o) const
|
33 | 33 | /*---------------------------------------------------------------------------*/
|
34 | 34 | /*---------------------------------------------------------------------------*/
|
35 | 35 |
|
| 36 | +StringView StringView:: |
| 37 | +substring(Int64 pos) const |
| 38 | +{ |
| 39 | + return substring(pos, length() - pos); |
| 40 | +} |
| 41 | + |
| 42 | +/*---------------------------------------------------------------------------*/ |
| 43 | +/*---------------------------------------------------------------------------*/ |
| 44 | + |
| 45 | +StringView StringView:: |
| 46 | +substring(Int64 pos, Int64 len) const |
| 47 | +{ |
| 48 | + if (pos < 0) |
| 49 | + pos = 0; |
| 50 | + return { m_v.subspan(pos, len) }; |
| 51 | +} |
| 52 | + |
| 53 | +/*---------------------------------------------------------------------------*/ |
| 54 | +/*---------------------------------------------------------------------------*/ |
| 55 | + |
36 | 56 | std::ostream&
|
37 | 57 | operator<<(std::ostream& o,const StringView& str)
|
38 | 58 | {
|
|
0 commit comments