Skip to content

Add SegmentedStringView for split-string handling - #46

Merged
lbastigk merged 51 commits into
mainfrom
feature/split-string
Oct 3, 2026
Merged

lbastigk merged 51 commits into
mainfrom
feature/split-string

Conversation

@lbastigk

@lbastigk lbastigk commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Summary

This branch introduces Nebulite::Utility::Args::SegmentedStringView, a non-owning wrapper around spans of std::string_view segments.
It allows split command arguments to be inspected and compared as a logical string without first recombining them.

SegmentedStringView is intended to become the common representation for argument parsing throughout the project.
This pull request establishes the wrapper, but deliberately does not refactor every existing manual use of std::span<std::string_view>.
Those remaining usages can be migrated in a later change.

What changed

  • Added SegmentedStringView with:
    • Equality and inequality comparison against strings and other segmented views
    • beginsWith, endsWith, and contains
    • Character and segment counts
    • Subspan, substring, copy, and recombination helpers
    • Named argument lookup and extraction
    • Typed argument conversion through tryGetAs
    • Character iteration across segment boundaries
  • Added SpanIterator and StringViewIterator for traversal across segments and optimized contiguous comparisons.
  • Refactored quoted argument parsing to produce std::string_view segments and avoid unnecessary string allocations.
  • Added recombination overloads for full views and subranges.
  • Updated FuncTree argument parsing and completion handling to use string views more consistently.
  • Added reusable string-combination, testing, and range-filtering utilities.
  • Added comparison, containment, and benchmark feature tests for segmented strings.
  • Updated build and test configuration to support the new tests and benchmarks.

Testing and benchmarking

  • Added automated tests covering:
    • Equality across whitespace-separated segments
    • Prefix and suffix matching
    • Substring containment
    • Leading, trailing, repeated, and varying whitespace
    • SegmentedStringView-to-SegmentedStringView comparisons
  • Added benchmarks for successful and unsuccessful contains checks and segmented-view equality.

…g_view, as this is the new canonical type for StringHandler::parseQuotedArguments.
…, add info for future usage in FuncTree parsing.
…entCompletion to use it for unique value filtering
…ks and add performance improvement suggestions
…ce handling and iterator management, add iterator[] and several todos.
…function for improved readability and maintainability
…r error handling and clarity. Reorganize tests.
…d add new methods for iterator functionality
@lbastigk

lbastigk commented Oct 3, 2026

Copy link
Copy Markdown
Owner Author

Checks seem to fail due to a missing file from one of the dependencies. Works locally, though... Might be an issue with the way fetchcontent works within github? I noticed some cloning issues lately, so maybe git clone silently fails with some repos, or this is a permission issue. Since the asset file is relatively simple, we might get away with storing a derived version locally.

@lbastigk
lbastigk merged commit 4f3dfdf into main Oct 3, 2026
2 checks passed
@lbastigk
lbastigk deleted the feature/split-string branch October 3, 2026 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant