/usr/include/bobcat/mbuf is in libbobcat-dev 4.08.02-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | #ifndef INCLUDED_BOBCAT_MBUF_
#define INCLUDED_BOBCAT_MBUF_
#include <streambuf>
#include <memory>
#include <ostream>
#include <string>
#include <iosfwd>
#include <limits>
namespace FBB
{
class Mbuf: public std::streambuf
{
std::shared_ptr<std::ofstream> d_ofstr;
std::ostream d_ostr; // this is the receiving ostream
bool d_firstChar;
bool d_throw;
std::string d_tag;
size_t d_count; // counts # messages
size_t d_maxCount;
bool d_lineExcess;
bool d_showLineNr;
size_t d_lineNr;
std::string d_lineTag;
public:
Mbuf(); // 1
explicit Mbuf(std::streambuf *strbuf, // 2
size_t maxCount = std::numeric_limits<size_t>::max(),
std::string const &tag = "", bool throwing = false);
// 3
explicit Mbuf(std::string const &name, size_t maxCount =
std::numeric_limits<size_t>::max(),
std::string const &tag = "", bool throwing = false);
void reset(Mbuf const &mbuf); // 1: initialize from
// mbuf. Shares
// d_ofstr and uses
// d_ostr's rdbuf
void reset(std::streambuf *strbuf, size_t maxCount, // 2
std::string const &tag, bool throwing);
void reset(std::string const &name, size_t maxCount, // 3
std::string const &tag, bool throwing);
bool throws() const; // .f
void throwing(bool ifTrue); // .f
size_t count() const; // .f
size_t maxCount() const; // .f
std::string const &tag() const; // .f
std::string const &lineTag() const; // .f
void noLineNr(); // .f
void setLineNr(size_t lineNr);
void setCount(size_t count); // .f
void setMaxCount(size_t maxCount); // .f
void setTag(std::string const &tag);
void setLineTag(std::string const &lineTag); // .f
bool lineExcess() const; // .f
private:
void atFirstChar();
bool firstChar() const;
void showTag();
void inspectOfstr(std::string const &name) const;
int overflow(int c) override;
std::streamsize xsputn(char const *buf, std::streamsize n) override;
int sync() override;
};
inline size_t Mbuf::count() const
{
return d_count;
}
inline bool Mbuf::lineExcess() const
{
return d_lineExcess;
}
inline std::string const &Mbuf::lineTag() const
{
return d_lineTag;
}
inline size_t Mbuf::maxCount() const
{
return d_maxCount;
}
inline void Mbuf::noLineNr()
{
d_showLineNr = false;
}
inline void Mbuf::setCount(size_t count)
{
d_count = count;
}
inline void Mbuf::setLineTag(std::string const &lineTag)
{
d_lineTag = lineTag;
}
inline void Mbuf::setMaxCount(size_t maxCount)
{
d_maxCount = maxCount;
}
inline std::string const &Mbuf::tag() const
{
return d_tag;
}
inline void Mbuf::throwing(bool ifTrue)
{
d_throw = ifTrue;
}
inline bool Mbuf::throws() const
{
return d_throw;
}
} // FBB
#endif
|