Crafter.Build/interfaces/Crafter.Build-Progress.cppm

41 lines
1.4 KiB
Text
Raw Normal View History

//SPDX-License-Identifier: LGPL-3.0-only
//SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
2026-04-29 03:27:11 +02:00
module;
#include "Crafter.Build-Api.h"
export module Crafter.Build:Progress;
import std;
export namespace Crafter::Progress {
enum class Verbosity { Quiet, Default, Verbose };
CRAFTER_API void SetVerbosity(Verbosity v);
CRAFTER_API Verbosity GetVerbosity();
// RAII work-unit marker. Construction inflates the running total; destruction
// increments completed and (on Default + TTY) redraws the status line. Move
// semantics are disabled — keep these as plain stack locals inside the worker
// lambda so the destructor fires when that thread's work ends.
class CRAFTER_API Task {
public:
explicit Task(std::string label);
~Task();
Task(const Task&) = delete;
Task& operator=(const Task&) = delete;
Task(Task&&) = delete;
Task& operator=(Task&&) = delete;
private:
std::string label_;
};
// Verbose-mode command echo. No-op outside Verbose.
CRAFTER_API void EchoCommand(std::string_view command);
// Erase the in-place status line so subsequent stderr writes (errors,
// banners) don't collide with it. No-op when not in TTY-redraw mode.
CRAFTER_API void Clear();
// Print "Built N targets in Xms" (or equivalent) and clear in-place state.
// Safe to call multiple times; subsequent calls are no-ops.
CRAFTER_API void Finalize();
}