| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
5.3 Output functions
Including <cln/io.h> defines a number of simple output functions
that write to std::ostream&:
void fprintchar (std::ostream& stream, char c)Prints the character
xliterally on thestream.void fprint (std::ostream& stream, const char * string)Prints the
stringliterally on thestream.void fprintdecimal (std::ostream& stream, int x)void fprintdecimal (std::ostream& stream, const cl_I& x)Prints the integer
xin decimal on thestream.void fprintbinary (std::ostream& stream, const cl_I& x)Prints the integer
xin binary (base 2, without prefix) on thestream.void fprintoctal (std::ostream& stream, const cl_I& x)Prints the integer
xin octal (base 8, without prefix) on thestream.void fprinthexadecimal (std::ostream& stream, const cl_I& x)Prints the integer
xin hexadecimal (base 16, without prefix) on thestream.
Each of the classes cl_N, cl_R, cl_RA, cl_I,
cl_F, cl_SF, cl_FF, cl_DF, cl_LF
defines, in <cln/type_io.h>, the following output functions:
void fprint (std::ostream& stream, const type& x)std::ostream& operator<< (std::ostream& stream, const type& x)Prints the number
xon thestream. The output may depend on the global printer settings in the variabledefault_print_flags. Theostreamflags and settings (flags, width and locale) are ignored.
The most flexible output function, defined in <cln/type_io.h>,
are the following:
void print_complex (std::ostream& stream, const cl_print_flags& flags,
const cl_N& z);
void print_real (std::ostream& stream, const cl_print_flags& flags,
const cl_R& z);
void print_float (std::ostream& stream, const cl_print_flags& flags,
const cl_F& z);
void print_rational (std::ostream& stream, const cl_print_flags& flags,
const cl_RA& z);
void print_integer (std::ostream& stream, const cl_print_flags& flags,
const cl_I& z);
Prints the number x on the stream. The flags are
parameters which affect the output.
The structure type cl_print_flags contains the following fields:
unsigned int rational_baseThe base in which rational numbers are printed. Default is
10.bool rational_readablyIf this flag is true, rational numbers are printed with radix specifiers in Common Lisp syntax (
#nRor#bor#oor#xprefixes, trailing dot). Default is false.bool float_readablyIf this flag is true, type specific exponent markers have precedence over ’E’. Default is false.
float_format_t default_float_formatFloating point numbers of this format will be printed using the ’E’ exponent marker. Default is
float_format_ffloat.bool complex_readablyIf this flag is true, complex numbers will be printed using the Common Lisp syntax
#C(realpart imagpart). Default is false.cl_string univpoly_varnameUnivariate polynomials with no explicit indeterminate name will be printed using this variable name. Default is
"x".
The global variable default_print_flags contains the default values,
used by the function fprint.
| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on August 27, 2013 using texi2html 5.0.
