---
name: "iquotedprintablestreambuf"
section: "3bobcat"
platform: "linux"
package: "libbobcat-dev"
version: "4.08.06-1"
release: "Debian 10 (Buster)"
platforms: ["linux"]
url: "https://new.carta.tech/iquotedprintablestreambuf"
---

# iquotedprintablestreambuf(3bobcat)

Input Filtering stream buffer doing quoted printable conversions

## NAME

FBB::IQuotedPrintableStreambuf - Input Filtering stream buffer doing quoted printable conversions

## SYNOPSIS

**#include \<bobcat/iquotedprintablestreambuf\>**\
 Linking option: *-lbobcat*

## DESCRIPTION

The information made available by **IQuotedPrintableStreambuf** objects is either quoted-printable encoded or decoded. The information to convert is read by **IQuotedPrintableStreambuf** objects via *std::istream* objects.

The class **IQuotedPrintableStreambuf** is a class template, using a *FBB::CryptType* template non-type parameter. Objects of the class **FBB::IQuotedPrintableStreambuf\<FBB::ENCODE\>** encode the information they receive, objects of the class **FBB::IQuotedPrintableStreambuf\<FBB::DECODE\>** decode the information they receive. See also section **ENUMERATION** below.

Quoted-printable encoding is sometimes used in e-mail attachments (See also https://en.wikipedia.org/wiki/Quoted-printable and https://www.ietf.org/rfc/rfc2045.txt (section 6.7)). Its main characteristics are:

- o

  Lines are at most 76 characters long;

- o

  Lines longer than 76 characters are split into sub-lines, using *=\\n* combinations to indicate \`soft line breaks’. Lines not ending in soft line breaks indicate true end of lines.

- o

  All printable characters, except for the *=* character and (final) blank characters just before the end of lines, are copied as-is, all other characters are escaped by writing *=XX* sequences, with XX being the ascii-character representation of the hexadecimal value of the escaped character (e.g., the *=* character is encoded as *=3D*, a final space before end-of-line is encoded as *=20*, a final tab as *=09*). Only capital letters are used when escaping characters.\

## NAMESPACE

**FBB**\
 All constructors, members, operators and manipulators, mentioned in this man-page, are defined in the namespace **FBB**.

## INHERITS FROM

**FBB::IFilterStreambuf**

## MEMBER FUNCTIONS

All members of **FBB::IFilterStreambuf** are available, as **IQuotedPrintableStreambuf** inherits from this class.

Overloaded move and/or copy assignment operators are not available.

## ENUMERATION

**IQuotedPrintableStreambuf** objects either encode or decode quoted-printable information. **IQuotedPrintableStreambuf** objects of the class **FBB::IQuotedPrintableStreambuf\<FBB::ENCODE\>** encode the data they receive, **IQuotedPrintableStreambuf** objects of the class **FBB::IQuotedPrintableStreambuf\<FBB::DECODE\>** decode the data they receive.

The values *ENCODE* and *DECODE* are defined in the *enum CryptType*, defined in the *FBB* namespace.

## CONSTRUCTOR

- o

  **IQuotedPrintableStreambuf\<CryptType\>(std::istream &in, size\_t bufSize = 1000)**:\
   This constructor initializes the streambuf.

-

  \- *IQuotedPrintableStreambuf\<ENCODE\>* objects perform quoted-printable encoding;\
   \- *IQuotedPrintableStreambuf\<DECODE\>* objects perform quoted-printable decoding;\
   \- *IQuotedPrintableStreambuf\<CryptType\>* objects obtain the bytes to encode or decode from *std::istream &in*;\
   \- The *IFilterStreambuf* base class is initialized with a buffer of size *bufSize*, using a lower bound of 100 characters.

-

  The constructor uses a configurable buffer size for reading. Characters read into the buffer which are not part of the actual quoted-printable encoded data are unavailable after completing the quoted-printable decoding. If information beyond the quoted-printable input block should remain available, then a buffer size of 1 should be specified.

Copy- and move constructors are not available.

## EXAMPLE

The example shows the construction of *IQuotedPrintableStreambuf\<ENCODE\>* objects *encode* which are used to initialize a *std::istream* object. The information read from this *istream* is quoted-printable encoded.

*IQuotedPrintableStreambuf\<DECODE\>* objects read quoted-printable encoded information from *std::istream* objects, decoding the information.

The *std::istream din* object is initialized with the *IQuotedPrintableStreambuf\<DECODE\>* object, and its contents is sent to *std::cout*. The information that is presented at *std::cin* and that appears at *std::cout* should be identical.

```
#include <iostream>
#include <istream>
#include <bobcat/iquotedprintablestreambuf>
using namespace std;
using namespace FBB;
int main(int argc, char **argv)
{
    if (argc == 1)
    {
        cout << "Usage: " << argv[0] << " [edb] < infile > outfile\n"
                    "to quoted printable -e-ncode, -d-ecode or -b-oth\n";
        return 0;
    }
    switch (argv[1][0])
    {
        case ’e’:
        {
            IQuotedPrintableStreambuf<ENCODE> encode(cin);
            istream ein(&encode);
            cout << ein.rdbuf();
        }
        break;
        case ’d’:
        {
            IQuotedPrintableStreambuf<DECODE> decode(cin);
            istream din(&decode);
            cout << din.rdbuf();
        }
        break;
        case ’b’:
        {
            IQuotedPrintableStreambuf<ENCODE> encode(cin);
            istream ein(&encode);
            IQuotedPrintableStreambuf<DECODE> decode(ein);
            istream din(&decode);
            cout << din.rdbuf();
        }
        break;
    }
}
```

## FILES

*bobcat/iquotedprintablestreambuf* - defines the class interface

## SEE ALSO

[**bobcat**(7)](/bobcat/7.md), [**isymcryptstreambuf**(3bobcat)](/isymcryptstreambuf/3bobcat.md), [**iquotedprintablestream**(3bobcat)](/iquotedprintablestream/3bobcat.md), [**ifilterstreambuf**(3bobcat)](/ifilterstreambuf/3bobcat.md), [**ofilterstreambuf**(3bobcat)](/ofilterstreambuf/3bobcat.md), **std::streambuf**.

## BUGS

None reported.

## DISTRIBUTION FILES

- o

  *bobcat\_4.08.06-x.dsc*: detached signature;

- o

  *bobcat\_4.08.06-x.tar.gz*: source archive;

- o

  *bobcat\_4.08.06-x\_i386.changes*: change log;

- o

  *libbobcat1\_4.08.06-x\_\*.deb*: debian package holding the libraries;

- o

  *libbobcat1-dev\_4.08.06-x\_\*.deb*: debian package holding the libraries, headers and manual pages;

- o

  *http://sourceforge.net/projects/bobcat*: public archive location;

## BOBCAT

Bobcat is an acronym of \`Brokken’s Own Base Classes And Templates’.

## 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**).
