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 127 128 129 130 131 132 133 134 135 136 137 138
|
includefile(include/header)
COMMENT(manpage, section, releasedate, archive, short name)
manpage(FBB::OHexBuf)(3bobcat)(_CurYrs_)
(libbobcat-dev__CurVers_)(Write hex values)
manpagename(FBB::OHexBuf)(Writes characters written to an ostream as hex
values)
manpagesynopsis()
bf(#include <bobcat/ohexbuf>)nl()
Linking option: tt(-lbobcat)
manpagedescription()
bf(OHexBuf) is a specialization of tt(FBB::OFilterBuf)
inserting all the characters it receives to a destination file as 2-character
wide hexadecimal values. Optionally a maximum linelength can be specified.
Note that all information received by an tt(OHexBuf) object is inserted
as (a series of) hexadecimal values, not only plain characters. E.g., when
inserting the value 123 the characters tt('1', '2') and tt('3') are
successively inserted and so this will result in the string tt(313233) being
inserted into the destination stream.
includefile(include/namespace)
manpagesection(INHERITS FROM)
tt(FBB::OFilterBuf)
manpagesection(CONSTRUCTOR)
itemization(
itb(OHexBuf(std::ostream &stream, size_t width = 0, std::string
const &separator = ""))
The hexadecimal characters produced by the tt(OFilterBuf) object
are inserted into tt(stream). Optionally the maximum line width (in number of
characters) may be specified using tt(width). The (default) value 0 indicates
that no line breaks are requested. The parameter tt(separator) defines the
separator that's inserted between hexadecimal character values. By default no
separator is used.
)
Copy and move constructors (and assignment operators) are not available.
The destructor writes any buffered information to the destination stream
and then flushes the destination stream. Finally, the destructor restores the
original formatting flags of the receiving tt(ostream).
manpagesection(MEMBER FUNCTIONS)
All members of bf(FBB::OFilterBuf), in particular its tt(out()) and
tt(reset) members are available, as bf(FBB::OHexBuf) inherits from
this class.
itemization(
itb(void eoi())
This member completes the current hexadecimal character conversion,
clears the separator, and no longer uses a the maximum output line
width. Instead of calling this member the tt(eoi) manipulator
(see below) can be used.
itb(void separator(bool reset = true))
This member clears the separator that's inserted between hexadecimal
character values. When the tt(reset) parameter is set to tt(true)
(which is the default) the currently used output width is reset to 0.
itb(void separator(std::string const &separator, bool reset = true))
This member resets the separator that's inserted between hexadecimal
character values to tt(separator's) value. When the tt(reset)
parameter is set to tt(true) (which is the default) the currently used
output width is reset to 0.
itb(void setWidth(size_t width))
This member sets the width of the generated output lines to tt(width)
characters. No maximum line width is used when tt(width = 0) is
specified.
itb(size_t size() const)
This member returns the next column offset where the next
hexadecimal character will appear. If a maximum line length is requested and
tt(size()) does not return 0 then the last line inserted was not terminated by
a tt('\n') character. See also the example below.
This member's return value is undefined if no maximum line length was
requested.
)
manpagesection(MANIPULATOR)
itemization(
itb(FBB::eoi)
The tt(eoi) manipulator can be inserted into the tt(ostream) to
complete the hexaecimal conversion. It acts identically to calling the
tt(end) member. If inserted into a plain tt(std::ostream) nothing
happens.
)
manpagesection(STATIC MEMBER)
itemization(
itb(std::string text2bin(std::string const &in))
This static member converts a series of hexadecimal
characters generated by a tt(OHexBuf) object back to their binary
form. E.g, when called as tt(OHexBuf::text2bin("736d616c6c206976")) then
the returned tt(std::string) will contain 8 characters, having respectively
the binary values 0x73, 0x6d, 0x61, 0x6c, 0x6c, 0x20, 0x69, and 0x76.
This function does em(not) verify whether its argument is properly
formed. A properly formed argument consists of an even number of hexadecimal
number characters ('0' until '9', 'a' until 'f' (or uppercase)). For
improperly formed arguments the return value is undefined.
)
manpagesection(EXAMPLE)
verb(
#include <iostream>
#include <bobcat/ohexbuf>
using namespace std;
using namespace FBB;
int main()
{
OHexBuf ohex(cout, 40);
ostream out(&ohex);
out << cin.rdbuf();
if (ohex.size())
cout << '\n';
}
)
manpagefiles()
em(bobcat/ohexbuf) - defines the class interface
manpageseealso()
bf(bobcat)(7), bf(ofilterbuf)(3bobcat)
manpagebugs()
None Reported.
includefile(include/trailer)
|