NewLang Project
Yet another programm language
Loading...
Searching...
No Matches
newlang::Dict< T, PTR > Class Template Reference

#include <dict.h>

Inheritance diagram for newlang::Dict< T, PTR >:

Public Types

typedef PTR Type
 
typedef std::pair< std::string, TypePairType
 
typedef std::list< PairTypeListType
 

Public Member Functions

template<typename I >
std::enable_if< std::is_integral< I >::value &&!std::is_pointer< I >::value, constPairType & >::type operator[] (I index)
 
template<typename N >
std::enable_if< std::is_same< N, std::string >::value||std::is_pointer< N >::value, constPairType & >::type operator[] (N name)
 
PairTypepush_back (const PairType &p)
 
PairTypepush_back (const Type value, const std::string &name="")
 
virtual PairTypeat (const int64_t index)
 
virtual const PairTypeat (const int64_t index) const
 
ListType::iterator find (const std::string_view name)
 
virtual PairTypeat (const std::string name)
 
virtual const std::string & name (const int64_t index) const
 
virtual int64_t index (const std::string_view field_name)
 
virtual void clear_ ()
 
virtual int64_t resize (int64_t new_size, const Type fill, const std::string &name="")
 
ListType::iterator at_index (const int64_t index)
 
ListType::const_iterator at_index_const (const int64_t index) const
 
virtual void erase (const int64_t index)
 
virtual void erase (const size_t index_from, const size_t index_to)
 
virtual ~Dict ()
 
 Dict ()
 
 Dict (PairType arg)
 
template<class... A>
 Dict (PairType arg, A... rest)
 

Static Public Member Functions

static PairType pair (const Type value, const std::string name="")
 

Friends

class Context
 

Detailed Description

template<typename T, typename PTR = std::shared_ptr<T>>
class newlang::Dict< T, PTR >

Definition at line 73 of file dict.h.

Member Typedef Documentation

◆ Type

template<typename T , typename PTR = std::shared_ptr<T>>
typedef PTR newlang::Dict< T, PTR >::Type

Definition at line 76 of file dict.h.

◆ PairType

template<typename T , typename PTR = std::shared_ptr<T>>
typedef std::pair<std::string, Type> newlang::Dict< T, PTR >::PairType

Definition at line 77 of file dict.h.

◆ ListType

template<typename T , typename PTR = std::shared_ptr<T>>
typedef std::list<PairType> newlang::Dict< T, PTR >::ListType

Definition at line 78 of file dict.h.

Constructor & Destructor Documentation

◆ ~Dict()

template<typename T , typename PTR = std::shared_ptr<T>>
virtual newlang::Dict< T, PTR >::~Dict ( )
inlinevirtual

Definition at line 255 of file dict.h.

◆ Dict() [1/3]

template<typename T , typename PTR = std::shared_ptr<T>>
newlang::Dict< T, PTR >::Dict ( )
inline

Definition at line 261 of file dict.h.

◆ Dict() [2/3]

template<typename T , typename PTR = std::shared_ptr<T>>
newlang::Dict< T, PTR >::Dict ( PairType arg)
inline

Definition at line 264 of file dict.h.

◆ Dict() [3/3]

template<typename T , typename PTR = std::shared_ptr<T>>
template<class... A>
newlang::Dict< T, PTR >::Dict ( PairType arg,
A... rest )
inline

Definition at line 269 of file dict.h.

Member Function Documentation

◆ operator[]() [1/2]

template<typename T , typename PTR = std::shared_ptr<T>>
template<typename I >
std::enable_if< std::is_integral< I >::value &&!std::is_pointer< I >::value, constPairType & >::type newlang::Dict< T, PTR >::operator[] ( I index)
inline

Definition at line 84 of file dict.h.

References newlang::Dict< T, PTR >::at(), and newlang::Dict< T, PTR >::index().

Referenced by newlang::Obj::op_set_index().

◆ operator[]() [2/2]

template<typename T , typename PTR = std::shared_ptr<T>>
template<typename N >
std::enable_if< std::is_same< N, std::string >::value||std::is_pointer< N >::value, constPairType & >::type newlang::Dict< T, PTR >::operator[] ( N name)
inline

Definition at line 90 of file dict.h.

References newlang::Dict< T, PTR >::at(), and newlang::Dict< T, PTR >::name().

◆ push_back() [1/2]

template<typename T , typename PTR = std::shared_ptr<T>>
PairType & newlang::Dict< T, PTR >::push_back ( const PairType & p)
inline

◆ push_back() [2/2]

template<typename T , typename PTR = std::shared_ptr<T>>
PairType & newlang::Dict< T, PTR >::push_back ( const Type value,
const std::string & name = "" )
inline

◆ pair()

template<typename T , typename PTR = std::shared_ptr<T>>
static PairType newlang::Dict< T, PTR >::pair ( const Type value,
const std::string name = "" )
inlinestatic

Definition at line 110 of file dict.h.

References newlang::Dict< T, PTR >::name().

Referenced by newlang::Dict< T, PTR >::push_back().

◆ at() [1/3]

template<typename T , typename PTR = std::shared_ptr<T>>
virtual PairType & newlang::Dict< T, PTR >::at ( const int64_t index)
inlinevirtual

◆ at() [2/3]

template<typename T , typename PTR = std::shared_ptr<T>>
virtual const PairType & newlang::Dict< T, PTR >::at ( const int64_t index) const
inlinevirtual

Reimplemented in newlang::Obj.

Definition at line 118 of file dict.h.

References newlang::Dict< T, PTR >::at_index_const(), and newlang::Dict< T, PTR >::index().

◆ find()

template<typename T , typename PTR = std::shared_ptr<T>>
ListType::iterator newlang::Dict< T, PTR >::find ( const std::string_view name)
inline

◆ at() [3/3]

template<typename T , typename PTR = std::shared_ptr<T>>
virtual PairType & newlang::Dict< T, PTR >::at ( const std::string name)
inlinevirtual

Reimplemented in newlang::Obj.

Definition at line 137 of file dict.h.

References newlang::Dict< T, PTR >::find(), LOG_RUNTIME, and newlang::Dict< T, PTR >::name().

◆ name()

template<typename T , typename PTR = std::shared_ptr<T>>
virtual const std::string & newlang::Dict< T, PTR >::name ( const int64_t index) const
inlinevirtual

◆ index()

template<typename T , typename PTR = std::shared_ptr<T>>
virtual int64_t newlang::Dict< T, PTR >::index ( const std::string_view field_name)
inlinevirtual

◆ clear_()

template<typename T , typename PTR = std::shared_ptr<T>>
virtual void newlang::Dict< T, PTR >::clear_ ( )
inlinevirtual

◆ resize()

template<typename T , typename PTR = std::shared_ptr<T>>
virtual int64_t newlang::Dict< T, PTR >::resize ( int64_t new_size,
const Type fill,
const std::string & name = "" )
inlinevirtual

Reimplemented in newlang::Obj.

Definition at line 161 of file dict.h.

References newlang::Dict< T, PTR >::at_index(), and newlang::Dict< T, PTR >::name().

Referenced by newlang::Obj::resize(), and newlang::Obj::resize_().

◆ at_index()

template<typename T , typename PTR = std::shared_ptr<T>>
ListType::iterator newlang::Dict< T, PTR >::at_index ( const int64_t index)
inline

◆ at_index_const()

template<typename T , typename PTR = std::shared_ptr<T>>
ListType::const_iterator newlang::Dict< T, PTR >::at_index_const ( const int64_t index) const
inline

◆ erase() [1/2]

template<typename T , typename PTR = std::shared_ptr<T>>
virtual void newlang::Dict< T, PTR >::erase ( const int64_t index)
inlinevirtual

Reimplemented in newlang::Obj.

Definition at line 235 of file dict.h.

References newlang::Dict< T, PTR >::at_index_const(), and newlang::Dict< T, PTR >::index().

Referenced by newlang::Obj::erase(), and newlang::Obj::erase().

◆ erase() [2/2]

template<typename T , typename PTR = std::shared_ptr<T>>
virtual void newlang::Dict< T, PTR >::erase ( const size_t index_from,
const size_t index_to )
inlinevirtual

Reimplemented in newlang::Obj.

Definition at line 239 of file dict.h.

References ASSERT, and newlang::Dict< T, PTR >::at_index().

Friends And Related Symbol Documentation

◆ Context

template<typename T , typename PTR = std::shared_ptr<T>>
friend class Context
friend

Definition at line 80 of file dict.h.


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