MayaFlux
1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
FunctionCollector.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include "
FunctionRequest.hpp
"
4
5
namespace
MayaFlux::Reflect::Tool
{
6
7
/**
8
* @class FunctionCollector
9
* @brief Turns each MF_DESCRIBE_FUNCTION variable in the scanned translation unit into a FunctionRequest.
10
*
11
* Attach it to a MatchFinder, run the finder, then read requests() and errors(). Requests are
12
* grouped by the header holding the marker. A function that is a member, still a template, or
13
* has a parameter without a name is an error, since a parameter name is what a caller refers to.
14
*
15
* The scan switches sidecars off, so a header that holds requests must not use what its own
16
* sidecar generates. Keep the described functions in a header of their own.
17
*/
18
class
FunctionCollector
:
public
clang::ast_matchers::MatchFinder::MatchCallback {
19
public
:
20
/** @brief Registers the matcher for the marker variables on @p finder. */
21
void
attach
(clang::ast_matchers::MatchFinder& finder);
22
23
void
run
(
const
clang::ast_matchers::MatchFinder::MatchResult& result)
override
;
24
25
[[nodiscard]]
const
FunctionMap
&
requests
() const noexcept {
return
m_requests
; }
26
[[nodiscard]]
const
std::vector<std::string>&
errors
() const noexcept {
return
m_errors
; }
27
28
/** @brief Marker variables the matcher reached, before any filtering. */
29
[[nodiscard]] std::size_t
matched
() const noexcept {
return
m_matched
; }
30
31
private
:
32
FunctionMap
m_requests
;
33
std::vector<std::string>
m_errors
;
34
std::size_t
m_matched
{};
35
};
36
37
}
FunctionRequest.hpp
MayaFlux::Reflect::Tool::FunctionCollector::m_errors
std::vector< std::string > m_errors
Definition
FunctionCollector.hpp:33
MayaFlux::Reflect::Tool::FunctionCollector::requests
const FunctionMap & requests() const noexcept
Definition
FunctionCollector.hpp:25
MayaFlux::Reflect::Tool::FunctionCollector::m_matched
std::size_t m_matched
Definition
FunctionCollector.hpp:34
MayaFlux::Reflect::Tool::FunctionCollector::attach
void attach(clang::ast_matchers::MatchFinder &finder)
Registers the matcher for the marker variables on finder.
Definition
FunctionCollector.cpp:91
MayaFlux::Reflect::Tool::FunctionCollector::matched
std::size_t matched() const noexcept
Marker variables the matcher reached, before any filtering.
Definition
FunctionCollector.hpp:29
MayaFlux::Reflect::Tool::FunctionCollector::m_requests
FunctionMap m_requests
Definition
FunctionCollector.hpp:32
MayaFlux::Reflect::Tool::FunctionCollector::errors
const std::vector< std::string > & errors() const noexcept
Definition
FunctionCollector.hpp:26
MayaFlux::Reflect::Tool::FunctionCollector
Turns each MF_DESCRIBE_FUNCTION variable in the scanned translation unit into a FunctionRequest.
Definition
FunctionCollector.hpp:18
run
void run()
Definition
main.cpp:21
MayaFlux::Reflect::Tool::FunctionMap
std::map< std::filesystem::path, HeaderFunctions > FunctionMap
Definition
FunctionRequest.hpp:31
MayaFlux::Reflect::Tool
Definition
Build.cpp:19
src
Tools
Reflect
FunctionCollector.hpp
Generated by
1.15.0