FBB::StringLine(3bobcat)
π FBB::StringLine β the line-extracting bestie π
okay so. this is the FBB::StringLine page from the bobcat manual (section 3bobcat), and yes, the header calls it a line extractor, which is honestly the most accurate description anyone has ever given anything. welcome to the group chat, let's get you fluent. π¦
β¨ NAME β¨
FBB::StringLine β extracting lines using operator>>. that's it. that's the whole thing. she does one job and she does it flawlessly, periodt. π
β¨ SYNOPSIS β¨
#include <bobcat/stringline>
that's the entire incantation, bestie. one include and you're in. π
β¨ DESCRIPTION β¨
so here's the situation, and I need you to really sit with it. the standard operator>>(std::istream &, std::string &) string extraction operator grabs the first word from a stream. one word. singular. that's it. so if your whole intent is to pull lines out of a stream, that operator is literally useless to you β it's giving nothing. normally you'd reach for getline(std::istream &, std::string &) in that case.
BUT. and this is the plot twist β¨ β getline is not called by lots of the tools in generic algorithms, like istream_iterator. so if you try to feed lines through those generic-algorithm besties, getline justβ¦ doesn't get invited. awkward.
enter the class (actually: struct, keep up π
) StringLine. she was simply derived from std::string, and she defines her own operator>>, which reads the next line from the specified std::istream. that's the whole glow-up. main character energy fr fr. π
β¨ NAMESPACE β¨
FBB
every single constructor, member, operator and manipulator mentioned in this man-page lives in the namespace FBB. no strays, no exceptions. π«Ά
β¨ INHERITS FROM β¨
std::string
yes bestie, she's a nepo baby, but like... a useful nepo baby. πΈ
β¨ CONSTRUCTORS β¨
StringLine is an empty shell around std::string. she does not explicitly define constructors. none. zero. it's iconic honestly.
copy and move constructors (and assignment operators) are available. so you can copy her, move her, whatever the vibe requires. π
β¨ OVERLOADED OPERATOR β¨
std::istream &operator>>(std::istream &in, StringLine &str)β the extraction operator returns the next line onininstr, callinggetline(std::istream &, std::string &). that's the whole trick and she ate. π₯
β¨ MEMBER FUNCTIONS β¨
all members of std::string are available, as FBB::StringLine inherits from these classes. literally all of them. go wild. π
β¨ EXAMPLE β¨
the following example extracts all lines from std::cin and adds them to the std::vector<std::string> lines:
#include <iostream>
#include <algorithm>
#include <iterator>
#include <vector>
#include <bobcat/stringline>
using namespace std;
using namespace FBB;
int main()
{
vector<string> lines;
copy(
istream_iterator<StringLine>(cin), istream_iterator<StringLine>(),
back_inserter(lines)
);
}
look at that. istream_iterator<StringLine> doing exactly what istream_iterator<std::string> could never. obsessed. ππ
β¨ FILES β¨
bobcat/stringlineβ defines the class interface andoperator>>.
there are StringLine object files in the Bobcat library, so linking to Bobcat when using StringLine is not necessary. you heard her, no extra linking required, we love a low-maintenance queen π
β¨ SEE ALSO β¨
β¨ BUGS β¨
None Reported.
(we love a flawless record, ngl π)
β¨ 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. cute AND functional, the duality π¦
β¨ COPYRIGHT β¨
This is free software, distributed under the terms of the GNU General Public License (GPL). free as in freedom, bestie π
β¨ AUTHOR β¨
Frank B. Brokken (f.b.brokken@rug.nl). the legend himself π«Ά
and that's the whole page!! this came to you from thelibbobcat-devmanual pages,libbobcat-dev_6.15.01, dated2005-2026β go forth and extract lines, queen πβ¨
π¦ 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