class FileTarget;
class Pattern;
+/**
+Provides access to the filesystem in a way that takes known targets into
+account. Thus, targets may be returned for files that do not exist yet if it's
+possible to build them.
+*/
class VirtualFileSystem
{
public:
FileTarget *get_target(const Msp::FS::Path &) const;
+ /** Registers a target with the VFS. A target may be registered at multiple
+ paths if building it results in multiple files. */
void register_path(const Msp::FS::Path &, FileTarget *);
- /** Tries to locate a header based on location of including file and include
- path. Considers known targets as well as existing files. If a matching
- target is not found but a file exists, a new SystemHeader target will be
- created and returned. */
+ /** Locates a source file. If a file is found but no target is associated
+ with it, a new package-less target is created with the appropriate tool. */
FileTarget *find_header(const std::string &, const SearchPath &);
- /** Tries to locate a library in a library path. The library name should be
- the same as would be given to the linker with -l, i.e. without the "lib"
- prefix or extension. Considers known targets as well as existing files. If
- a matching target is not found but a file exists, a new SystemLibrary target
- will be created and returned. */
+ /** Locates a library. The library name should be the same as what would be
+ used in linking with the library. If a file is found but no target is
+ associated with it, a new package-less target of appropriate type is
+ created. */
FileTarget *find_library(const std::string &, const SearchPath &, LibMode);
private:
- /**
- Check if a header exists, either as a target or a file. Returns an existing
- target of one was found, or a new SystemHeader target if there was no known
- target but the file exists.
- */
- FileTarget *get_header(const Msp::FS::Path &);
-
+ FileTarget *get_header(const Msp::FS::Path &, const Tool &);
FileTarget *get_library(const std::string &, const Msp::FS::Path &, LibMode);
-
Msp::FS::Path try_patterns(const Msp::FS::Path &, const std::list<Pattern> &, const std::string &);
};