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

"ref": "0.1.1", "ref": "0.1.1",
"url": "https://github.com/vector-of-bool/neo-fun.git" "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": { "neo-sqlite3": {

+ 1
- 1
package.jsonc View File

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

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

}; };


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




const bool is_leaf_pattern = std::next(pat_iter) == impl.items.end(); 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}; fs::directory_iterator dir_iter{root};
const bool is_rglob = !pat_iter->pattern.has_value(); 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; int _state_label = 0;


fs::directory_entry get_entry() const noexcept { fs::directory_entry get_entry() const noexcept {
throw std::runtime_error("Invalid path glob expression (Must not be empty!)"); throw std::runtime_error("Invalid path glob expression (Must not be empty!)");
} }


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


_impl->items.cbegin(), _impl->items.cbegin(),
_impl->items.cend()); _impl->items.cend());
} }

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

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

auto end() const noexcept { return glob_iterator::sentinel_type{}; } auto end() const noexcept { return glob_iterator::sentinel_type{}; }


bool match(path_ref) const noexcept; bool match(path_ref) const noexcept;

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


} // namespace dds } // namespace dds

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

description='A modern and low-level C++ SQLite API', description='A modern and low-level C++ SQLite API',
git_url='https://github.com/vector-of-bool/neo-sqlite3.git', git_url='https://github.com/vector-of-bool/neo-sqlite3.git',
), ),
Package('neo-fun', [
Version(
many_versions(
'neo-fun',
(
'0.1.0', '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', '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( many_versions(
'neo-concepts', 'neo-concepts',
( (

Loading…
Cancel
Save