Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
design_tweaks.hpp File Reference
#include <optional>
#include <string>
#include <string_view>
#include <vector>

Go to the source code of this file.

Classes

struct  pulp::design::TweakParam
 One parameter in the block: a key and its JSON-encoded value. More...
struct  pulp::design::EditBlockSpan
 Where the block sits in the host text, as byte offsets. More...
struct  pulp::design::RewriteResult
 Result of a rewrite: the new full artifact text plus whether anything outside the block changed (it must not — this is a self-check the caller can assert). More...

Namespaces

namespace  pulp
namespace  pulp::design

Functions

std::optional< EditBlockSpan > pulp::design::find_edit_block (std::string_view text)
 Locate the first edit block in text.
std::optional< std::vector< TweakParam > > pulp::design::read_edit_block (std::string_view text)
 Parse the parameters out of text's edit block.
std::optional< std::string > pulp::design::edit_block_payload (const std::vector< TweakParam > &params)
 Serialize parameters to the canonical single-line block payload (no outer markers): {"k1":v1,"k2":v2}.
std::optional< RewriteResult > pulp::design::rewrite_edit_block (std::string_view text, const std::vector< TweakParam > &params)
 Rewrite text's edit block so its payload encodes params, preserving every byte outside the marker span exactly.
std::optional< RewriteResult > pulp::design::set_edit_param (std::string_view text, std::string_view key, std::string_view json_value)
 Apply a single key=value change to text's block: update the key in place if present, else append it (preserving the order of existing keys).

Variables

constexpr std::string_view pulp::design::kEditBlockBegin = "/*EDITMODE-BEGIN*/"
 The exact opening and closing markers that anchor the block.
constexpr std::string_view pulp::design::kEditBlockEnd = "/*EDITMODE-END*/"