SLHAea
0.1
containers for SUSY Les Houches Accord input/output
|
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... | |
Line & | operator= (const std::string &line) |
Assigns content from a string to the Line. More... | |
Line & | operator+= (const std::string &arg) |
Appends a string to the end of the Line. More... | |
template<class T > | |
Line & | operator<< (const T &field) |
Inserts an element at the end of the Line. More... | |
Line & | append (const std::string &arg) |
Appends a string to the end of the Line. More... | |
Line & | str (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... | |
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.
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 |
|
inline |
Constructs an empty Line.
|
inline |
Constructs a Line from a string.
line | String whose fields are used as content of the Line. |
|
inline |
Assigns content from a string to the Line.
line | String whose fields are used as content of the Line. |
*this
.This function is an alias for str().
|
inline |
Appends a string to the end of the Line.
arg | String that is appended to the Line. |
*this
.This function is an alias for append().
|
inline |
Inserts an element at the end of the Line.
field | Element that is inserted at the end of the Line. |
*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.
|
inline |
Appends a string to the end of the Line.
arg | String that is appended to the Line. |
*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.
|
inline |
Assigns content to the Line based on a string.
line | String whose fields are used as content of the Line. |
*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.
|
inline |
Returns a formatted string representation of the Line.
Subscript access to the strings contained in the Line.
n | Index of the string which should be accessed. |
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().)
|
inline |
Subscript access to the strings contained in the Line.
n | Index of the string which should be accessed. |
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().)
Provides access to the strings contained in the Line.
n | Index of the string which should be accessed. |
std::out_of_range | If n is an invalid index. |
|
inline |
Provides access to the strings contained in the Line.
n | Index of the string which should be accessed. |
std::out_of_range | If n is an invalid index. |
|
inline |
Returns a read/write reference to the first element of the Line.
|
inline |
Returns a read-only (constant) reference to the first element of the Line.
|
inline |
Returns a read/write reference to the last element of the Line.
|
inline |
Returns a read-only (constant) reference to the last element of the Line.
|
inline |
Returns a read/write iterator that points to the first element in the Line.
Iteration is done in ordinary element order.
|
inline |
Returns a read-only (constant) iterator that points to the first element in the Line.
Iteration is done in ordinary element order.
|
inline |
Returns a read-only (constant) iterator that points to the first element in the Line.
Iteration is done in ordinary element order.
|
inline |
Returns a read/write iterator that points one past the last element in the Line.
Iteration is done in ordinary element order.
|
inline |
Returns a read-only (constant) iterator that points one past the last element in the Line.
Iteration is done in ordinary element order.
|
inline |
Returns a read-only (constant) iterator that points one past the last element in the Line.
Iteration is done in ordinary element order.
|
inline |
Returns a read/write reverse iterator that points to the last element in the Line.
Iteration is done in reverse element order.
|
inline |
Returns a read-only (constant) reverse iterator that points to the last element in the Line.
Iteration is done in reverse element order.
|
inline |
Returns a read-only (constant) reverse iterator that points to the last element in the Line.
Iteration is done in reverse element order.
|
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.
|
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.
|
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.
|
inline |
Returns true if the Line begins with "BLOCK"
or "DECAY"
followed by a block name.
|
inline |
Returns true if the Line begins with "#"
.
|
inline |
Returns true if the Line is not empty and if it does not begin with "#"
, "BLOCK"
or "DECAY"
.
|
inline |
Returns the number of elements in the Line.
|
inline |
Returns the number of elements without the comment in the Line.
|
inline |
Returns true if the Line is empty.
|
inline |
Swaps data with another Line.
line | Line to be swapped with. |
|
inline |
Erases all the elements in the Line.
|
inline |
Reformats the string representation of the Line.
|
inline |
Comments the Line.
This function prefixes the Line with a "#"
and packetizes all its elements into one.
|
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.