DEKI/ENGINE docs
Deki 0.19.0
Modular C++ 2D engine for embedded displays and desktop
Loading...
Searching...
No Matches
DekiEditor::SafeNames Namespace Reference

Functions

bool IsSafeName (const std::string &name, std::string &reason)
 One path segment or identifier. Fills reason on rejection.
bool IsSafeRepoSlug (const std::string &slug, std::string &reason)
 "owner/name" as the registry's repo field and the manifest's name carry it: exactly one '/', both halves IsSafeName.
bool IsSafeSerialPort (const std::string &port, std::string &reason)
 A serial port as a backend's deploy step passes it to its tools: COM<n> on Windows, /dev/<name> elsewhere.
bool IsSafeDefine (const std::string &define, std::string &reason)
 A preprocessor define as a package declares it: NAME or NAME=value with [A-Za-z_][A-Za-z0-9_]* and a value of [A-Za-z0-9_.
bool IsInsideDirectory (const std::filesystem::path &child, const std::filesystem::path &parent)
 True when child resolves to parent or somewhere below it.

Function Documentation

◆ IsSafeName()

bool DekiEditor::SafeNames::IsSafeName ( const std::string & name,
std::string & reason )

One path segment or identifier. Fills reason on rejection.

◆ IsSafeRepoSlug()

bool DekiEditor::SafeNames::IsSafeRepoSlug ( const std::string & slug,
std::string & reason )

"owner/name" as the registry's repo field and the manifest's name carry it: exactly one '/', both halves IsSafeName.

A bare name (no '/') is also accepted, since older lock files store only the repository name.

◆ IsSafeSerialPort()

bool DekiEditor::SafeNames::IsSafeSerialPort ( const std::string & port,
std::string & reason )

A serial port as a backend's deploy step passes it to its tools: COM<n> on Windows, /dev/<name> elsewhere.

Anything else (a space, a quote, an option) is refused before it reaches a shell line.

◆ IsSafeDefine()

bool DekiEditor::SafeNames::IsSafeDefine ( const std::string & define,
std::string & reason )

A preprocessor define as a package declares it: NAME or NAME=value with [A-Za-z_][A-Za-z0-9_]* and a value of [A-Za-z0-9_.

]*.

◆ IsInsideDirectory()

bool DekiEditor::SafeNames::IsInsideDirectory ( const std::filesystem::path & child,
const std::filesystem::path & parent )

True when child resolves to parent or somewhere below it.

Both are canonicalised weakly, since the child may not exist yet; if that fails, the answer is false.