Resource.hpp

1. Overview

The Resource.hpp file declares identifiers and access points for resources embedded in the application binary.

This is an interface and data-contract file. It declares the public and internal types used by this subsystem, allowing implementation files and callers to share a stable compile-time contract.

Primary responsibilities:

  • Expose compiled assets to the GTK application
  • Provide stable resource paths for icons, styles or UI data
  • Keep resource identifiers centralized

2. File Identity and Scope

  • Source path: src/Resource.hpp
  • Language: C++
  • File role: interface and data-contract file
  • Physical lines: 80
  • Non-empty lines: 68
  • SHA-256: 26e46f76f98fb24e8e6ed6eaae3b62df6495d4c30649b7d954cbe3870205d1e3

The declarations in this file use the global namespace.


3. Dependencies

3.2 Standard and External Headers

  • cstdlib
  • filesystem
  • iostream
  • string

These dependencies define the file’s compile-time integration with the recovery engine, GTK interface, on-disk format decoders, operating-system services, or C++ standard library.


4. Declared Types

No class, structure, or enumeration definition is declared directly in this file.


5. Constants and Configuration Values

  • #define DATA_DIR "/usr/share/bastionguard-recovery-data/data"

5.1 Operational Strings, Paths, Formats, or Commands

The following code literals are operationally relevant and may identify filesystem paths, helper commands, formats, signatures, or subsystem labels:

  • /usr/share/bastionguard-recovery-data/data
  • /.local/share

6. Data Members and Persistent State

The interface declares the following state-bearing members:

  • namespace fs=std::filesystem
  • std::string user_base

These members hold configuration, parser context, UI widgets, source references, progress state, recovered metadata, or temporary resources according to the owning type.


7. API and Function Inventory

The following callable interfaces or definitions were detected:

  • inline std::string resource(const std::string&rel) – Implements the operation identified by this API and updates or returns the associated state.

8. Operational Flow

The subsystem represented by this file normally participates in the following flow:

  1. Expose compiled assets to the GTK application.
  2. Provide stable resource paths for icons, styles or UI data.
  3. Keep resource identifiers centralized.
  4. Expose or execute the detected APIs: resource.
  5. Return explicit results, progress data, recovered records, or diagnostics to the calling layer.

9. Validation and Error Handling

  • Input and output paths require existence checks, permission handling and safe destination construction.

10. Runtime, Concurrency, and Resource Management

  • I/O: filesystem and raw-source operations can fail partially and must preserve exact byte counts and diagnostic context.

11. Security and Data-Recovery Considerations

  • Recovery code should prefer read-only source access and avoid writing to the original damaged medium.
  • Raw devices and image files are treated as untrusted binary input; every offset and length must remain bounded by the source size.

12. Implementation Considerations

  • Changes to public declarations can affect every translation unit that includes this header and should preserve binary and source compatibility where required.
  • State-bearing members should have explicit ownership and initialization semantics, especially for references, pointers, file descriptors and GTK widgets.
  • Filesystem operations can cross trust boundaries and should use normalized, contained destination paths.

13. Integration with the Recovery Pipeline

  • The file belongs to the application startup or presentation layer.
  • It receives or presents data produced by scan and recovery services.
  • Long-running operations should remain delegated to worker classes rather than blocking the GTK main loop.

14. Licensing and Provenance

The source header contains the following licensing or copyright statements:

  • Copyright (C) 2025–2026 Calogero Scarnà
  • SPDX-License-Identifier: GPL-3.0-or-later
  • it under the terms of the GNU General Public License as published by
  • GNU General Public License for more details.

The SHA-256 value in this document can be used to associate the generated documentation with the exact source version analyzed.