|
ACAV f0ba4b7c9529
Abstract Syntax Tree (AST) visualization tool for C, C++, and Objective-C
|
Centralized file registry providing path-to-FileID mapping. More...
#include <FileManager.h>
Public Member Functions | |
| FileManager (const FileManager &)=delete | |
| FileManager & | operator= (const FileManager &)=delete |
| FileManager (FileManager &&)=delete | |
| FileManager & | operator= (FileManager &&)=delete |
| FileID | registerFile (std::string_view filePath) |
| Register a file and return its FileID. | |
| std::optional< FileID > | tryGetFileId (std::string_view filePath) const |
| Look up FileID for a path without registering. | |
| std::string_view | getFilePath (FileID id) const |
| Get the canonical path for a FileID. | |
| std::size_t | getRefCount (FileID id) const |
| Get reference count for a file. | |
| std::size_t | getRegisteredFileCount () const |
| Get total number of registered files. | |
| bool | isValidFileId (FileID id) const |
| Check if a FileID is valid. | |
Static Public Attributes | |
| static constexpr FileID | InvalidFileID = 0 |
| Reserved invalid FileID. | |
Centralized file registry providing path-to-FileID mapping.
Implements memory optimization similar to LLVM's StringRef pattern: AST nodes store FileID references instead of full paths. Thread-safe with path normalization and reference counting.
Definition at line 45 of file FileManager.h.
| std::string_view acav::FileManager::getFilePath | ( | FileID | id | ) | const |
Get the canonical path for a FileID.
| id | FileID to look up. |
Definition at line 73 of file FileManager.cpp.
References isValidFileId().
| std::size_t acav::FileManager::getRefCount | ( | FileID | id | ) | const |
Get reference count for a file.
| id | FileID to query. |
Definition at line 84 of file FileManager.cpp.
References isValidFileId().
| std::size_t acav::FileManager::getRegisteredFileCount | ( | ) | const |
Get total number of registered files.
Definition at line 94 of file FileManager.cpp.
| bool acav::FileManager::isValidFileId | ( | FileID | id | ) | const |
Check if a FileID is valid.
Definition at line 99 of file FileManager.cpp.
References InvalidFileID.
Referenced by getFilePath(), and getRefCount().
| FileID acav::FileManager::registerFile | ( | std::string_view | filePath | ) |
Register a file and return its FileID.
| filePath | Path to the file (will be normalized). |
Definition at line 29 of file FileManager.cpp.
Referenced by acav::SourceLocation::fromClang().
| std::optional< FileID > acav::FileManager::tryGetFileId | ( | std::string_view | filePath | ) | const |
Look up FileID for a path without registering.
| filePath | Path to look up (will be normalized). |
Definition at line 59 of file FileManager.cpp.
Referenced by acav::SourceLocation::fromClang().
|
staticconstexpr |
Reserved invalid FileID.
Definition at line 47 of file FileManager.h.
Referenced by acav::SourceLocationIndex::addNode(), acav::SourceCodeView::clearView(), acav::SourceLocation::fromClang(), acav::SourceRange::fromClang(), acav::SourceCodeView::highlightRange(), isValidFileId(), acav::SourceCodeView::keyPressEvent(), and acav::SourceCodeView::sourceRangeSelected().