7 constexpr std::string_view default_marker =
"MF_DESCRIBE";
8 constexpr std::string_view default_suffix =
".describe.hpp";
10 bool is_header(
const std::filesystem::path& path)
12 const std::string name = path.filename().string();
13 if (name.ends_with(
".describe.hpp") || name.ends_with(
".signatures.hpp")) {
16 const std::string extension = path.extension().string();
17 return extension ==
".hpp" || extension ==
".h" || extension ==
".hh" || extension ==
".hxx";
20 bool has_request(
const std::filesystem::path& path, std::string_view marker)
22 std::ifstream stream(path);
24 while (std::getline(stream, line)) {
25 std::string_view view(line);
26 while (!view.empty() && (view.front() ==
' ' || view.front() ==
'\t' || view.front() ==
';' || view.front() ==
'}')) {
27 view.remove_prefix(1);
29 if (!view.starts_with(marker)) {
32 view.remove_prefix(marker.size());
33 while (!view.empty() && (view.front() ==
' ' || view.front() ==
'\t')) {
34 view.remove_prefix(1);
36 if (!view.empty() && view.front() ==
'(') {
45std::vector<std::filesystem::path>
discover_headers(
const std::vector<std::filesystem::path>& roots)
51 const std::vector<std::filesystem::path>& roots, std::string_view marker)
53 std::vector<std::filesystem::path> found;
55 for (
const auto& root : roots) {
56 if (std::filesystem::is_regular_file(root, code)) {
57 if (is_header(root) && has_request(root, marker)) {
58 found.push_back(std::filesystem::canonical(root, code));
62 for (std::filesystem::recursive_directory_iterator it(root, code), end; it != end; it.increment(code)) {
66 if (it->is_regular_file(code) && is_header(it->path()) && has_request(it->path(), marker)) {
67 found.push_back(std::filesystem::canonical(it->path(), code));
71 std::ranges::sort(found);
72 found.erase(std::ranges::unique(found).begin(), found.end());
76std::vector<std::filesystem::path>
discover_sidecars(
const std::vector<std::filesystem::path>& roots)
82 const std::vector<std::filesystem::path>& roots, std::string_view suffix)
84 std::vector<std::filesystem::path> found;
86 for (
const auto& root : roots) {
87 if (!std::filesystem::is_directory(root, code)) {
90 for (std::filesystem::recursive_directory_iterator it(root, code), end; it != end; it.increment(code)) {
94 if (it->is_regular_file(code) && it->path().filename().string().ends_with(suffix)) {
95 found.push_back(std::filesystem::canonical(it->path(), code));
99 std::ranges::sort(found);
100 found.erase(std::ranges::unique(found).begin(), found.end());
Vruta::SoundRoutine line(float start_value, float end_value, float duration_seconds, uint32_t step_duration, bool restartable)
Creates a continuous interpolation generator between two values over time.