Browse Source

Globs remember their pattern string

Update neo-fun dep
default_compile_flags
vector-of-bool 4 years ago
parent
commit
df2725f264
5 changed files with 66 additions and 13 deletions
  1. +45
    -0
      catalog.json
  2. +1
    -1
      package.jsonc
  3. +6
    -2
      src/dds/util/glob.cpp
  4. +2
    -0
      src/dds/util/glob.hpp
  5. +12
    -10
      tools/gen-catalog-json.py

+ 45
- 0
catalog.json View File

@@ -296,6 +296,51 @@
"ref": "0.1.1",
"url": "https://github.com/vector-of-bool/neo-fun.git"
}
},
"0.2.0": {
"depends": {},
"description": "Some library fundamentals that you might find useful",
"git": {
"auto-lib": null,
"ref": "0.2.0",
"url": "https://github.com/vector-of-bool/neo-fun.git"
}
},
"0.2.1": {
"depends": {},
"description": "Some library fundamentals that you might find useful",
"git": {
"auto-lib": null,
"ref": "0.2.1",
"url": "https://github.com/vector-of-bool/neo-fun.git"
}
},
"0.3.0": {
"depends": {},
"description": "Some library fundamentals that you might find useful",
"git": {
"auto-lib": null,
"ref": "0.3.0",
"url": "https://github.com/vector-of-bool/neo-fun.git"
}
},
"0.3.1": {
"depends": {},
"description": "Some library fundamentals that you might find useful",
"git": {
"auto-lib": null,
"ref": "0.3.1",
"url": "https://github.com/vector-of-bool/neo-fun.git"
}
},
"0.3.2": {
"depends": {},
"description": "Some library fundamentals that you might find useful",
"git": {
"auto-lib": null,
"ref": "0.3.2",
"url": "https://github.com/vector-of-bool/neo-fun.git"
}
}
},
"neo-sqlite3": {

+ 1
- 1
package.jsonc View File

@@ -9,7 +9,7 @@
"range-v3": "0.10.0",
"nlohmann-json": "3.7.1",
"neo-sqlite3": "0.2.3",
"neo-fun": "0.1.1",
"neo-fun": "0.3.0",
"semver": "0.2.2",
"pubgrub": "0.2.1",
"vob-json5": "0.1.5",

+ 6
- 2
src/dds/util/glob.cpp View File

@@ -23,6 +23,7 @@ struct rglob_item {
};

struct glob_impl {
std::string spelling;
std::vector<rglob_item> items;
};

@@ -33,11 +34,11 @@ struct glob_iter_state {

const bool is_leaf_pattern = std::next(pat_iter) == impl.items.end();

fs::directory_entry entry;
fs::directory_entry entry{};
fs::directory_iterator dir_iter{root};
const bool is_rglob = !pat_iter->pattern.has_value();

std::unique_ptr<glob_iter_state> _next_state;
std::unique_ptr<glob_iter_state> _next_state{};
int _state_label = 0;

fs::directory_entry get_entry() const noexcept {
@@ -164,6 +165,7 @@ dds::detail::glob_impl compile_glob_expr(std::string_view pattern) {
throw std::runtime_error("Invalid path glob expression (Must not be empty!)");
}

acc.spelling = std::string(pattern);
return acc;
}

@@ -236,3 +238,5 @@ bool dds::glob::match(dds::path_ref filepath) const noexcept {
_impl->items.cbegin(),
_impl->items.cend());
}

std::string_view dds::glob::string() const noexcept { return _impl->spelling; }

+ 2
- 0
src/dds/util/glob.hpp View File

@@ -56,6 +56,8 @@ public:
auto end() const noexcept { return glob_iterator::sentinel_type{}; }

bool match(path_ref) const noexcept;

std::string_view string() const noexcept;
};

} // namespace dds

+ 12
- 10
tools/gen-catalog-json.py View File

@@ -114,18 +114,20 @@ packages = [
description='A modern and low-level C++ SQLite API',
git_url='https://github.com/vector-of-bool/neo-sqlite3.git',
),
Package('neo-fun', [
Version(
many_versions(
'neo-fun',
(
'0.1.0',
description='Some library fundamentals that you might find useful',
remote=Git('https://github.com/vector-of-bool/neo-fun.git',
'0.1.0')),
Version(
'0.1.1',
description='Some library fundamentals that you might find useful',
remote=Git('https://github.com/vector-of-bool/neo-fun.git',
'0.1.1'))
]),
'0.2.0',
'0.2.1',
'0.3.0',
'0.3.1',
'0.3.2',
),
description='Some library fundamentals that you might find useful',
git_url='https://github.com/vector-of-bool/neo-fun.git',
),
many_versions(
'neo-concepts',
(

Loading…
Cancel
Save