cpp-strings 1.0.4
Pythonic c++ strings
Loading...
Searching...
No Matches
pcs::CppStringT< CharT, TraitsT, AllocatorT >::TransTable Class Reference

The internal class of translation tables, used with methods CppStringT::maketrans and CppStringT::translate. More...

#include <cppstrings.h>

Public Types

using key_type = CharT
using value_type = CppStringT

Public Member Functions

std::map< typename key_type, typename value_type > & get_table () noexcept
 < for tests purposes
TransTableoperator= (const std::map< key_type, value_type > &trans_table) noexcept
 Assignment operator with a standard map.
TransTableoperator= (const TransTable &) noexcept=default
 Default copy assignment.
TransTableoperator= (TransTable &&) noexcept=default
 Default move assignment.
value_type operator[] (const key_type ch) noexcept
 Indexing operator.
 TransTable () noexcept=default
 Default empty constructor.
 TransTable (const CharT *keys, const CharT *values)
 Creates a TransTable from two pointers to null-terminated lists of characters (#6).
 TransTable (const CharT *keys, const CharT *values, const CharT *not_translated)
 Creates a TransTable from three pointers to null-terminated lists of characters (#7).
 TransTable (const CppStringT &keys, const CppStringT &values)
 Creates a TransTable from two strings (#2).
 TransTable (const CppStringT &keys, const CppStringT &values, const CppStringT &not_translated)
 Creates a TransTable from three strings (#3).
 TransTable (const CppStringT &keys, const std::initializer_list< CppStringT > &values)
 Creates a TransTable from a string and an initalization list (#4).
 TransTable (const CppStringT &keys, const std::initializer_list< CppStringT > values, const CppStringT &not_translated)
 Creates a TransTable from a string, an initalization list and a string (#5).
 TransTable (const std::map< key_type, value_type > trans_table)
 Creates a TransTable from a standard map (#1).
template<class StringViewLike>
 TransTable (const StringViewLike &keys, const StringViewLike &values)
 Creates a TransTable from two string views (#10).
 TransTable (const TransTable &) noexcept=default
 Default copy constructor.
template<class Key1It, class ValueIt, class Key2It>
 TransTable (Key1It first_key, Key1It last_key, ValueIt first_value, ValueIt last_value, Key2It first_not_translated, Key2It last_not_translated)
 Creates a TransTable from three containers iterators (#9).
template<class KeyIt, class ValueIt>
 TransTable (KeyIt first_key, KeyIt last_key, ValueIt first_value, ValueIt last_value)
 Creates a TransTable from two containers iterators (#8).
 TransTable (TransTable &&) noexcept=default
 Default move constructor.
 ~TransTable () noexcept=default
 Default descrtuctor.

Detailed Description

template<class CharT, class TraitsT, class AllocatorT>
class pcs::CppStringT< CharT, TraitsT, AllocatorT >::TransTable

The internal class of translation tables, used with methods CppStringT::maketrans and CppStringT::translate.

Constructor & Destructor Documentation

◆ TransTable() [1/13]

template<class CharT, class TraitsT, class AllocatorT>
pcs::CppStringT< CharT, TraitsT, AllocatorT >::TransTable::TransTable ( const std::map< key_type, value_type > trans_table)
inline

Creates a TransTable from a standard map (#1).

Referenced by operator=(), operator=(), operator=(), TransTable(), TransTable(), and ~TransTable().

◆ TransTable() [2/13]

template<class CharT, class TraitsT, class AllocatorT>
pcs::CppStringT< CharT, TraitsT, AllocatorT >::TransTable::TransTable ( const CppStringT & keys,
const CppStringT & values )
inline

Creates a TransTable from two strings (#2).

Parameters keys and values must have the same size. The i-th character in key is associated in the translation table with the i-th character in values.

◆ TransTable() [3/13]

template<class CharT, class TraitsT, class AllocatorT>
pcs::CppStringT< CharT, TraitsT, AllocatorT >::TransTable::TransTable ( const CppStringT & keys,
const CppStringT & values,
const CppStringT & not_translated )
inline

Creates a TransTable from three strings (#3).

Parameters keys and values must have the same size. The i-th character in key is associated in the translation table with the i -th character in values. Finally, the characters contained in string not_translated are associated in the translation table with the empty string.

◆ TransTable() [4/13]

template<class CharT, class TraitsT, class AllocatorT>
pcs::CppStringT< CharT, TraitsT, AllocatorT >::TransTable::TransTable ( const CppStringT & keys,
const std::initializer_list< CppStringT > & values )
inline

Creates a TransTable from a string and an initalization list (#4).

Parameters keys and values must have the same size. The i-th character in key is associated in the translation table with the i-th character in values.

◆ TransTable() [5/13]

template<class CharT, class TraitsT, class AllocatorT>
pcs::CppStringT< CharT, TraitsT, AllocatorT >::TransTable::TransTable ( const CppStringT & keys,
const std::initializer_list< CppStringT > values,
const CppStringT & not_translated )
inline

Creates a TransTable from a string, an initalization list and a string (#5).

Parameters keys and values must have the same size. The i-th character in key is associated in the translation table with the i -th character in values. Finally, the characters contained in string not_translated are associated in the translation table with the empty string.

◆ TransTable() [6/13]

template<class CharT, class TraitsT, class AllocatorT>
pcs::CppStringT< CharT, TraitsT, AllocatorT >::TransTable::TransTable ( const CharT * keys,
const CharT * values )
inline

Creates a TransTable from two pointers to null-terminated lists of characters (#6).

Parameters keys and values must have the same size. The i-th character in key is associated in the translation table with the i-th character in values.

◆ TransTable() [7/13]

template<class CharT, class TraitsT, class AllocatorT>
pcs::CppStringT< CharT, TraitsT, AllocatorT >::TransTable::TransTable ( const CharT * keys,
const CharT * values,
const CharT * not_translated )
inline

Creates a TransTable from three pointers to null-terminated lists of characters (#7).

Parameters keys and values must have the same size. The i-th character in key is associated in the translation table with the i -th entry in values. Finally, the characters contained in string not_translated are associated in the translation table with the empty string.

◆ TransTable() [8/13]

template<class CharT, class TraitsT, class AllocatorT>
template<class KeyIt, class ValueIt>
pcs::CppStringT< CharT, TraitsT, AllocatorT >::TransTable::TransTable ( KeyIt first_key,
KeyIt last_key,
ValueIt first_value,
ValueIt last_value )
inline

Creates a TransTable from two containers iterators (#8).

Both containers should have the same size. The i-th character in key is associated in the translation table with the i-th entry in values.

◆ TransTable() [9/13]

template<class CharT, class TraitsT, class AllocatorT>
template<class Key1It, class ValueIt, class Key2It>
pcs::CppStringT< CharT, TraitsT, AllocatorT >::TransTable::TransTable ( Key1It first_key,
Key1It last_key,
ValueIt first_value,
ValueIt last_value,
Key2It first_not_translated,
Key2It last_not_translated )
inline

Creates a TransTable from three containers iterators (#9).

Both containers should have the same size. The i-th character in key is associated in the translation table with the i -th character in values. Finally, the characters contained in string not_translated are associated in the translation table with the empty string.

◆ TransTable() [10/13]

template<class CharT, class TraitsT, class AllocatorT>
template<class StringViewLike>
pcs::CppStringT< CharT, TraitsT, AllocatorT >::TransTable::TransTable ( const StringViewLike & keys,
const StringViewLike & values )
inlineexplicit

Creates a TransTable from two string views (#10).

Parameters keys and values must have the same size. The i-th character in key is associated in the translation table with the i-th character in values.

◆ TransTable() [11/13]

template<class CharT, class TraitsT, class AllocatorT>
pcs::CppStringT< CharT, TraitsT, AllocatorT >::TransTable::TransTable ( )
inlinedefaultnoexcept

Default empty constructor.

◆ TransTable() [12/13]

template<class CharT, class TraitsT, class AllocatorT>
pcs::CppStringT< CharT, TraitsT, AllocatorT >::TransTable::TransTable ( const TransTable & )
inlinedefaultnoexcept

Default copy constructor.

References TransTable().

◆ TransTable() [13/13]

template<class CharT, class TraitsT, class AllocatorT>
pcs::CppStringT< CharT, TraitsT, AllocatorT >::TransTable::TransTable ( TransTable && )
inlinedefaultnoexcept

Default move constructor.

References TransTable().

◆ ~TransTable()

template<class CharT, class TraitsT, class AllocatorT>
pcs::CppStringT< CharT, TraitsT, AllocatorT >::TransTable::~TransTable ( )
inlinedefaultnoexcept

Default descrtuctor.

References TransTable().

Member Function Documentation

◆ get_table()

template<class CharT, class TraitsT, class AllocatorT>
std::map< typename key_type, typename value_type > & pcs::CppStringT< CharT, TraitsT, AllocatorT >::TransTable::get_table ( )
inlinenoexcept

< for tests purposes

◆ operator=() [1/3]

template<class CharT, class TraitsT, class AllocatorT>
TransTable & pcs::CppStringT< CharT, TraitsT, AllocatorT >::TransTable::operator= ( const std::map< key_type, value_type > & trans_table)
inlinenoexcept

Assignment operator with a standard map.

References TransTable().

◆ operator=() [2/3]

template<class CharT, class TraitsT, class AllocatorT>
TransTable & pcs::CppStringT< CharT, TraitsT, AllocatorT >::TransTable::operator= ( const TransTable & )
inlinedefaultnoexcept

Default copy assignment.

References TransTable().

◆ operator=() [3/3]

template<class CharT, class TraitsT, class AllocatorT>
TransTable & pcs::CppStringT< CharT, TraitsT, AllocatorT >::TransTable::operator= ( TransTable && )
inlinedefaultnoexcept

Default move assignment.

References TransTable().

◆ operator[]()

template<class CharT, class TraitsT, class AllocatorT>
value_type pcs::CppStringT< CharT, TraitsT, AllocatorT >::TransTable::operator[] ( const key_type ch)
inlinenodiscardnoexcept

Indexing operator.


The documentation for this class was generated from the following file:
  • cppstrings.h