OmniStacksStaticModules 2.0.0
Loading...
Searching...
No Matches
ProjectSync.cppm File Reference
#include <unistd.h>
#include <chrono>
#include <cstdint>
#include <ctime>
#include <filesystem>
#include <fstream>
#include <set>
#include <string>
#include <string_view>
#include <system_error>
#include <vector>
#include "json.hpp"
import InterfaceLog;
import std;
Include dependency graph for ProjectSync.cppm:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ProjectSync::DbPaths
 项目索引数据库路径。 More...
struct  ProjectSync::SyncSummary
 同步结果摘要;用于 CLI、Alfred 反馈和接口日志。 More...

Namespaces

namespace  ProjectSync
namespace  ProjectSync::anonymous_namespace{ProjectSync.cppm}

Typedefs

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

Enumerations

enum class  ProjectSync::SyncError {
  ProjectSync::search_path_missing , ProjectSync::search_path_not_directory , ProjectSync::project_db_unreadable , ProjectSync::project_file_unreadable ,
  ProjectSync::io_failure
}
 工作区同步的可恢复错误分类。 More...

Functions

std::expected< SyncSummary, SyncError > ProjectSync::sync_all (const std::filesystem::path &search_path, const DbPaths &paths={})
 同步新增路径与全部已记忆路径,并原子重建两个索引。
template<std::invocable< const std::filesystem::directory_entry & > Visitor>
void ProjectSync::for_each_project_file (const std::filesystem::path &directory, Visitor &&visitor)
 递归遍历工作区中的 .project 文件。
std::string_view ProjectSync::sync_error_message (SyncError error) noexcept
 SyncError 到稳定、可读的 CLI/Alfred 错误文本。
std::string ProjectSync::format_file_time (std::filesystem::file_time_type file_time)
 把 filesystem 写入时间转换为本地 YYYY-MM-DD HH:MM:SS。
std::string ProjectSync::anonymous_namespace{ProjectSync.cppm}::now_timestamp ()
fs::path ProjectSync::anonymous_namespace{ProjectSync.cppm}::normalized_path (const fs::path &value)
 解析为绝对规范路径;canonical 失败时退化为 lexically_normal。
std::expected< std::set< std::string >, SyncError > ProjectSync::anonymous_namespace{ProjectSync.cppm}::load_library_paths (const fs::path &project_db)
 从现有 Project.json 读取并规范化 library_paths。
bool ProjectSync::anonymous_namespace{ProjectSync.cppm}::atomic_write_json (const fs::path &target, const json &value)
 通过同目录临时文件 + rename 原子写入 JSON。
std::string ProjectSync::anonymous_namespace{ProjectSync.cppm}::safe_string (const json &object, std::string_view key, std::string fallback={})
 防御性读取 JSON 对象中的字符串字段。
std::string ProjectSync::format_file_time (fs::file_time_type file_time)
std::expected< SyncSummary, SyncError > ProjectSync::sync_all (const fs::path &search_path, const DbPaths &paths)