Ninja
Public Types | Public Member Functions | Private Attributes | List of all members
LinePrinter Struct Reference

Prints lines of text, possibly overprinting previously printed lines if the terminal supports it. More...

#include <line_printer.h>

Public Types

enum  LineType { FULL, ELIDE }
 

Public Member Functions

bool is_smart_terminal () const
 
 LinePrinter ()
 
void Print (string to_print, LineType type)
 Overprints the current line. More...
 
void PrintOnNewLine (const string &to_print)
 Prints a string on a new line, not overprinting previous output. More...
 
void set_smart_terminal (bool smart)
 

Private Attributes

bool have_blank_line_
 Whether the caret is at the beginning of a blank line. More...
 
bool smart_terminal_
 Whether we can do fancy terminal control codes. More...
 

Detailed Description

Prints lines of text, possibly overprinting previously printed lines if the terminal supports it.

Definition at line 23 of file line_printer.h.

Member Enumeration Documentation

Enumerator
FULL 
ELIDE 

Definition at line 29 of file line_printer.h.

Constructor & Destructor Documentation

LinePrinter::LinePrinter ( )

Definition at line 29 of file line_printer.cc.

References smart_terminal_.

Member Function Documentation

bool LinePrinter::is_smart_terminal ( ) const
inline

Definition at line 26 of file line_printer.h.

Referenced by BuildStatus::BuildEdgeFinished().

void LinePrinter::Print ( string  to_print,
LineType  type 
)

Overprints the current line.

If type is ELIDE, elides to_print to fit on one line.

Definition at line 45 of file line_printer.cc.

References ELIDE, ElideMiddle(), have_blank_line_, and smart_terminal_.

Referenced by LaconicPrinter::OnTestStart(), and BuildStatus::PrintStatus().

void LinePrinter::PrintOnNewLine ( const string &  to_print)

Prints a string on a new line, not overprinting previous output.

Definition at line 104 of file line_printer.cc.

References have_blank_line_.

Referenced by BuildStatus::BuildEdgeFinished(), BuildStatus::BuildFinished(), LaconicPrinter::OnTestPartResult(), and LaconicPrinter::OnTestProgramEnd().

void LinePrinter::set_smart_terminal ( bool  smart)
inline

Definition at line 27 of file line_printer.h.

Referenced by BuildStatus::BuildStatus().

Member Data Documentation

bool LinePrinter::have_blank_line_
private

Whether the caret is at the beginning of a blank line.

Definition at line 45 of file line_printer.h.

Referenced by Print(), and PrintOnNewLine().

bool LinePrinter::smart_terminal_
private

Whether we can do fancy terminal control codes.

Definition at line 42 of file line_printer.h.

Referenced by LinePrinter(), and Print().


The documentation for this struct was generated from the following files: