summaryrefslogtreecommitdiffstats
path: root/Source/cmStringCommand.cxx
Commit message (Collapse)AuthorAgeFilesLines
* string: Add REGEX QUOTE sub-commandTimo Röhling2025-09-181-0/+32
| | | | | | | Add a command to generate a regular expression that matches an input string literally by escaping special characters. Fixes: #18580
* string(JSON): Include invalid JSON in parse errorMartin Duffy2025-07-111-1/+2
|
* cmStrCat: use character literals where possibleBen Boeckel2025-05-151-1/+1
| | | | | Found and replaced using the `cmstrcat-to-char-literal` rule for `ast-grep`.
* Source: Fix -Wformat warningsBrad King2025-04-241-2/+1
|
* LICENSE: Replace references to Copyright.txt with LICENSE.rstKitware Robot2025-03-031-1/+1
| | | | | | | | | | ``` git grep -lz 'Copyright.txt or https://cmake.org/licensing ' | while IFS= read -r -d $'\0' f ; do sed -i '/Copyright.txt or https:\/\/cmake.org\/licensing / { s/Copyright.txt/LICENSE.rst/ }' "$f" ; done ```
* string: Allow zero-length matches in all REGEX subcommandsNikita Nemkin2025-02-141-20/+14
| | | | | | | | | The semantics mimic other languages like Python, Java, JS, etc. To advance past a zero-length match, the search algorithm first tries to find a non-zero alternative branch. If that fails, it force-advances by 1 character. Fixes: #13790, #13792, #18690, #26629
* regex: Match ^ at most once in repeated searchesNikita Nemkin2025-02-131-4/+11
| | | | | | | | | When doing successive matches, track the input start and current search start positions separately to prevent the `^` anchor from matching in the middle of the string. Add policy CMP0186 to provide compatibility. Issue: #26629 Fixes: #16899
* Revise C++ coding style using clang-format with "east const"Kitware Robot2025-01-231-64/+64
| | | | | | | | | | | | | | | Run the `clang-format.bash` script to update all our C and C++ code to a new style defined by `.clang-format`, now with "east const" enforcement. Use `clang-format` version 18. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit. Issue: #26123
* Source: Avoid out-of-range inputs to std::isspace()Brad King2024-01-171-2/+1
| | | | | | | | | | | | | `isspace` takes `int` but documents that the value must be representable by `unsigned char`, or be EOF. Use a wrapper to cast to `unsigned char` to avoid sign extension while converting to `int`. This generalizes the fix from commit 5e8c176e2a (cmExecuteProcessCommand: Cast c to unsigned char before cast to int, 2024-01-05) to other `isspace` call sites. This was detected by assertions in the MSVC standard library while processing UTF-8 text. Issue: #25561
* cmStringCommand: remove use of cmCatViews()Kyle Edwards2022-11-291-32/+32
|
* string(JSON): Fix typo in error messageSean Kahler2022-08-041-1/+1
| | | | `s/then/than/` in a comparison.
* Source: Replace uses of sprintf with safer snprintfSean McBride2022-06-221-1/+2
|
* string(): Support hash functions in bootstrapKyle Edwards2022-04-211-5/+0
| | | | | cmCryptoHash has been included in the bootstrap script since 596439b. Add hash support to string() in bootstrap to allow FindPython to work.
* string(JSON): fix error message on invalid modeCarlo Teubner2022-03-301-2/+2
| | | | | | | The `GET_ARRAY` and `MEMBERS` modes were removed during development and review of commit 8eab76eb84 (string(JSON): Adds JSON parsing support to the string command, 2020-08-24, v3.19.0-rc1~159^2), but were accidentally left in an error message.
* Source: Replace most calls to sprintf with snprintfSean McBride2021-10-251-1/+1
|
* Source: Fix clang -Wextra-semi warningsSean McBride2021-09-281-1/+1
|
* Rename cmProp in cmValueMarc Chevrier2021-09-211-2/+2
|
* Source: Reduce c_str() usagevvs314152021-03-131-2/+2
|
* clang-tidy: fix `bugprone-reserved-identifier` warningsBen Boeckel2021-01-271-0/+1
|
* Code style: add missed explicit 'this->'Oleksandr Koval2021-01-051-6/+6
| | | | | CMake uses explicit 'this->' style. Using custom clang-tidy check we can detect and fix places where 'this->' was missed.
* string(JSON): Adds JSON parsing support to the string commandPeter Steneteg2020-09-161-0/+300
| | | | | | | Adds a set of sub commands to the string command for parsing JSON, the JSON commands are: GET, TYPE, MEMBER, LENGTH, REMOVE, SET, and EQUAL. Closes: #19501
* cmStringAlgorithms: Add faster cmJoin overloads for stringsOleksandr Koval2020-09-031-4/+8
| | | | | | | cmJoin() is often used with std::string ranges. Generic implementation uses std::ostringstream which is not optimal. With strings we can avoid operator<<() and make much faster implementation. Additional 'initial' argument is useful for cmStringCommand.cxx:HandleAppendCommand().
* cmMakefile::GetDefinition: return cmPropVitaly Stakhovsky2020-09-021-7/+4
|
* Refactoring: rename "cm_static_string_view.hxx" as <cmext/string_view>Marc Chevrier2020-04-301-2/+1
|
* string: Add new HEX sub-commandKyle Edwards2020-02-191-0/+22
|
* Revise include order using clang-format-6.0Kitware Robot2019-10-011-1/+2
| | | | | Run the `clang-format.bash` script to update our C and C++ code to a new include order `.clang-format`. Use `clang-format` version 6.0.
* cmstd: Modernize CMake system headersMarc Chevrier2019-09-201-2/+2
| | | | | | | | | | | | | | Provide a standardized way to handle the C++ "standard" headers customized to be used with current CMake C++ standard constraints. Offer under directory `cm` headers which can be used as direct replacements of the standard ones. For example: #include <cm/string_view> can be used safely for CMake development in place of the `<string_view>` standard header. Fixes: #19491
* Refactor: Use cmStrCat to construct error stringsAsit Dhal2019-09-181-23/+9
| | | | | Replace string construction using std::stringstream with cmStrCat and cmWrap.
* clang-tidy: modernize-deprecated-headersRegina Pfeifer2019-09-161-3/+3
|
* Merge topic 'string-subcommand-table'Brad King2019-08-261-130/+65
|\ | | | | | | | | | | | | 66c2714f22 cmStringCommand: Use cmSubcommandTable Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3721
| * cmStringCommand: Use cmSubcommandTableRegina Pfeifer2019-08-221-130/+65
| |
* | Source sweep: Use cmStrCat for string concatenationSebastian Holtermann2019-08-221-6/+5
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is generated by a python script that uses regular expressions to search for string concatenation patterns of the kind ``` std::string str = <ARG0>; str += <ARG1>; str += <ARG2>; ... ``` and replaces them with a single `cmStrCat` call ``` std::string str = cmStrCat(<ARG0>, <ARG1>, <ARG2>, ...); ``` If any `<ARGX>` is itself a concatenated string of the kind ``` a + b + c + ...; ``` then `<ARGX>` is split into multiple arguments for the `cmStrCat` call. If there's a sequence of literals in the `<ARGX>`, then all literals in the sequence are concatenated and merged into a single literal argument for the `cmStrCat` call. Single character strings are converted to single char arguments for the `cmStrCat` call. `std::to_string(...)` wrappings are removed from `cmStrCat` arguments, because it supports numeric types as well as string types. `arg.substr(x)` arguments to `cmStrCat` are replaced with `cm::string_view(arg).substr(x)`
* cmCommand refactor: cmStringCommandGabor Bencze2019-08-201-166/+237
|
* cmCryptoHash: Accept cm::string_view inputSebastian Holtermann2019-08-181-1/+1
|
* Merge topic 'cmStringAlgorithms_ulong'Kyle Edwards2019-08-161-1/+1
|\ | | | | | | | | | | | | 935fbe0b04 cmStringAlgorithms: Add cmStrToLong and cmStrToULong Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3681
| * cmStringAlgorithms: Add cmStrToLong and cmStrToULongSebastian Holtermann2019-08-101-1/+1
| | | | | | | | | | | | | | | | This adds the following functions to cmStringAlgorithms: - `cmStrToLong`: moved from `cmSystemTools::StringToLong` - `cmStrToULong`: moved from `cmSystemTools::StringToULong` Overloads of the given functions for `std::string` are added as well.
* | Refactor: Convert all instances of CMAKE_BUILD_WITH_CMAKE to CMAKE_BOOTSTRAPKitware Robot2019-08-091-2/+2
|/
* cmStringAlgorithms: Move string functions to the new cmStringAlgorithms.hSebastian Holtermann2019-07-291-0/+1
| | | | | This adds the `cmStringAlgorithms.h` header and moves all string functions from `cmAlgorithms.h` to `cmStringAlgorithms.h`.
* cmMakefile: Let AddDefinition accept a value as cm::string_viewSebastian Holtermann2019-07-241-21/+20
| | | | | | | | | | | | | | | | This changes `cmMakefile::AddDefinition` to take a `cm::string_view` as value argument instead of a `const char *`. Benefits are: - `std::string` can be passed to `cmMakefile::AddDefinition` directly without the `c_str()` plus string length recomputation fallback. - Lengths of literals passed to `cmMakefile::AddDefinition` can be computed at compile time. In various sources uses of `cmMakefile::AddDefinition` are adapted to avoid `std::string::c_str` calls and the `std::string` is passed directly. Uses of `cmMakefile::AddDefinition`, where a `nullptr` `const char*` might be passed to `cmMakefile::AddDefinition` are extended with `nullptr` checks.
* modernize: manage cmCommand instances using unique_ptr.Marc Chevrier2019-07-141-1/+0
|
* IWYU: Fix handling of <memory> standard headerBrad King2019-07-101-1/+1
| | | | | | | | An old workaround for `std::allocator_traits<>::value_type` lints from IWYU on `std::vector<>` usage breaks IWYU's handling of `<memory>`. Convert the workaround to use the same approach we already use for a workaround of `std::__decay_and_strip<>::::__type` lints. Then update the `<memory>` inclusions to follow the now-correct IWYU lints.
* string: introduce `REPEAT` sub-commandAlex Turbov2019-04-151-0/+61
|
* cmRange: Move to dedicated header fileRegina Pfeifer2019-02-211-0/+1
|
* Prefer front/back/data over dereferencing begin/rbegin iterArtur Ryt2019-02-061-1/+1
| | | | Changed for sequenced containers: vector, list, string and array
* Using front() and back() instead of calculationsCengizhan Pasaoglu2018-11-061-4/+3
|
* Remove unnecessary c_str() in RegularExpression::find callsVitaly Stakhovsky2018-08-071-1/+1
|
* Revise C++ coding style using clang-format-6.0Kitware Robot2018-06-011-4/+4
| | | | | | | | | | | | Run the `clang-format.bash` script to update all our C and C++ code to a new style defined by `.clang-format`. Use `clang-format` version 6.0. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit.
* string() Refactoring: creates an helper for REGEX REPLACEMarc Chevrier2018-04-161-86/+14
|
* string: Add JOIN subcommandAlex Turbov2018-02-161-2/+23
| | | | | This is just like CONCAT but accepts a glue string to put between each value. `JOIN ""` is equivalent to `CONCAT`.
* Retire std::auto_ptr and its macro CM_AUTO_PTRMatthias Maennich2017-09-251-3/+3
| | | | Signed-off-by: Matthias Maennich <matthias@maennich.net>