X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fvirtualfilesystem.h;h=b19d10e8b45382ae9d18f89d77a7eb55546fe885;hb=1d687970cc35e54c3335f4aa2fdef23424fe0a06;hp=16f8c6d9e7e2a3e0bfafd3fb5a7f9a01c0828d62;hpb=bd2a50ecb9f582c6e9569ffc9f33d41f10363c5f;p=builder.git diff --git a/source/virtualfilesystem.h b/source/virtualfilesystem.h index 16f8c6d..b19d10e 100644 --- a/source/virtualfilesystem.h +++ b/source/virtualfilesystem.h @@ -7,7 +7,13 @@ class Builder; 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: @@ -26,30 +32,24 @@ 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. */ - FileTarget *find_header(const std::string &, const Msp::FS::Path &, 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 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 &); + + /** 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 &, const std::string &); }; #endif