.TH "FBB::OHexStreambuf" "3bobcat" "2005\-2018" "libbobcat\-dev_4\&.08\&.06\-x\&.tar\&.gz" "Write hex values" .PP .SH "NAME" FBB::OHexStreambuf \- Writes characters written to an ostream as hex values .PP .SH "SYNOPSIS" \fB#include \fP .br Linking option: \fI\-lbobcat\fP .PP .SH "DESCRIPTION" .PP \fBOHexStreambuf\fP is a specialization of \fIFBB::OFilterStreambuf\fP inserting all the characters it receives to a destination file as 2\-character wide hexadecimal values\&. Optionally a maximum linelength can be specified\&. .PP Note that all information received by an \fIOHexStreambuf\fP object is inserted as (a series of) hexadecimal values, not only plain characters\&. E\&.g\&., when inserting the value 123 the characters \fI\(cq\&1\(cq\&, \(cq\&2\(cq\&\fP and \fI\(cq\&3\(cq\&\fP are successively inserted and so this will result in the string \fI313233\fP being inserted into the destination stream\&. .PP .SH "NAMESPACE" \fBFBB\fP .br All constructors, members, operators and manipulators, mentioned in this man\-page, are defined in the namespace \fBFBB\fP\&. .PP .SH "INHERITS FROM" FBB::OFilterStreambuf .PP .SH "CONSTRUCTOR" .IP o \fBOFoldStreambuf(std::ostream &stream, size_t width = 0)\fP: .br The hexadecimal characters produced by the \fIOFoldStreambuf\fP object will be inserted into \fIstream\fP\&. Optionally the maximum line width (in number of characters) may be specified using \fIwidth\fP\&. The (default) value 0 indicates that no line breaks are requested\&. .PP The destructor writes any buffered information to the destination stream and will then flushes the destination stream\&. .PP .SH "MEMBER FUNCTIONS" All members of \fBFBB::OFilterStreambuf\fP, in particular its \fIout()\fP and \fIopen()\fP members are available, as \fBFBB::OHexStreambuf\fP inherits from this class\&. .IP o \fBsize_t size() const\fP: .br This member returns the next column offset where the next hexadecimal character will appear\&. If a maximum line length is requested and \fIsize()\fP does not return 0 then the last line inserted was not terminated by a \fI\(cq\&\en\(cq\&\fP character\&. See also the example below\&. .IP This member\(cq\&s return value is undefined if no maximum line length was requested\&. .PP .SH "PROTECTED MEMBER FUNCTION" .PP The member listed in this section implements the tasks of the comparably named virtual function in the class\(cq\&s private interface\&. This separates the redefinable interface from the user\-interface\&. The class \fBOHexStreambuf\fP can, in accordance with Liskov\(cq\&s Substitution Principle, be used as a \fIstd:streambuf\fP; but it also offers a facility for classes deriving from \fBOHexStreambuf\fP\&. This facility is listed here\&. .IP o \fBint pSync()\fP: .br The contents of the \fBOHexStreambuf\fP\(cq\&s internal buffer is flushed\&. .PP .SH "STATIC MEMBER" .IP o \fBstd::string text2bin(std::string const &in)\fP: .br This static member can be used to convert a series of hexadecimal characters generated by a \fIOHexStreambuf\fP object back to their binary form\&. E\&.g, when called as \fIOHexStreambuf::text2bin(\(dq\&736d616c6c206976\(dq\&)\fP then the returned \fIstd::string\fP will contain 8 characters, having respectively the binary values 0x73, 0x6d, 0x61, 0x6c, 0x6c, 0x20, 0x69, and 0x76\&. .IP This function does \fInot\fP verify whether its argument is properly formed\&. A properly formed argument consists of an even number of hexadecimal number characters (\(cq\&0\(cq\& until \(cq\&9\(cq\&, \(cq\&a\(cq\& until \(cq\&f\(cq\& (or uppercase))\&. For improperly formed arguments the return value is undefined\&. .IP .SH "EXAMPLE" .nf #include #include using namespace std; using namespace FBB; int main() { OHexStreambuf ohex(cout, 40); ostream out(&ohex); out << cin\&.rdbuf(); if (ohex\&.size()) cout << \(cq\&\en\(cq\&; } .fi .PP .SH "FILES" \fIbobcat/ohexstreambuf\fP \- defines the class interface .PP .SH "SEE ALSO" \fBbobcat\fP(7), \fBofilterstreambuf\fP(3bobcat) .PP .SH "BUGS" None Reported\&. .PP .SH "DISTRIBUTION FILES" .IP o \fIbobcat_4\&.08\&.06\-x\&.dsc\fP: detached signature; .IP o \fIbobcat_4\&.08\&.06\-x\&.tar\&.gz\fP: source archive; .IP o \fIbobcat_4\&.08\&.06\-x_i386\&.changes\fP: change log; .IP o \fIlibbobcat1_4\&.08\&.06\-x_*\&.deb\fP: debian package holding the libraries; .IP o \fIlibbobcat1\-dev_4\&.08\&.06\-x_*\&.deb\fP: debian package holding the libraries, headers and manual pages; .IP o \fIhttp://sourceforge\&.net/projects/bobcat\fP: public archive location; .PP .SH "BOBCAT" Bobcat is an acronym of `Brokken\(cq\&s Own Base Classes And Templates\(cq\&\&. .PP .SH "COPYRIGHT" This is free software, distributed under the terms of the GNU General Public License (GPL)\&. .PP .SH "AUTHOR" Frank B\&. Brokken (\fBf\&.b\&.brokken@rug\&.nl\fP)\&. .PP