ROOT   Reference Guide
ROOT::option::PrintUsageImplementation::LineWrapper Class Reference

Definition at line 2212 of file OptionParser.h.

## Public Member Functions

LineWrapper (int x1, int x2)
Constructs a LineWrapper that wraps its output to fit into screen columns x1 (incl.) to x2 (excl.). More...

void flush (IStringWriter &write)
Writes out all remaining data from the LineWrapper using write. More...

void process (IStringWriter &write, const char *data, int len)
Process, wrap and output the next piece of data. More...

## Private Member Functions

bool buf_empty ()

bool buf_full ()

void buf_next ()

void buf_store (const char *data, int len)

void output (IStringWriter &write, const char *data, int len)
Writes (data,len) into the ring buffer. More...

void write_one_line (IStringWriter &write)
Writes a single line of output from the buffer to write. More...

## Private Attributes

Ring buffer for data component of pair (data, length). More...

index for next write More...

Ring buffer for length component of pair (data, length). More...

int tail
index for next read - 1 (i.e. More...

int width
The width of the column to line wrap. More...

bool wrote_something
Multiple methods of LineWrapper may decide to flush part of the buffer to free up space. More...

int x
The indentation of the column to which the LineBuffer outputs. More...

## Static Private Attributes

static const int bufmask = 15
Must be a power of 2 minus 1. More...

#include </home/sftnight/build/workspace/root-makedoc-master/rootspi/rdoc/src/master/core/dictgen/res/OptionParser.h>

## ◆ LineWrapper()

 ROOT::option::PrintUsageImplementation::LineWrapper::LineWrapper ( int x1, int x2 )
inline

Constructs a LineWrapper that wraps its output to fit into screen columns x1 (incl.) to x2 (excl.).

x1 gives the indentation LineWrapper uses if it needs to indent.

Definition at line 2421 of file OptionParser.h.

## ◆ buf_empty()

 bool ROOT::option::PrintUsageImplementation::LineWrapper::buf_empty ( )
inlineprivate

Definition at line 2246 of file OptionParser.h.

## ◆ buf_full()

 bool ROOT::option::PrintUsageImplementation::LineWrapper::buf_full ( )
inlineprivate

Definition at line 2251 of file OptionParser.h.

## ◆ buf_next()

 void ROOT::option::PrintUsageImplementation::LineWrapper::buf_next ( )
inlineprivate

Definition at line 2264 of file OptionParser.h.

## ◆ buf_store()

 void ROOT::option::PrintUsageImplementation::LineWrapper::buf_store ( const char * data, int len )
inlineprivate

Definition at line 2256 of file OptionParser.h.

## ◆ flush()

 void ROOT::option::PrintUsageImplementation::LineWrapper::flush ( IStringWriter & write )
inline

Writes out all remaining data from the LineWrapper using write.

Unlike process() this method indents all lines including the first and will output a \n at the end (but only if something has been written).

Definition at line 2308 of file OptionParser.h.

## ◆ output()

 void ROOT::option::PrintUsageImplementation::LineWrapper::output ( IStringWriter & write, const char * data, int len )
inlineprivate

Writes (data,len) into the ring buffer.

If the buffer is full, a single line is flushed out of the buffer into write.

Definition at line 2273 of file OptionParser.h.

## ◆ process()

 void ROOT::option::PrintUsageImplementation::LineWrapper::process ( IStringWriter & write, const char * data, int len )
inline

Process, wrap and output the next piece of data.

process() will output at least one line of output. This is not necessarily the data passed in. It may be data queued from a prior call to process(). If the internal buffer is full, more than 1 line will be output.

process() assumes that the a proper amount of indentation has already been output. It won't write any further indentation before the 1st line. If more than 1 line is written due to buffer constraints, the lines following the first will be indented by this method, though.

No \n is written by this method after the last line that is written.

Parameters
 write where to write the data. data the new chunk of data to write. len the length of the chunk of data to write.

Definition at line 2338 of file OptionParser.h.

## ◆ write_one_line()

 void ROOT::option::PrintUsageImplementation::LineWrapper::write_one_line ( IStringWriter & write )
inlineprivate

Writes a single line of output from the buffer to write.

Definition at line 2284 of file OptionParser.h.

## Member Data Documentation

staticprivate

Must be a power of 2 minus 1.

Definition at line 2214 of file OptionParser.h.

## ◆ datbuf

private

Ring buffer for data component of pair (data, length).

Definition at line 2222 of file OptionParser.h.

private

index for next write

Definition at line 2234 of file OptionParser.h.

## ◆ lenbuf

private

Ring buffer for length component of pair (data, length).

Definition at line 2218 of file OptionParser.h.

## ◆ tail

 int ROOT::option::PrintUsageImplementation::LineWrapper::tail
private

index for next read - 1 (i.e.

Definition at line 2235 of file OptionParser.h.

## ◆ width

 int ROOT::option::PrintUsageImplementation::LineWrapper::width
private

The width of the column to line wrap.

Definition at line 2233 of file OptionParser.h.

## ◆ wrote_something

 bool ROOT::option::PrintUsageImplementation::LineWrapper::wrote_something
private

Multiple methods of LineWrapper may decide to flush part of the buffer to free up space.

The contract of process() says that only 1 line is output. So this variable is used to track whether something has output a line. It is reset at the beginning of process() and checked at the end to decide if output has already occurred or is still needed.

Definition at line 2244 of file OptionParser.h.

## ◆ x

 int ROOT::option::PrintUsageImplementation::LineWrapper::x
private

The indentation of the column to which the LineBuffer outputs.

LineBuffer assumes that the indentation has already been written when process() is called, so this value is only used when a buffer flush requires writing additional lines of output.

Definition at line 2229 of file OptionParser.h.

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