strpp - StringPlusPlus - pronounced "strip"
  • C++ 86.7%
  • C 6.6%
  • JavaScript 4.8%
  • Makefile 1.4%
  • CMake 0.3%
  • Other 0.1%
Find a file
2026-09-28 17:07:50 +10:00
doc Rewrites to use active mood 2026-09-28 17:07:50 +10:00
include Changed message parameter sequence to match current text. Flip to using include files make by msggen. Tests more robust against message wording changes. 2026-09-28 14:54:01 +10:00
messages Doc rewrites, made more catalog items final 2026-09-28 15:50:42 +10:00
rx Moved Borrow/TakeOver to Array to make it available elsewhere 2026-09-26 13:27:07 +10:00
scripts Updated documentation, especially for Px 2025-10-29 12:05:21 +11:00
src Changed message parameter sequence to match current text. Flip to using include files make by msggen. Tests more robust against message wording changes. 2026-09-28 14:54:01 +10:00
test Changed message parameter sequence to match current text. Flip to using include files make by msggen. Tests more robust against message wording changes. 2026-09-28 14:54:01 +10:00
tools Rewrites to use active mood 2026-09-28 17:07:50 +10:00
.gitignore Added some future notes 2026-09-20 09:29:08 +10:00
book.toml Updated doc publication tasks in the Makefile 2026-09-27 18:57:06 +10:00
CMakeLists.txt Fixed some array bounds checking issues, clamping some and reporting error on others 2026-09-27 11:53:36 +10:00
idf_component.yml Added the ability to use it directly as an ESP-IDF Component 2026-08-23 15:01:41 +10:00
Kconfig Added the ability to use it directly as an ESP-IDF Component 2026-08-23 15:01:41 +10:00
LICENSE Refactor Peg recursion to prepare for variant Result types 2025-06-17 13:24:04 +10:00
Makefile Moved catalog generation out of the tools Makefile 2026-09-28 15:53:16 +10:00
README.md Added DateTime (calendar) and Interval handling 2026-09-26 19:31:06 +10:00
RoadMap Changed message parameter sequence to match current text. Flip to using include files make by msggen. Tests more robust against message wording changes. 2026-09-28 14:54:01 +10:00

strpp - StringPlusPlus - pronounced "strip"

A value-oriented C++ library implementing maps, arrays and strings (with slices), raw Unicode processing, Variant type, pattern-matching and parsing. Designed to minimise dynamic memory allocation and memory safety issues, strpp provides efficient but advanced functionality on machines with restricted memory, such as many embedded systems.

Strpp uses copy-on-write to implement value semantics on shared objects (Unicode strings, generic arrays and maps) using thread-safe atomic reference-counting. Values may be passed by copying references, which means you can pass complex structures cheaply without much fear of aliasing, memory leaks, or object lifetime violations.

The Variant class provides type-safe support for passing any data object, as is common in interpreted languages (Perl, Ruby, Python).

The <rx> library provides a regular expression implementation using StrVal that is ReDOS-safe (using the Thompson algorithm).

These regular expressions are however deprecated in favour of greedy PEG expressions with look-ahead assertions. All PEG operators are in the prefix position, which does not require a compilation step (or memory allocation) for efficient execution. These Pegular Expressions are also composed into full (non-regular) PEG grammars with a parser generator to produce compact table-driven parsers that allocate no memory. The Px compiler also generates grammar documentation using Javascript and SVG, and will produce Textmate syntax highlighting patterns for IDEs and text generators to assist implementation of pretty-printer output. Parser template parameters allow capturing parse results, with a generic Abstract Syntax Tree builder for any grammar specified in Px.

Raw Unicode character processing

#include <char_encoding.h>

See Unicode

Rapid inlined encode/decode for 32-bit character values in 1..6 bytes of UTF8. Gracefully handles errors in UTF-8 coding.

#include <charpointer.h>

#include <char_ptr.h>

#include <utf8_ptr.h>

CharPointer selects either 8-bit (char_ptr) or UTF-8 (utf8_ptr) boxed character pointers. The two kinds support unguarded pointers, pointers that will not advance past a NUL, and pointers which will not retreat before the start either. All are used to facilitate correct coding by restricting the unguarded behaviour of the C/C++ languages.

Error and ErrNum type

#include <error.h>.

See Error

Unicode strings: the StrVal class

#include <strval.h>

See StrVal

Array with slices

#include <array.h>

See Array

COWMap, copy-on-write map template

#include <cowmap.h>

See CowMap

Variant Data Type

#include <variant.h>

See Variant

Time and date: intervals and instants

#include <datetime.h>

See Time and date

Gregorian: civil dates and ISO 8601

#include <gregorian.h>

See Gregorian

Prefix Regular Expression pattern matching

#include <pegexp.h>

See Pegexp

PEG parsing

#include <peg.h>

See Peg

Px, a PEG parser generator

See Px

Cross-platform C++ Threading support

#include <thread.h> #include <lockfree.h> #include <condition.h>

Thread is a base class which requires a virtual run() method and provides suspend, resume, join, joinAny, yield(ms), etc. lockfree.h implements atomic an Latch class allowing construction of lock-free code, and condition,h provides an cross-platform implementation of condition variables.

Threading is backed by pthreads, Windows threads, or FreeRTOS (-DHAVE_PTHREADS, -DMSW, or -DHAVE_FREERTOS).

Using strpp as an ESP-IDF component

This directory is itself a valid ESP-IDF component (CMakeLists.txt, idf_component.yml, Kconfig) for use with FreeRTOS on ESP32 targets. Add it to an ESP-IDF project either as a git submodule under components/strpp, or by pointing EXTRA_COMPONENT_DIRS at a checkout of this repository. It always builds with HAVE_FREERTOS defined; idf.py menuconfig exposes STRPP_THREAD_DEFAULT_STACK_BYTES, STRPP_THREAD_DEFAULT_PRIORITY and STRPP_MAX_THREAD under "strpp Configuration".

make freertos_check compiles (and links) the library and thread_test against test/freertos_stub/, a minimal stand-in for the real FreeRTOS headers, as a transcription-error check - it has no scheduler behind it, so don't run the resulting binary, and it's not a substitute for building the component in a real ESP-IDF project.

Regular Expressions

A ReDOS-resistant Thompson-style regexp compiler/interpreter using StrVal.

#include <strregex.h>

See Rx

LICENSE

The MIT License. See the LICENSE file for details.