Functions

Parma_Polyhedra_Library::IO_Operators Namespace Reference
[C++ Language Interface]

All input/output operators are confined to this namespace. More...

Functions

std::string wrap_string (const std::string &src_string, unsigned indent_depth, unsigned preferred_first_line_length, unsigned preferred_line_length)
 Utility function for the wrapping of lines of text.

Detailed Description

All input/output operators are confined to this namespace.

This is done so that the library's input/output operators do not interfere with those the user might want to define. In fact, it is highly unlikely that any predefined I/O operator will suit the needs of a client application. On the other hand, those applications for which the PPL I/O operator are enough can easily obtain access to them. For example, a directive like

    using namespace Parma_Polyhedra_Library::IO_Operators;

would suffice for most uses. In more complex situations, such as

    const Constraint_System& cs = ...;
    copy(cs.begin(), cs.end(),
         ostream_iterator<Constraint>(cout, "\n"));

the Parma_Polyhedra_Library namespace must be suitably extended. This can be done as follows:

    namespace Parma_Polyhedra_Library {
      // Import all the output operators into the main PPL namespace.
      using IO_Operators::operator<<;
    }

Function Documentation

std::string Parma_Polyhedra_Library::IO_Operators::wrap_string ( const std::string &  src_string,
unsigned  indent_depth,
unsigned  preferred_first_line_length,
unsigned  preferred_line_length 
)

Utility function for the wrapping of lines of text.

Parameters:
src_string The source string holding the lines to wrap.
indent_depth The indentation depth.
preferred_first_line_length The preferred length for the first line of text.
preferred_line_length The preferred length for all the lines but the first one.
Returns:
The wrapped string.