SLHAea  0.1
containers for SUSY Les Houches Accord input/output
 All Classes Namespaces Files Functions Variables Typedefs
Public Types | Public Member Functions | List of all members
Line Class Reference

Container of strings that represents a line in a SLHA structure. More...

#include <slhaea.h>

Public Types

typedef std::string value_type
 
typedef std::string & reference
 
typedef const std::string & const_reference
 
typedef impl_type::iterator iterator
 
typedef impl_type::const_iterator const_iterator
 
typedef impl_type::reverse_iterator reverse_iterator
 
typedef
impl_type::const_reverse_iterator 
const_reverse_iterator
 
typedef impl_type::pointer pointer
 
typedef impl_type::const_pointer const_pointer
 
typedef impl_type::difference_type difference_type
 
typedef impl_type::size_type size_type
 

Public Member Functions

 Line ()
 Constructs an empty Line. More...
 
 Line (const std::string &line)
 Constructs a Line from a string. More...
 
Lineoperator= (const std::string &line)
 Assigns content from a string to the Line. More...
 
Lineoperator+= (const std::string &arg)
 Appends a string to the end of the Line. More...
 
template<class T >
Lineoperator<< (const T &field)
 Inserts an element at the end of the Line. More...
 
Lineappend (const std::string &arg)
 Appends a string to the end of the Line. More...
 
Linestr (const std::string &line)
 Assigns content to the Line based on a string. More...
 
std::string str () const
 Returns a formatted string representation of the Line. More...
 
reference operator[] (size_type n)
 Subscript access to the strings contained in the Line. More...
 
const_reference operator[] (size_type n) const
 Subscript access to the strings contained in the Line. More...
 
reference at (size_type n)
 Provides access to the strings contained in the Line. More...
 
const_reference at (size_type n) const
 Provides access to the strings contained in the Line. More...
 
reference front ()
 Returns a read/write reference to the first element of the Line. More...
 
const_reference front () const
 Returns a read-only (constant) reference to the first element of the Line. More...
 
reference back ()
 Returns a read/write reference to the last element of the Line. More...
 
const_reference back () const
 Returns a read-only (constant) reference to the last element of the Line. More...
 
iterator begin ()
 Returns a read/write iterator that points to the first element in the Line. More...
 
const_iterator begin () const
 Returns a read-only (constant) iterator that points to the first element in the Line. More...
 
const_iterator cbegin () const
 Returns a read-only (constant) iterator that points to the first element in the Line. More...
 
iterator end ()
 Returns a read/write iterator that points one past the last element in the Line. More...
 
const_iterator end () const
 Returns a read-only (constant) iterator that points one past the last element in the Line. More...
 
const_iterator cend () const
 Returns a read-only (constant) iterator that points one past the last element in the Line. More...
 
reverse_iterator rbegin ()
 Returns a read/write reverse iterator that points to the last element in the Line. More...
 
const_reverse_iterator rbegin () const
 Returns a read-only (constant) reverse iterator that points to the last element in the Line. More...
 
const_reverse_iterator crbegin () const
 Returns a read-only (constant) reverse iterator that points to the last element in the Line. More...
 
reverse_iterator rend ()
 Returns a read/write reverse iterator that points to one before the first element in the Line. More...
 
const_reverse_iterator rend () const
 Returns a read-only (constant) reverse iterator that points to one before the first element in the Line. More...
 
const_reverse_iterator crend () const
 Returns a read-only (constant) reverse iterator that points to one before the first element in the Line. More...
 
bool is_block_def () const
 Returns true if the Line begins with "BLOCK" or "DECAY" followed by a block name. More...
 
bool is_comment_line () const
 Returns true if the Line begins with "#". More...
 
bool is_data_line () const
 Returns true if the Line is not empty and if it does not begin with "#", "BLOCK" or "DECAY". More...
 
size_type size () const
 Returns the number of elements in the Line. More...
 
size_type data_size () const
 Returns the number of elements without the comment in the Line. More...
 
size_type max_size () const
 Returns the size() of the largest possible Line. More...
 
bool empty () const
 Returns true if the Line is empty. More...
 
void swap (Line &line)
 Swaps data with another Line. More...
 
void clear ()
 Erases all the elements in the Line. More...
 
void reformat ()
 Reformats the string representation of the Line. More...
 
void comment ()
 Comments the Line. More...
 
void uncomment ()
 Uncomments the Line. More...
 

Detailed Description

Container of strings that represents a line in a SLHA structure.

This class is a container of strings that represents a line in a SLHA structure. The elements of a Line are the so called fields of an ordinary SLHA line, which are its whitespace-separated substrings and the comment. For example, if a Line is constructed from the string " 1 2 0.123 # a comment" its elements would be "1", "2", "0.123", and "# a comment". Array-style access to the elements with integer indices is provided by the operator[]() and at() functions. Line also provides introspective functions to find out whether it is a comment or data line for example. Introspective functions that check if an element is a block specifier ("BLOCK" or "DECAY") always perform case-insensitive comparisons.

In addition to storing the fields of a SLHA line, a Line also stores its formatting (the exact position of the fields in the line). A formatted representation of a Line can be produced with str() const. The reformat() function clears the previous formatting and indents all elements with an appropriate number of spaces.

Member Typedef Documentation

typedef std::string value_type
typedef std::string& reference
typedef const std::string& const_reference
typedef impl_type::iterator iterator
typedef impl_type::const_iterator const_iterator
typedef impl_type::reverse_iterator reverse_iterator
typedef impl_type::const_reverse_iterator const_reverse_iterator
typedef impl_type::pointer pointer
typedef impl_type::const_pointer const_pointer
typedef impl_type::difference_type difference_type
typedef impl_type::size_type size_type

Constructor & Destructor Documentation

Line ( )
inline

Constructs an empty Line.

Line ( const std::string &  line)
inline

Constructs a Line from a string.

Parameters
lineString whose fields are used as content of the Line.
See Also
str()

+ Here is the call graph for this function:

Member Function Documentation

Line& operator= ( const std::string &  line)
inline

Assigns content from a string to the Line.

Parameters
lineString whose fields are used as content of the Line.
Returns
Reference to *this.

This function is an alias for str().

+ Here is the call graph for this function:

Line& operator+= ( const std::string &  arg)
inline

Appends a string to the end of the Line.

Parameters
argString that is appended to the Line.
Returns
Reference to *this.

This function is an alias for append().

+ Here is the call graph for this function:

Line& operator<< ( const T &  field)
inline

Inserts an element at the end of the Line.

Parameters
fieldElement that is inserted at the end of the Line.
Returns
Reference to *this.

This function inserts an element at the end of the Line. If the the Line contains a comment, field is only appended to the last element and thus size() remains unchanged.

+ Here is the call graph for this function:

Line& append ( const std::string &  arg)
inline

Appends a string to the end of the Line.

Parameters
argString that is appended to the Line.
Returns
Reference to *this.

This function appends arg to the output of str() const and uses this temporary string as input for str(). Based on the temporary string, size() is increased or remains unchanged.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Line& str ( const std::string &  line)
inline

Assigns content to the Line based on a string.

Parameters
lineString whose fields are used as content of the Line.
Returns
Reference to *this.

This function parses line and sets the found fields as content of the Line. If line contains newlines, everything after the first newline is ignored.

The exact formatting of line is stored internally and can be reproduced with str() const.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string str ( ) const
inline

Returns a formatted string representation of the Line.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

reference operator[] ( size_type  n)
inline

Subscript access to the strings contained in the Line.

Parameters
nIndex of the string which should be accessed.
Returns
Read/write reference to the accessed string.

This operator allows for easy, array-style, data access. Note that data access with this operator is unchecked and out_of_range lookups are not defined. (For checked lookups see at().)

const_reference operator[] ( size_type  n) const
inline

Subscript access to the strings contained in the Line.

Parameters
nIndex of the string which should be accessed.
Returns
Read-only (constant) reference to the accessed string.

This operator allows for easy, array-style, data access. Note that data access with this operator is unchecked and out_of_range lookups are not defined. (For checked lookups see at().)

reference at ( size_type  n)
inline

Provides access to the strings contained in the Line.

Parameters
nIndex of the string which should be accessed.
Returns
Read/write reference to the accessed string.
Exceptions
std::out_of_rangeIf n is an invalid index.
Examples:
05_advanced_input.cpp, 08_matrix_input.cpp, 09_decay_input.cpp, 10_blocks_of_the_same_name.cpp, and 11_multiple_columns.cpp.

+ Here is the caller graph for this function:

const_reference at ( size_type  n) const
inline

Provides access to the strings contained in the Line.

Parameters
nIndex of the string which should be accessed.
Returns
Read-only (constant) reference to the accessed string.
Exceptions
std::out_of_rangeIf n is an invalid index.
reference front ( )
inline

Returns a read/write reference to the first element of the Line.

+ Here is the caller graph for this function:

const_reference front ( ) const
inline

Returns a read-only (constant) reference to the first element of the Line.

reference back ( )
inline

Returns a read/write reference to the last element of the Line.

+ Here is the caller graph for this function:

const_reference back ( ) const
inline

Returns a read-only (constant) reference to the last element of the Line.

iterator begin ( )
inline

Returns a read/write iterator that points to the first element in the Line.

Iteration is done in ordinary element order.

+ Here is the caller graph for this function:

const_iterator begin ( ) const
inline

Returns a read-only (constant) iterator that points to the first element in the Line.

Iteration is done in ordinary element order.

const_iterator cbegin ( ) const
inline

Returns a read-only (constant) iterator that points to the first element in the Line.

Iteration is done in ordinary element order.

iterator end ( )
inline

Returns a read/write iterator that points one past the last element in the Line.

Iteration is done in ordinary element order.

+ Here is the caller graph for this function:

const_iterator end ( ) const
inline

Returns a read-only (constant) iterator that points one past the last element in the Line.

Iteration is done in ordinary element order.

const_iterator cend ( ) const
inline

Returns a read-only (constant) iterator that points one past the last element in the Line.

Iteration is done in ordinary element order.

reverse_iterator rbegin ( )
inline

Returns a read/write reverse iterator that points to the last element in the Line.

Iteration is done in reverse element order.

const_reverse_iterator rbegin ( ) const
inline

Returns a read-only (constant) reverse iterator that points to the last element in the Line.

Iteration is done in reverse element order.

const_reverse_iterator crbegin ( ) const
inline

Returns a read-only (constant) reverse iterator that points to the last element in the Line.

Iteration is done in reverse element order.

reverse_iterator rend ( )
inline

Returns a read/write reverse iterator that points to one before the first element in the Line.

Iteration is done in reverse element order.

const_reverse_iterator rend ( ) const
inline

Returns a read-only (constant) reverse iterator that points to one before the first element in the Line.

Iteration is done in reverse element order.

const_reverse_iterator crend ( ) const
inline

Returns a read-only (constant) reverse iterator that points to one before the first element in the Line.

Iteration is done in reverse element order.

bool is_block_def ( ) const
inline

Returns true if the Line begins with "BLOCK" or "DECAY" followed by a block name.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool is_comment_line ( ) const
inline

Returns true if the Line begins with "#".

+ Here is the call graph for this function:

bool is_data_line ( ) const
inline

Returns true if the Line is not empty and if it does not begin with "#", "BLOCK" or "DECAY".

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

size_type size ( ) const
inline

Returns the number of elements in the Line.

+ Here is the caller graph for this function:

size_type data_size ( ) const
inline

Returns the number of elements without the comment in the Line.

+ Here is the call graph for this function:

size_type max_size ( ) const
inline

Returns the size() of the largest possible Line.

bool empty ( ) const
inline

Returns true if the Line is empty.

+ Here is the caller graph for this function:

void swap ( Line line)
inline

Swaps data with another Line.

Parameters
lineLine to be swapped with.
void clear ( )
inline

Erases all the elements in the Line.

+ Here is the caller graph for this function:

void reformat ( )
inline

Reformats the string representation of the Line.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void comment ( )
inline

Comments the Line.

This function prefixes the Line with a "#" and packetizes all its elements into one.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void uncomment ( )
inline

Uncomments the Line.

This function removes the first character of the Line if it is a "#" and splits the former comment into the corresponding number of fields.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:


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