Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext
Generator Directives Controlling Automatic Delimiting (verbatim[], no_delimit[], delimit[])
Description

The directives delimit[], no_delimit[], and verbatim[] can be used to control automatic delimiting. The directives verbatim[] and no_delimit[] disable any automatic delimiting, while the directive delimit[] (re-)enables automatic delimiting.

Header

For the verbatim[] directive:

// forwards to <boost/spirit/home/karma/directive/verbatim.hpp>
#include <boost/spirit/include/karma_verbatim.hpp>

For the no_delimit[] directive:

// forwards to <boost/spirit/home/karma/directive/no_delimit.hpp>
#include <boost/spirit/include/karma_no_delimit.hpp>

For the delimit[] directive:

// forwards to <boost/spirit/home/karma/directive/delimit.hpp>
#include <boost/spirit/include/karma_delimit.hpp>

Also, see Include Structure.

Namespace

Name

boost::spirit::verbatim // alias: boost::spirit::karma::verbatim

boost::spirit::no_delimit // alias: boost::spirit::karma::no_delimit

boost::spirit::delimit // alias: boost::spirit::karma::delimit

Model of

UnaryGenerator

Notation

a

A generator object

d

A generator object, or a Lazy Argument that evaluates to a generator object

A, D

Attribute types of the generators a and d

Expression Semantics

Semantics of an expression is defined only where it differs from, or is not defined in UnaryGenerator.

Expression

Semantics

delimit[a]

Enable automatic delimiting for the embedded generator a while using the space generator as the delimiting generator. If used inside a verbatim[] directive it re-enables the delimiter generator as used outside of this verbatim[] instead. The directive succeeds as long as the embedded generator succeeded (unless the underlying output stream reports an error).

delimit(d)[a]

Enable automatic delimiting for the embedded generator a while using the generator d as the delimiting generator. The directive succeeds as long as the embedded generator succeeded (unless the underlying output stream reports an error).

verbatim[a]

Disable automatic delimiting for the embedded generator a. The directive succeeds as long as the embedded generator succeeded (unless the underlying output stream reports an error). This directive it has no effect if it is used when no delimiting is active. When delimiting is active this directive performs a post-delimit step (which is different from the behavior of no_delimit[]).

no_delimit[a]

Disable automatic delimiting for the embedded generator a. The directive succeeds as long as the embedded generator succeeded (unless the underlying output stream reports an error). This directive it has no effect if it is used when no delimiting is active. When delimiting is active this directive does not perform a post-delimit step (which is different from the behavior of verbatim[].

Attributes

See Compound Attribute Notation.

Expression

Attribute

delimit[a]

a: A --> delimit[a]: A
a: Unused --> delimit[a]: Unused

delimit(d)[a]

a: A, d: D --> delimit(d)[a]: A
a: Unused, d: D --> delimit(d)[a]: Unused

verbatim[a]

a: A --> verbatim[a]: A
a: Unused --> verbatim[a]: Unused

no_delimit[a]

a: A --> no_delimit[a]: A
a: Unused --> no_delimit[a]: Unused

Complexity

The overall complexity of the generator directives delimit[], verbatim[], and no_delimit[] is defined by the complexity of its embedded generators. The complexity of the directives themselves is O(1).

Example
[Note] Note

The test harness for the example(s) below is presented in the Basics Examples section.

Some includes:

#include <boost/spirit/include/karma.hpp>
#include <iostream>
#include <string>

Some using declarations:

using boost::spirit::karma::double_;
using boost::spirit::karma::delimit;
using boost::spirit::karma::verbatim;

Basic usage of delimit generator directive:

test_generator_attr("[ 2.0 , 4.3 ] ",
    delimit['[' << double_ << ',' << double_ << ']'], 2.0, 4.3);
test_generator_attr("[*2.0*,*4.3*]*",
    delimit('*')['[' << double_ << ',' << double_ << ']'], 2.0, 4.3);
test_generator_attr("[2.0, 4.3 ] ",
    delimit[verbatim['[' << double_ << ','] << double_ << ']'], 2.0, 4.3);


PrevUpHomeNext