Browse Source

File extensions _must_ be sorted

default_compile_flags
vector-of-bool 5 years ago
parent
commit
a642a5bf60
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      src/dds/source.cpp

+ 4
- 1
src/dds/source.cpp View File

#include <dds/util/string.hpp> #include <dds/util/string.hpp>


#include <algorithm> #include <algorithm>
#include <cassert>
#include <optional> #include <optional>
#include <vector> #include <vector>




std::optional<source_kind> dds::infer_source_kind(path_ref p) noexcept { std::optional<source_kind> dds::infer_source_kind(path_ref p) noexcept {
static std::vector<std::string_view> header_exts = { static std::vector<std::string_view> header_exts = {
".h",
".H", ".H",
".H++", ".H++",
".h",
".h++", ".h++",
".hh", ".hh",
".hpp", ".hpp",
".hxx", ".hxx",
".inl", ".inl",
}; };
assert(std::is_sorted(header_exts.begin(), header_exts.end()));
static std::vector<std::string_view> source_exts = { static std::vector<std::string_view> source_exts = {
".C", ".C",
".c", ".c",
".cpp", ".cpp",
".cxx", ".cxx",
}; };
assert(std::is_sorted(source_exts.begin(), source_exts.end()));
auto leaf = p.filename(); auto leaf = p.filename();


auto ext_found auto ext_found

Loading…
Cancel
Save