HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Member Functions
hi::v1::glob_pattern Class Reference

#include <hikogui/path/glob.hpp>

Public Member Functions

constexpr glob_pattern (glob_pattern const &) noexcept=default
 
constexpr glob_pattern (glob_pattern &&) noexcept=default
 
constexpr glob_patternoperator= (glob_pattern const &) noexcept=default
 
constexpr glob_patternoperator= (glob_pattern &&) noexcept=default
 
constexpr glob_pattern (std::u32string_view str)
 Parse a string to a glob-pattern.
 
constexpr glob_pattern (std::u32string const &str)
 Parse a string to a glob-pattern.
 
constexpr glob_pattern (char32_t const *str)
 Parse a string to a glob-pattern.
 
constexpr glob_pattern (std::string_view str)
 Parse a string to a glob-pattern.
 
constexpr glob_pattern (std::string const &str)
 Parse a string to a glob-pattern.
 
constexpr glob_pattern (char const *str)
 Parse a string to a glob-pattern.
 
 glob_pattern (std::filesystem::path const &path)
 Parse a path to a glob-pattern.
 
constexpr std::u32string u32string () noexcept
 Convert a glob-pattern to a string.
 
constexpr std::string string () noexcept
 Convert a glob-pattern to a string.
 
constexpr std::u32string debug_u32string () noexcept
 Convert a glob-pattern to a debug-string.
 
constexpr std::string debug_string () noexcept
 Convert a glob-pattern to a debug-string.
 
constexpr std::u32string base_u32string () const noexcept
 Get the initial fixed part of the pattern.
 
constexpr std::string base_string () const noexcept
 Get the initial fixed part of the pattern.
 
std::filesystem::path base_path () const noexcept
 Get the initial path of the pattern.
 
constexpr bool matches (std::u32string_view str) const noexcept
 Match the pattern with the given string.
 
constexpr bool matches (std::u32string const &str) const noexcept
 Match the pattern with the given string.
 
constexpr bool matches (char32_t const *str) const noexcept
 Match the pattern with the given string.
 
constexpr bool matches (std::string_view str) const noexcept
 Match the pattern with the given string.
 
constexpr bool matches (std::string const &str) const noexcept
 Match the pattern with the given string.
 
constexpr bool matches (char const *str) const noexcept
 Match the pattern with the given string.
 
bool matches (std::filesystem::path const &path) const noexcept
 Match the pattern with the given path.
 

Detailed Description

A glob pattern.

A glob algorithm is used for matching with filenames and directories. Glob may also be used on strings that do not involve the filesystem at all, however certain tokens implicitly include or exclude the slash '/' character.

Token Description
foo Matches the text "foo".
? Matches any single code-unit except '/'.
[abcd] Matches a single code-unit that is 'a', 'b', 'c' or 'd'.
[a-d] Matches a single code-unit that is 'a', 'b', 'c' or 'd'.
[-a-d] Matches a single code-unit that is '-', 'a', 'b', 'c' or 'd'.
{foo,bar,baz} Matches the text "foo", "bar" or "baz".
* Matches zero or more code-units except '/'.
/ ** / Matches A single slash '/' or zero or more code-units between two slashes '/'.

Constructor & Destructor Documentation

◆ glob_pattern() [1/7]

constexpr hi::v1::glob_pattern::glob_pattern ( std::u32string_view str)
inlineconstexpr

Parse a string to a glob-pattern.

Parameters
strThe string to be parsed.

◆ glob_pattern() [2/7]

constexpr hi::v1::glob_pattern::glob_pattern ( std::u32string const & str)
inlineconstexpr

Parse a string to a glob-pattern.

Parameters
strThe string to be parsed.

◆ glob_pattern() [3/7]

constexpr hi::v1::glob_pattern::glob_pattern ( char32_t const * str)
inlineconstexpr

Parse a string to a glob-pattern.

Parameters
strThe string to be parsed.

◆ glob_pattern() [4/7]

constexpr hi::v1::glob_pattern::glob_pattern ( std::string_view str)
inlineconstexpr

Parse a string to a glob-pattern.

Parameters
strThe string to be parsed.

◆ glob_pattern() [5/7]

constexpr hi::v1::glob_pattern::glob_pattern ( std::string const & str)
inlineconstexpr

Parse a string to a glob-pattern.

Parameters
strThe string to be parsed.

◆ glob_pattern() [6/7]

constexpr hi::v1::glob_pattern::glob_pattern ( char const * str)
inlineconstexpr

Parse a string to a glob-pattern.

Parameters
strThe string to be parsed.

◆ glob_pattern() [7/7]

hi::v1::glob_pattern::glob_pattern ( std::filesystem::path const & path)
inline

Parse a path to a glob-pattern.

Parameters
pathThe path to be parsed.

Member Function Documentation

◆ base_path()

std::filesystem::path hi::v1::glob_pattern::base_path ( ) const
inlinenoexcept

Get the initial path of the pattern.

This gets the initial path of the pattern that is fixed, this is used for as a starting point for a search.

For example this will be the directory where to start recursively iterating on.

Returns
The initial fixed path of the pattern.

◆ base_string()

constexpr std::string hi::v1::glob_pattern::base_string ( ) const
inlineconstexprnoexcept

Get the initial fixed part of the pattern.

This gets the initial part of the pattern that is fixed, this is used for as a starting point for a search.

For example by getting the base_string you can use a binary-search into a sorted list of strings, then once you find a string you can iterate over the list and glob-match each string.

Returns
The initial fixed part of the pattern.

◆ base_u32string()

constexpr std::u32string hi::v1::glob_pattern::base_u32string ( ) const
inlineconstexprnoexcept

Get the initial fixed part of the pattern.

This gets the initial part of the pattern that is fixed, this is used for as a starting point for a search.

For example by getting the base_string you can use a binary-search into a sorted list of strings, then once you find a string you can iterate over the list and glob-match each string.

Returns
The initial fixed part of the pattern.

◆ debug_string()

constexpr std::string hi::v1::glob_pattern::debug_string ( )
inlineconstexprnoexcept

Convert a glob-pattern to a debug-string.

This function is used for debugging the glob parser, and for using in unit-tests.

Returns
The string representing the pattern

◆ debug_u32string()

constexpr std::u32string hi::v1::glob_pattern::debug_u32string ( )
inlineconstexprnoexcept

Convert a glob-pattern to a debug-string.

This function is used for debugging the glob parser, and for using in unit-tests.

Returns
The string representing the pattern

◆ matches() [1/7]

constexpr bool hi::v1::glob_pattern::matches ( char const * str) const
inlineconstexprnoexcept

Match the pattern with the given string.

Parameters
strThe string to match with this pattern.
Returns
True if the string matches the pattern.

◆ matches() [2/7]

constexpr bool hi::v1::glob_pattern::matches ( char32_t const * str) const
inlineconstexprnoexcept

Match the pattern with the given string.

Parameters
strThe string to match with this pattern.
Returns
True if the string matches the pattern.

◆ matches() [3/7]

bool hi::v1::glob_pattern::matches ( std::filesystem::path const & path) const
inlinenoexcept

Match the pattern with the given path.

Parameters
pathThe path to match with this pattern.
Returns
True if the path matches the pattern.

◆ matches() [4/7]

constexpr bool hi::v1::glob_pattern::matches ( std::string const & str) const
inlineconstexprnoexcept

Match the pattern with the given string.

Parameters
strThe string to match with this pattern.
Returns
True if the string matches the pattern.

◆ matches() [5/7]

constexpr bool hi::v1::glob_pattern::matches ( std::string_view str) const
inlineconstexprnoexcept

Match the pattern with the given string.

Parameters
strThe string to match with this pattern.
Returns
True if the string matches the pattern.

◆ matches() [6/7]

constexpr bool hi::v1::glob_pattern::matches ( std::u32string const & str) const
inlineconstexprnoexcept

Match the pattern with the given string.

Parameters
strThe string to match with this pattern.
Returns
True if the string matches the pattern.

◆ matches() [7/7]

constexpr bool hi::v1::glob_pattern::matches ( std::u32string_view str) const
inlineconstexprnoexcept

Match the pattern with the given string.

Parameters
strThe string to match with this pattern.
Returns
True if the string matches the pattern.

◆ string()

constexpr std::string hi::v1::glob_pattern::string ( )
inlineconstexprnoexcept

Convert a glob-pattern to a string.

Returns
The string representing the pattern

◆ u32string()

constexpr std::u32string hi::v1::glob_pattern::u32string ( )
inlineconstexprnoexcept

Convert a glob-pattern to a string.

Returns
The string representing the pattern

The documentation for this class was generated from the following file: