casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
option::PrintUsageImplementation::LinePartIterator Class Reference

#include <optionparser.h>

Public Member Functions

 LinePartIterator (const Descriptor usage[])
 ! More...
 
bool nextTable ()
 Moves iteration to the next table (if any). More...
 
void restartTable ()
 Reset iteration to the beginning of the current table. More...
 
bool nextRow ()
 Moves iteration to the next row (if any). More...
 
void restartRow ()
 Reset iteration to the beginning of the current row. More...
 
bool next ()
 Moves iteration to the next part (if any). More...
 
int column ()
 Returns the index (counting from 0) of the column in which the part pointed to by data() is located. More...
 
int line ()
 Returns the index (counting from 0) of the line within the current column this part belongs to. More...
 
int length ()
 Returns the length of the part pointed to by data() in raw chars (not UTF-8 characters). More...
 
int screenLength ()
 Returns the width in screen columns of the part pointed to by data(). More...
 
const char * data ()
 Returns the current part of the iteration. More...
 

Private Member Functions

void update_length ()
 Determines the byte and character lengths of the part at ptr and stores them in len and screenlen respectively. More...
 

Private Attributes

const Descriptortablestart
 The 1st descriptor of the current table. More...
 
const Descriptorrowdesc
 The Descriptor that contains the current row. More...
 
const char * rowstart
 Ptr to 1st character of current row within rowdesc->help. More...
 
const char * ptr
 Ptr to current part within the current row. More...
 
int col
 Index of current column. More...
 
int len
 Length of the current part (that ptr points at) in BYTES. More...
 
int screenlen
 Length of the current part in screen columns (taking narrow/wide chars into account). More...
 
int max_line_in_block
 Greatest index of a line within the block. This is the number of \v within the cell with the most \vs. More...
 
int line_in_block
 Line index within the current cell of the current part. More...
 
int target_line_in_block
 Line index of the parts we should return to the user on this iteration. More...
 
bool hit_target_line
 Flag whether we encountered a part with line index target_line_in_block in the current cell. More...
 

Detailed Description

Definition at line 1950 of file optionparser.h.

Constructor & Destructor Documentation

option::PrintUsageImplementation::LinePartIterator::LinePartIterator ( const Descriptor  usage[])
inline

!

Creates an iterator for usage.

Definition at line 1995 of file optionparser.h.

Member Function Documentation

int option::PrintUsageImplementation::LinePartIterator::column ( )
inline

Returns the index (counting from 0) of the column in which the part pointed to by data() is located.

Definition at line 2161 of file optionparser.h.

References col.

Referenced by option::PrintUsageImplementation::printUsage().

const char* option::PrintUsageImplementation::LinePartIterator::data ( )
inline

Returns the current part of the iteration.

Definition at line 2195 of file optionparser.h.

References ptr.

Referenced by option::PrintUsageImplementation::printUsage().

int option::PrintUsageImplementation::LinePartIterator::length ( )
inline

Returns the length of the part pointed to by data() in raw chars (not UTF-8 characters).

Definition at line 2178 of file optionparser.h.

References len.

Referenced by option::PrintUsageImplementation::printUsage().

int option::PrintUsageImplementation::LinePartIterator::line ( )
inline

Returns the index (counting from 0) of the line within the current column this part belongs to.

Definition at line 2170 of file optionparser.h.

References target_line_in_block.

Referenced by option::PrintUsageImplementation::printUsage().

bool option::PrintUsageImplementation::LinePartIterator::next ( void  )
inline

Moves iteration to the next part (if any).

Has to be called once after each call to nextRow() to move to the 1st part of the row.

Return values
falseif moving to next part failed because no further part exists.

See LinePartIterator for details about the iteration.

Definition at line 2089 of file optionparser.h.

References col, hit_target_line, len, line_in_block, max_line_in_block, ptr, rowstart, target_line_in_block, update_length(), and option::PrintUsageImplementation::upmax().

Referenced by option::PrintUsageImplementation::printUsage().

bool option::PrintUsageImplementation::LinePartIterator::nextRow ( )
inline

Moves iteration to the next row (if any).

Has to be called once after each call to nextTable() to move to the 1st row of the table.

Return values
falseif moving to next row failed because no further row exists.

Definition at line 2039 of file optionparser.h.

References casa::QtMouseToolNames::help(), option::Descriptor::help, ptr, restartRow(), rowdesc, and rowstart.

Referenced by option::PrintUsageImplementation::printUsage().

bool option::PrintUsageImplementation::LinePartIterator::nextTable ( )
inline

Moves iteration to the next table (if any).

Has to be called once on a new LinePartIterator to move to the 1st table.

Return values
falseif moving to next table failed because no further table exists.

If this is NOT the first time nextTable() is called after the constructor, then skip to the next table break (i.e. a Descriptor with help == 0)

Find the next table after the break (if any)

Definition at line 2006 of file optionparser.h.

References option::Descriptor::help, restartTable(), rowdesc, rowstart, option::Descriptor::shortopt, and tablestart.

Referenced by option::PrintUsageImplementation::printUsage().

void option::PrintUsageImplementation::LinePartIterator::restartRow ( )
inline

Reset iteration to the beginning of the current row.

Definition at line 2070 of file optionparser.h.

References col, hit_target_line, len, line_in_block, max_line_in_block, ptr, rowstart, screenlen, and target_line_in_block.

Referenced by nextRow(), and option::PrintUsageImplementation::printUsage().

void option::PrintUsageImplementation::LinePartIterator::restartTable ( )
inline

Reset iteration to the beginning of the current table.

Definition at line 2027 of file optionparser.h.

References option::Descriptor::help, ptr, rowdesc, rowstart, and tablestart.

Referenced by nextTable(), and option::PrintUsageImplementation::printUsage().

int option::PrintUsageImplementation::LinePartIterator::screenLength ( )
inline

Returns the width in screen columns of the part pointed to by data().

Takes multi-byte UTF-8 sequences and wide characters into account.

Definition at line 2187 of file optionparser.h.

References screenlen.

Referenced by option::PrintUsageImplementation::printUsage().

void option::PrintUsageImplementation::LinePartIterator::update_length ( )
inlineprivate

Determines the byte and character lengths of the part at ptr and stores them in len and screenlen respectively.

int __builtin_clz (unsigned int x) Returns the number of leading 0-bits in x, starting at the most significant bit

ch is the decoded unicode code point

Definition at line 1968 of file optionparser.h.

References option::PrintUsageImplementation::isWideChar(), len, casacore::mask(), ptr, and screenlen.

Referenced by next().

Member Data Documentation

int option::PrintUsageImplementation::LinePartIterator::col
private

Index of current column.

Definition at line 1956 of file optionparser.h.

Referenced by column(), next(), and restartRow().

bool option::PrintUsageImplementation::LinePartIterator::hit_target_line
private

Flag whether we encountered a part with line index target_line_in_block in the current cell.

Definition at line 1962 of file optionparser.h.

Referenced by next(), and restartRow().

int option::PrintUsageImplementation::LinePartIterator::len
private

Length of the current part (that ptr points at) in BYTES.

Definition at line 1957 of file optionparser.h.

Referenced by length(), next(), restartRow(), and update_length().

int option::PrintUsageImplementation::LinePartIterator::line_in_block
private

Line index within the current cell of the current part.

Definition at line 1960 of file optionparser.h.

Referenced by next(), and restartRow().

int option::PrintUsageImplementation::LinePartIterator::max_line_in_block
private

Greatest index of a line within the block. This is the number of \v within the cell with the most \vs.

Definition at line 1959 of file optionparser.h.

Referenced by next(), and restartRow().

const char* option::PrintUsageImplementation::LinePartIterator::ptr
private

Ptr to current part within the current row.

Definition at line 1955 of file optionparser.h.

Referenced by data(), next(), nextRow(), restartRow(), restartTable(), and update_length().

const Descriptor* option::PrintUsageImplementation::LinePartIterator::rowdesc
private

The Descriptor that contains the current row.

Definition at line 1953 of file optionparser.h.

Referenced by nextRow(), nextTable(), and restartTable().

const char* option::PrintUsageImplementation::LinePartIterator::rowstart
private

Ptr to 1st character of current row within rowdesc->help.

Definition at line 1954 of file optionparser.h.

Referenced by next(), nextRow(), nextTable(), restartRow(), and restartTable().

int option::PrintUsageImplementation::LinePartIterator::screenlen
private

Length of the current part in screen columns (taking narrow/wide chars into account).

Definition at line 1958 of file optionparser.h.

Referenced by restartRow(), screenLength(), and update_length().

const Descriptor* option::PrintUsageImplementation::LinePartIterator::tablestart
private

The 1st descriptor of the current table.

Definition at line 1952 of file optionparser.h.

Referenced by nextTable(), and restartTable().

int option::PrintUsageImplementation::LinePartIterator::target_line_in_block
private

Line index of the parts we should return to the user on this iteration.

Definition at line 1961 of file optionparser.h.

Referenced by line(), next(), and restartRow().


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