![]() |
nsbaci 1.0
|
Service for handling file system operations on BACI source files. More...
#include <fileService.h>
Public Member Functions | |
| saveResult | save (nsbaci::types::Text contents, nsbaci::types::File file) |
| Saves source code content to a file. | |
| LoadResult | load (nsbaci::types::File file) |
| Loads source code content from a file. | |
| FileService ()=default | |
| Default constructor. | |
| FileService (const FileService &)=delete | |
| FileService & | operator= (const FileService &)=delete |
| FileService (FileService &&)=default | |
| FileService & | operator= (FileService &&)=default |
Service for handling file system operations on BACI source files.
FileService provides methods for saving and loading BACI source code files. It enforces the .nsb file extension and provides detailed error reporting for various failure scenarios including:
The service is designed to be move-only (non-copyable) to ensure single ownership and prevent accidental resource duplication.
Usage example:
| LoadResult nsbaci::services::FileService::load | ( | nsbaci::types::File | file | ) |
Loads source code content from a file.
Validates the file path, extension, and existence before reading. Returns the complete file contents on success.
| file | The source file path to load (must have .nsb extension). |
| saveResult nsbaci::services::FileService::save | ( | nsbaci::types::Text | contents, |
| nsbaci::types::File | file ) |
Saves source code content to a file.
Validates the file path and extension before attempting to write. Creates or overwrites the target file with the provided contents.
| contents | The source code text to save. |
| file | The target file path (must have .nsb extension). |