Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/podio/utilities/Glob.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 #ifndef PODIO_UTILITIES_GLOB_H
0002 #define PODIO_UTILITIES_GLOB_H
0003 #include <string>
0004 #include <vector>
0005 
0006 // Support for glob expansion.
0007 #if __has_include(<glob.h>)
0008   #define PODIO_HAS_GLOB_SUPPORT 1
0009 #else
0010   #define PODIO_HAS_GLOB_SUPPORT 0
0011 #endif
0012 
0013 namespace podio::utils {
0014 /// @brief Expands a given glob pattern into a list of matching file paths.
0015 ///
0016 /// This function takes a glob pattern as input and returns a vector of strings
0017 /// containing the paths that match the pattern. It supports standard glob rules
0018 /// extended with tilde expansion and brace expansion. If the pattern doesn't
0019 /// contain any wildcards then it is placed in the returned vector as is. Paths
0020 /// that cannot be accessed are displayed on std::cerr, but the expansion process
0021 /// is not aborted. On platforms without <glob.h> no expansion is done and vector
0022 /// containing the original pattern is returned
0023 ///
0024 /// @param pattern The glob pattern to expand.
0025 /// @return A vector of strings containing the matching file paths.
0026 ///
0027 /// @throws std::runtime_error If no matches are found or if there is an error
0028 ///         during glob expansion.
0029 std::vector<std::string> expand_glob(const std::string& pattern);
0030 
0031 /// @brief Checks if a given pattern is a glob pattern.
0032 ///
0033 /// This function determines whether the provided pattern contains any standard
0034 /// glob or brace expansion wildcards.
0035 ///
0036 /// @param pattern The pattern to check.
0037 /// @return true if the pattern is a glob pattern, false otherwise.
0038 bool is_glob_pattern(const std::string& pattern);
0039 
0040 } // namespace podio::utils
0041 
0042 #endif // PODIO_UTILITIES_GLOB_H