Chemical Data Processing Library C++ API - Version 1.4.0
Public Types | Public Member Functions | List of all members
CDPL::Biomol::MMCIFData::Item Class Reference

A single data item (column) of an mmCIF category, holding an ordered list of string values. More...

#include <MMCIFData.hpp>

Public Types

typedef ValueList::const_iterator ConstValueIterator
 A constant iterator over the value list. More...
 
typedef ValueList::iterator ValueIterator
 A mutable iterator over the value list. More...
 

Public Member Functions

 Item (const std::string &name)
 Constructs an empty Item instance with the data item name name. More...
 
const std::string & getName () const
 Returns the mmCIF data item name. More...
 
std::size_t getNumValues () const
 Returns the number of values stored in the item. More...
 
void clear ()
 Removes all values from the item. More...
 
const std::string & getValue (std::size_t index) const
 Returns the value at index index. More...
 
void setValue (std::size_t index, const std::string &value)
 Replaces the value at index index by value. More...
 
void setValue (std::size_t index, std::string &&value)
 Replaces the value at index index by moving value. More...
 
void addValue (const std::string &value)
 Appends the value value to the item's value list. More...
 
void addValue (std::string &&value)
 Appends the value value to the item's value list by moving. More...
 
ValueIterator removeValue (const ValueIterator &it)
 Removes the value pointed to by the iterator it. More...
 
void removeValue (std::size_t index)
 Removes the value at index index. More...
 
void swap (Item &item)
 Swaps the contents of this item with those of item. More...
 
ConstValueIterator getValuesBegin () const
 Returns a constant iterator pointing to the beginning of the value list. More...
 
ValueIterator getValuesBegin ()
 Returns a mutable iterator pointing to the beginning of the value list. More...
 
ConstValueIterator getValuesEnd () const
 Returns a constant iterator pointing one past the last value. More...
 
ValueIterator getValuesEnd ()
 Returns a mutable iterator pointing one past the last value. More...
 
ConstValueIterator begin () const
 Returns a constant iterator pointing to the beginning of the value list (alias of getValuesBegin()). More...
 
ValueIterator begin ()
 Returns a mutable iterator pointing to the beginning of the value list (alias of getValuesBegin()). More...
 
ConstValueIterator end () const
 Returns a constant iterator pointing one past the last value (alias of getValuesEnd()). More...
 
ValueIterator end ()
 Returns a mutable iterator pointing one past the last value (alias of getValuesEnd()). More...
 

Detailed Description

A single data item (column) of an mmCIF category, holding an ordered list of string values.

Member Typedef Documentation

◆ ConstValueIterator

typedef ValueList::const_iterator CDPL::Biomol::MMCIFData::Item::ConstValueIterator

A constant iterator over the value list.

◆ ValueIterator

typedef ValueList::iterator CDPL::Biomol::MMCIFData::Item::ValueIterator

A mutable iterator over the value list.

Constructor & Destructor Documentation

◆ Item()

CDPL::Biomol::MMCIFData::Item::Item ( const std::string &  name)
inline

Constructs an empty Item instance with the data item name name.

Parameters
nameThe mmCIF data item name (without a category name prefix!).

Member Function Documentation

◆ getName()

const std::string& CDPL::Biomol::MMCIFData::Item::getName ( ) const

Returns the mmCIF data item name.

Returns
A const reference to the data item name.

◆ getNumValues()

std::size_t CDPL::Biomol::MMCIFData::Item::getNumValues ( ) const

Returns the number of values stored in the item.

Returns
The value count.

◆ clear()

void CDPL::Biomol::MMCIFData::Item::clear ( )

Removes all values from the item.

◆ getValue()

const std::string& CDPL::Biomol::MMCIFData::Item::getValue ( std::size_t  index) const

Returns the value at index index.

Parameters
indexThe zero-based value index.
Returns
A const reference to the value.
Exceptions
Base::IndexErrorif index is not in the range [0, getNumValues()).

◆ setValue() [1/2]

void CDPL::Biomol::MMCIFData::Item::setValue ( std::size_t  index,
const std::string &  value 
)

Replaces the value at index index by value.

Parameters
indexThe zero-based value index.
valueThe new value.
Exceptions
Base::IndexErrorif index is not in the range [0, getNumValues()).

◆ setValue() [2/2]

void CDPL::Biomol::MMCIFData::Item::setValue ( std::size_t  index,
std::string &&  value 
)

Replaces the value at index index by moving value.

Parameters
indexThe zero-based value index.
valueThe new value to move-assign.
Exceptions
Base::IndexErrorif index is not in the range [0, getNumValues()).

◆ addValue() [1/2]

void CDPL::Biomol::MMCIFData::Item::addValue ( const std::string &  value)

Appends the value value to the item's value list.

Parameters
valueThe value to append.

◆ addValue() [2/2]

void CDPL::Biomol::MMCIFData::Item::addValue ( std::string &&  value)

Appends the value value to the item's value list by moving.

Parameters
valueThe value to move-append.

◆ removeValue() [1/2]

ValueIterator CDPL::Biomol::MMCIFData::Item::removeValue ( const ValueIterator &  it)

Removes the value pointed to by the iterator it.

Parameters
itAn iterator pointing to the value to remove.
Returns
An iterator pointing to the value immediately following the removed one.

◆ removeValue() [2/2]

void CDPL::Biomol::MMCIFData::Item::removeValue ( std::size_t  index)

Removes the value at index index.

Parameters
indexThe zero-based value index.
Exceptions
Base::IndexErrorif index is not in the range [0, getNumValues()).

◆ swap()

void CDPL::Biomol::MMCIFData::Item::swap ( Item &  item)

Swaps the contents of this item with those of item.

Parameters
itemThe other item to swap with.

◆ getValuesBegin() [1/2]

ConstValueIterator CDPL::Biomol::MMCIFData::Item::getValuesBegin ( ) const

Returns a constant iterator pointing to the beginning of the value list.

Returns
A constant iterator to the first value.

◆ getValuesBegin() [2/2]

ValueIterator CDPL::Biomol::MMCIFData::Item::getValuesBegin ( )

Returns a mutable iterator pointing to the beginning of the value list.

Returns
A mutable iterator to the first value.

◆ getValuesEnd() [1/2]

ConstValueIterator CDPL::Biomol::MMCIFData::Item::getValuesEnd ( ) const

Returns a constant iterator pointing one past the last value.

Returns
A constant iterator to the end of the value list.

◆ getValuesEnd() [2/2]

ValueIterator CDPL::Biomol::MMCIFData::Item::getValuesEnd ( )

Returns a mutable iterator pointing one past the last value.

Returns
A mutable iterator to the end of the value list.

◆ begin() [1/2]

ConstValueIterator CDPL::Biomol::MMCIFData::Item::begin ( ) const

Returns a constant iterator pointing to the beginning of the value list (alias of getValuesBegin()).

Returns
A constant iterator to the first value.

◆ begin() [2/2]

ValueIterator CDPL::Biomol::MMCIFData::Item::begin ( )

Returns a mutable iterator pointing to the beginning of the value list (alias of getValuesBegin()).

Returns
A mutable iterator to the first value.

◆ end() [1/2]

ConstValueIterator CDPL::Biomol::MMCIFData::Item::end ( ) const

Returns a constant iterator pointing one past the last value (alias of getValuesEnd()).

Returns
A constant iterator to the end of the value list.

◆ end() [2/2]

ValueIterator CDPL::Biomol::MMCIFData::Item::end ( )

Returns a mutable iterator pointing one past the last value (alias of getValuesEnd()).

Returns
A mutable iterator to the end of the value list.

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