|
PPL
0.12.1
|
All input/output operators are confined to this namespace. More...
Functions | |
| template<typename D > | |
| std::ostream & | operator<< (std::ostream &s, const Ask_Tell< D > &x) |
| std::ostream & | operator<< (std::ostream &os, const PIP_Tree_Node &x) |
| std::ostream & | operator<< (std::ostream &os, const PIP_Tree_Node::Artificial_Parameter &x) |
| 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. | |
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<<; }
|
related |
Definition at line 240 of file Ask_Tell.templates.hh.
{
if (x.is_top())
s << "true";
else if (x.is_bottom())
s << "false";
else
for (typename Ask_Tell<D>::const_iterator xi = x.begin(),
x_end = x.end(); xi != x_end; ++xi)
s << "(" << xi->ask() << " -> " << xi->tell() << ")";
return s;
}
|
related |
Definition at line 845 of file PIP_Tree.cc.
References Parma_Polyhedra_Library::PIP_Tree_Node::print().
{
x.print(os);
return os;
}
|
related |
Definition at line 851 of file PIP_Tree.cc.
References Parma_Polyhedra_Library::PIP_Tree_Node::Artificial_Parameter::denominator().
{
const Linear_Expression& expr = static_cast<const Linear_Expression&>(x);
os << "(" << expr << ") div " << x.denominator();
return os;
}
| 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.
| 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. |
Definition at line 34 of file wrap_string.cc.
References Parma_Polyhedra_Library::is_space(), and PPL_ASSERT.
{
const unsigned npos = C_Integer<unsigned>::max;
std::string dst_string;
const char *src = src_string.c_str();
for (unsigned line = 0; ; ++line) {
const unsigned line_length = ((line == 0)
? preferred_first_line_length
: preferred_line_length);
unsigned last_comma = npos;
unsigned last_space = npos;
unsigned split_pos = npos;
unsigned idx;
for (idx = 0; idx <= line_length; ++idx) {
if (src[idx] == '\0' || src[idx] == '\n') {
split_pos = idx;
break;
}
if (src[idx] == ',' && idx < line_length)
last_comma = idx;
if (is_space(src[idx]) && (idx == 0 || !is_space(src[idx-1])))
last_space = idx;
}
if (split_pos == npos) {
if (last_comma != npos)
split_pos = last_comma + 1;
else if (last_space != npos)
split_pos = last_space;
else {
for ( ; src[idx] != '\0'; ++idx) {
if (src[idx] == ',') {
++idx;
break;
}
if (is_space(src[idx]))
break;
}
split_pos = idx;
}
}
PPL_ASSERT(split_pos != npos);
if (split_pos > 0 && line > 0 && indent_depth > 0)
dst_string.append(indent_depth, ' ');
dst_string.append(src, split_pos);
src += split_pos;
if (is_space(*src))
++src;
while (*src == ' ')
++src;
if (*src == '\0')
break;
dst_string.push_back('\n');
}
return dst_string;
}