OmniStacksStaticModules 2.0.0
Loading...
Searching...
No Matches
ProjectSync::anonymous_namespace{ProjectSync.cppm} Namespace Reference

Typedefs

using json = nlohmann::json

Functions

std::string now_timestamp ()
fs::path normalized_path (const fs::path &value)
 解析为绝对规范路径;canonical 失败时退化为 lexically_normal。
std::expected< std::set< std::string >, SyncError > load_library_paths (const fs::path &project_db)
 从现有 Project.json 读取并规范化 library_paths。
bool atomic_write_json (const fs::path &target, const json &value)
 通过同目录临时文件 + rename 原子写入 JSON。
std::string safe_string (const json &object, std::string_view key, std::string fallback={})
 防御性读取 JSON 对象中的字符串字段。

Typedef Documentation

◆ json

using ProjectSync::anonymous_namespace{ProjectSync.cppm}::json = nlohmann::json

Definition at line 116 of file ProjectSync.cppm.

Function Documentation

◆ atomic_write_json()

bool ProjectSync::anonymous_namespace{ProjectSync.cppm}::atomic_write_json ( const fs::path & target,
const json & value )

通过同目录临时文件 + rename 原子写入 JSON。

Returns
目录创建、写入、flush 或 rename 任一步失败均返回 false。
Note
临时名包含 PID 与 steady_clock 计数,避免并发/快速重试互相覆盖。

Definition at line 170 of file ProjectSync.cppm.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_library_paths()

std::expected< std::set< std::string >, SyncError > ProjectSync::anonymous_namespace{ProjectSync.cppm}::load_library_paths ( const fs::path & project_db)

从现有 Project.json 读取并规范化 library_paths。

Returns
首次运行或文件不存在时返回空集合;损坏 JSON 返回 unreadable。

Definition at line 140 of file ProjectSync.cppm.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ normalized_path()

fs::path ProjectSync::anonymous_namespace{ProjectSync.cppm}::normalized_path ( const fs::path & value)

解析为绝对规范路径;canonical 失败时退化为 lexically_normal。

Note
该函数不会因为不存在路径而失败,便于把待创建目录也稳定归一化。

Definition at line 127 of file ProjectSync.cppm.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ now_timestamp()

std::string ProjectSync::anonymous_namespace{ProjectSync.cppm}::now_timestamp ( )

Definition at line 118 of file ProjectSync.cppm.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ safe_string()

std::string ProjectSync::anonymous_namespace{ProjectSync.cppm}::safe_string ( const json & object,
std::string_view key,
std::string fallback = {} )

防御性读取 JSON 对象中的字符串字段。

Parameters
object待读取对象。
key字段名。
fallback类型不匹配或字段缺失时的值。

Definition at line 211 of file ProjectSync.cppm.

Here is the call graph for this function:
Here is the caller graph for this function: