klee
PrintContext Class Reference

#include <PrintContext.h>

Public Member Functions

 PrintContext (llvm::raw_ostream &_os)
 
void setNewline (const std::string &_newline)
 
void breakLine (unsigned indent=0)
 
PrintContextbreakLineI ()
 
PrintContextpushIndent ()
 
PrintContextpopIndent ()
 
void write (const std::string &s)
 
template<typename T >
PrintContextoperator<< (T elt)
 

Public Attributes

unsigned pos
 Number of characters on the current line. More...
 

Private Attributes

llvm::raw_ostream & os
 
std::string newline
 
std::stack< unsigned int > indentStack
 

Detailed Description

PrintContext - Helper class for pretty printing. It provides a basic wrapper around llvm::raw_ostream that keeps track of how many characters have been used on the current line.

It also provides an optional way keeping track of the various levels of indentation by using a stack.

See also
breakLineI() ,
pushIndent(),
popIndent()

Definition at line 28 of file PrintContext.h.

Constructor & Destructor Documentation

◆ PrintContext()

PrintContext::PrintContext ( llvm::raw_ostream &  _os)
inline

Definition at line 43 of file PrintContext.h.

References indentStack, and pos.

Member Function Documentation

◆ breakLine()

void PrintContext::breakLine ( unsigned  indent = 0)
inline

◆ breakLineI()

PrintContext & PrintContext::breakLineI ( )
inline

Break line using the indent on the top of the indent stack

Returns
The PrintContext object so the method is chainable

Definition at line 61 of file PrintContext.h.

References breakLine(), and indentStack.

Referenced by klee::ExprSMTLIBPrinter::printArrayDeclarations(), klee::ExprSMTLIBPrinter::printAssert(), klee::ExprSMTLIBPrinter::printCastToSort(), and klee::ExprSMTLIBPrinter::printSeperator().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator<<()

template<typename T >
PrintContext & PrintContext::operator<< ( elt)
inline

Definition at line 91 of file PrintContext.h.

References write().

Here is the call graph for this function:

◆ popIndent()

◆ pushIndent()

◆ setNewline()

void PrintContext::setNewline ( const std::string &  _newline)
inline

Definition at line 48 of file PrintContext.h.

References newline.

◆ write()

void PrintContext::write ( const std::string &  s)
inline

write - Output a string to the stream and update the position. The stream should not have any newlines.

Definition at line 85 of file PrintContext.h.

References os, and pos.

Referenced by operator<<(), and klee::ExprSMTLIBPrinter::printSeperator().

Here is the caller graph for this function:

Member Data Documentation

◆ indentStack

std::stack<unsigned int> PrintContext::indentStack
private

This is used to keep track of the stack of indentations used by

See also
breakLineI()
pushIndent()
popIndent()

Definition at line 37 of file PrintContext.h.

Referenced by breakLineI(), popIndent(), PrintContext(), and pushIndent().

◆ newline

std::string PrintContext::newline
private

Definition at line 31 of file PrintContext.h.

Referenced by breakLine(), and setNewline().

◆ os

llvm::raw_ostream& PrintContext::os
private

Definition at line 30 of file PrintContext.h.

Referenced by breakLine(), and write().

◆ pos

unsigned PrintContext::pos

Number of characters on the current line.

Definition at line 41 of file PrintContext.h.

Referenced by breakLine(), PPrinter::print(), PrintContext(), klee::ExprPPrinter::printQuery(), PPrinter::printUpdateList(), pushIndent(), and write().


The documentation for this class was generated from the following file: