MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Reflect::Tool Namespace Reference

Classes

struct  BuildScanInput
 What a build scan needs: a ScanInput, plus optional explicit compile arguments. More...
struct  ConstructorSignature
 One public constructor a Creator method is generated from. More...
struct  CreatorBuildOptions
 What mayaflux_signatures --build needs to write the Creator files. More...
struct  FunctionBuildOptions
 What mayaflux_signatures --functions --build needs to describe the functions of one header. More...
class  FunctionCollector
 Turns each MF_DESCRIBE_FUNCTION variable in the scanned translation unit into a FunctionRequest. More...
struct  FunctionRequest
 One described function: how to name it as a template argument, and its parameter names. More...
struct  HeaderFunctions
 Every function described by the MF_DESCRIBE_FUNCTION markers of one header. More...
struct  HeaderRequests
 Every record described by the MF_DESCRIBE markers of one header. More...
struct  RecordRequest
 One described record: its qualified name and the names of its public data members. More...
struct  ReflectBuildOptions
 What mayaflux_reflect --build needs to describe one header. More...
class  RequestCollector
 Turns each MF_DESCRIBE alias in the scanned translation unit into a RecordRequest. More...
struct  ScanInput
 What one scan needs: the compile database, the headers, and flag overrides. More...
struct  SignatureClass
 A registered class as the scan found it. More...
class  SignatureCollector
 Reads the public constructors of each registered class from the scanned translation unit. More...
struct  SignatureEntry
 One class of the Creator registry: the method name, its qualified type and its header. More...
struct  SignatureFiles
 The four generated files of the Creator proxy, as text. More...
struct  SignatureParameter
 One constructor parameter: its fully qualified type, its name and its default argument text. More...

Typedefs

using AttachMatchers = std::function<void(clang::ast_matchers::MatchFinder&)>
 Registers the matchers of one tool on the MatchFinder a scan runs.
using FunctionMap = std::map<std::filesystem::path, HeaderFunctions>
using RequestMap = std::map<std::filesystem::path, HeaderRequests>

Functions

std::vector< std::string > check_function_sidecars (const FunctionMap &requests, const std::vector< std::filesystem::path > &headers, const std::vector< std::filesystem::path > &existing)
 Compares the function sidecars on disk with what the generator would write, touching nothing.
std::optional< std::string > check_include (const HeaderRequests &requests)
 Checks that the header includes its sidecar exactly once, after its last marker.
std::optional< std::string > check_include (const std::filesystem::path &header, unsigned last_marker, std::string_view suffix)
 check_include() for any marker, given the header, the line of its last marker and the sidecar suffix.
std::vector< std::string > check_sidecars (const RequestMap &requests, const std::vector< std::filesystem::path > &headers, const std::vector< std::filesystem::path > &existing)
 Compares the sidecars on disk with what the generator would write, touching nothing.
std::vector< std::filesystem::path > discover_headers (const std::vector< std::filesystem::path > &roots)
 Finds headers under roots that contain an MF_DESCRIBE request.
std::vector< std::filesystem::path > discover_headers (const std::vector< std::filesystem::path > &roots, std::string_view marker)
 discover_headers() for another request marker, such as MF_DESCRIBE_FUNCTION.
std::vector< std::filesystem::path > discover_sidecars (const std::vector< std::filesystem::path > &roots)
 Every Name.describe.hpp under the directories among roots, canonical and sorted.
std::vector< std::filesystem::path > discover_sidecars (const std::vector< std::filesystem::path > &roots, std::string_view suffix)
 discover_sidecars() for another sidecar suffix, such as ".signatures.hpp".
bool ensure_stub (const std::filesystem::path &path, std::string &error)
 Writes an empty sidecar when none exists, so the include never fails a first scan.
bool insert_include (const HeaderRequests &requests, bool &inserted, std::string &error)
 Inserts the sidecar include on the line after the last marker when the header has none.
bool insert_include (const std::filesystem::path &header, unsigned last_marker, std::string_view suffix, bool &inserted, std::string &error)
 insert_include() for any marker, given the header, the line of its last marker and the sidecar suffix.
unsigned last_function_line (const HeaderFunctions &functions)
 The line after which the sidecar include may appear: the last marker of the header.
std::optional< std::vector< SignatureEntry > > read_signature_entries (const std::filesystem::path &registry, const std::filesystem::path &source_root, std::string &error)
 Reads the N, W and B registrations of the registry header and finds each class's header.
std::optional< std::string > read_text (const std::filesystem::path &path)
 The whole content of path, or nullopt when it cannot be read.
std::string render_function_sidecar (const HeaderFunctions &functions)
 Text of the sidecar for one header, one Signature specialization per function, sorted by name.
std::string render_sidecar (const HeaderRequests &requests)
 Text of the sidecar for one header, with its records sorted by name.
SignatureFiles render_signature_files (const std::vector< SignatureClass > &classes, const std::filesystem::path &source_root)
 Renders the generated files for the non abstract classes of classes.
std::string resolve_resource_dir (const std::string &configured)
 The Clang resource directory a build scan uses.
int run_creator_build (const CreatorBuildOptions &options)
 Writes the four Creator files, for a build step.
int run_function_build (const FunctionBuildOptions &options)
 Writes the function sidecar of one header, for a build step.
int run_reflect_build (const ReflectBuildOptions &options)
 Writes the sidecar of one header, for a build step.
bool scan (const ScanInput &input, const AttachMatchers &attach, std::string &error)
 Parses every header of input in one translation unit and runs the matchers attach registers.
bool scan (const ScanInput &input, RequestCollector &collector, std::string &error)
 Parses every header of input in one translation unit and fills collector.
bool scan_for_build (const BuildScanInput &input, const AttachMatchers &attach, std::vector< std::filesystem::path > &dependencies, std::string &error)
 scan() for a build step: also reports the files the scan read.
std::filesystem::path sidecar_path (const std::filesystem::path &header)
 Path of the sidecar for header: Name.hpp becomes Name.describe.hpp beside it.
std::filesystem::path sidecar_path (const std::filesystem::path &header, std::string_view suffix)
 sidecar_path() with another suffix, such as ".signatures.hpp": Name.hpp becomes Name.signatures.hpp.
std::vector< std::filesystem::path > without_sidecars (std::vector< std::filesystem::path > dependencies)
 dependencies without files that end in a generated sidecar suffix.
bool write_depfile (const std::filesystem::path &path, const std::string &target, const std::vector< std::filesystem::path > &dependencies, std::string &error)
 Writes a depfile of the form target: dependency... that CMake's DEPFILE reads.
bool write_generated (const std::filesystem::path &path, const std::string &content, std::string &error)
 Writes content when it differs, then marks path as modified now.
bool write_if_changed (const std::filesystem::path &path, const std::string &content, std::string &error)
 Replaces path with content only when the content differs.

Variables

constexpr std::string_view function_sidecar_suffix = ".signatures.hpp"
 The suffix of a function sidecar: Name.hpp becomes Name.signatures.hpp beside it.