FBB::Glob(3bobcat)
π FBB::Glob β files matching a pattern β¨
okay so bestie, this is FBB::Glob, a page from the bobcat manual (you know, section 3, the C++ library one) π¦ and literally all it wants to do is hand you a list of files that match a pattern. that's it. that's the whole vibe. π
π NAME
FBB::Glob β a wrapper around glob(3) that finds files matching a pattern π
π«Ά SYNOPSIS
#include <bobcat/glob>
Linking option: -lbobcat
πΈ DESCRIPTION
The FBB::Glob class is a wrapper around the C function glob(3). Ngl that's its entire personality. It gives you back a list of files matching whatever pattern you fed to FBB::Glob's constructors or members. no cap. π
π§ NAMESPACE
FBB
Every single constructor, member, operator and manipulator mentioned anywhere in this man-page lives in the namespace FBB. all of them. the whole squad. π
β INHERITS FROM
-
(yeah, it inherits from nothing. it's self-made, main character energy fr fr π )
π ENUMERATIONS
π Glob::Type
This enumeration is identical to the stat(3bobcat) Type enumeration, and it defines these values:
BLOCK_DEVICE(0060000) β the object is a block device;CHARACTER_DEVICE(0020000) β the object is a character device;DIRECTORY(0040000) β the object is a directory;FIFO(0010000) β the object is a named pipe (a queue);REGULAR_FILE(0100000) β the object is a regular file;SOCKET(0140000) β the object is a socket;SYMBOLIC_LINK(0120000) β the object is a symbolic link;ANYβ any of the above types.
These values are also used by stat(2) and lstat(2). Now here's the tea β β you can combine them with the bitor operator, but when they're combined they are not uniquely recognizable. Like, CHARACTER_DEVICE | DIRECTORY is literally equal to BLOCK_DEVICE. that's cursed, bestie π. It's also possible to combine Type values in a std::unordered_set, which avoids the confusion that may result from using the bitor operator. slay.
π Glob::Flags
NO_FLAGβ Equals0, and can be used to avoid having to specify0. It has no further use. (yes it's just a fancy zero, leave it alone π)ERRβ Return on read errors;MARKβ Append a slash to each name.NOSORTβ Don't sort the names.NOESCAPEβ Backslashes don't quote metacharacters.PERIODβ Leading.-characterscan be matched by metachars (i.e.,*and?).NOMATCHβ When specified the constructors won't throw exceptions when no files matching their glob-patterns could be found. Instead they will return normally, andGlob'ssize()member (see below) will return0.
π Glob::Dots
FIRSTβ Filenames starting with a dot will be listed first. Within this set and in the leftover-set the relative ordering is maintained.DEFAULTβ Return filenames as they appear in the globbing process.
π¦ CONSTRUCTORS
Glob(std::string const &pattern = "*", int flags = PERIOD, Dots dots = FIRST)β This constructor (which can also be used as the default constructor) determines all elements matching pattern.
An Exception exception is thrown if the constructor could not properly complete it tasks.
Multiple flags may be specified, separated by the bitor operator.
This constructor properly completes its task if only defined Flag values were specified and if the glob(3) function returned without errors;
Glob(Type type, std::string const &pattern = "*", int flags = PERIOD, Dots dots = FIRST)β This constructor determines all elements of pattern when their typeselementType' are equal to the value of elementType & type. The specified type value may consist of anybitor-ed combination of enum values defined by theTypeenum. π Note that this may produce confusing results. E.g., when specifyingDIRECTORY, elements that areBLOCK_DEVICEs orSOCKETs are also accepted. The next constructor can be used to avoid this confusion;Glob(std::unordered_set<Type> const &typeSet, std::string const &pattern = "*", int flags = PERIOD, Dots dots = FIRST)β This constructor determines all elements of pattern when their types are found in typeSet. Different from the previous constructor, for an element to be accepted its type must exactly match atypevalue in the typeSet set. precision, periodt. β¨
Copy and move constructors (and assignment operators) are available. π«Ά
π OVERLOADED OPERATORS
char const *operator[](size_t idx) constβ The element at index position idx is returns as a C string. It returns an empty string if idx is or exceedssize().
π₯ MEMBER FUNCTIONS
size_t size() constβ Returns the number of elements that were detected;char const *const *begin() constβ Returns a pointer to the first element that was detected. This pointer can be used in generic algorithms as an output-iterator supporting pointer arithmetic;char const *const *end() constβ Returns a pointer beyond the last element that was detected. This pointer can be used in generic algorithms as an output-iterator supporting pointer arithmetic;void swap(Glob &other)β Swaps the content of the other object with the current object.
π EXAMPLES
int main(int argc, char **argv)
{
if (argc == 1)
{
cout << "Provide glob-expression as 1st arg\n";
return 1;
}
cout << "General:\n";
Glob general;
for (size_t idx = 0; idx < general.size(); idx++)
cout << idx << ": " << general[idx] << endl;
cout << "Pattern: " << argv[1] << "\n";
Glob pattern(argv[1], Glob::PERIOD, Glob::DEFAULT);
for (size_t idx = 0; idx < pattern.size(); idx++)
cout << idx << ": " << pattern[idx] << endl;
}
π FILES
bobcat/glob β defines the class interface
π SEE ALSO
bobcat(7), stat(3bobcat), glob(3)
π BUGS
No Reported Bugs. (iconic behaviour honestly π)
π BOBCAT PROJECT FILES
- https://fbb-git.gitlab.io/bobcat/ β gitlab project page;
Debian Bobcat project files:
libbobcat6β debian package containing the shared library, changelog and copyright note;libbobcat-devβ debian package containing the static library, headers, manual pages, and developer info;
π BOBCAT
Bobcat is an acronym of Brokken's Own Base Classes And Templates. iykyk π
β COPYRIGHT
This is free software, distributed under the terms of the GNU General Public License (GPL).
π AUTHOR
Frank B. Brokken (f.b.brokken@rug.nl).
okay that's the whole page bestie, you ate it up π«Ά this was libbobcat-dev_6.15.01, dated 2005-2026, and yes it's still FBB::Glob(3bobcat). go glob some files, you got this π¦β¨
π¦ where this page comes from
- ubuntu stonking: libbobcat-dev 6.15.01-1 Β· GPL-3.0-or-later WITH OpenSSL exception
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms