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

#include <object.h>

Inheritance diagram for newlang::Iterator< T >:

Public Types

enum class  IterCmp : int8_t { No = static_cast<int8_t> (ObjType::None) , Yes = static_cast<int8_t> (ObjType::Iterator) , End = static_cast<int8_t> (ObjType::IteratorEnd) }
 
typedef Iterator< T > iterator
 
typedef Iterator< const T > const_iterator
 
typedef Dict< T > IterObj
 
typedef Dict< T >::Type IterObjPtr
 
typedef Dict< T >::PairType IterPairType
 
typedef Dict< T >::ListType IterListType
 
typedef IterCmp CompareFuncType(const IterPairType &pair, const T *args, void *extra)
 

Public Member Functions

 Iterator (std::shared_ptr< T > obj, const char *find_key="(.|\\n)*")
 
 Iterator (std::shared_ptr< T > obj, CompareFuncType *func, T *arg, void *extra=nullptr)
 
 Iterator (const Iterator &iter)
 
iterator begin ()
 
iterator end ()
 
const IterPairTypedata ()
 
const IterPairTypeoperator* ()
 
const IterPairTypedata () const
 
const IterPairTypeoperator* () const
 
ObjPtr read_and_next (int64_t count)
 
const iteratoroperator++ () const
 
const iterator operator++ (int) const
 
bool operator== (const iterator &other) const
 
bool operator!= (const iterator &other) const
 
void reset ()
 

Protected Member Functions

void search_loop () const
 

Static Private Member Functions

static IterCmp CompareFuncDefault (const IterPairType &pair, const T *filter, void *extra)
 

Private Attributes

std::shared_ptr< T > m_iter_obj
 
std::regex m_match
 
std::string m_filter
 
CompareFuncTypem_func
 
T * m_func_args
 
void * m_func_extra
 
Dict< T >::iterator m_found
 
const char * m_base_filter
 

Static Private Attributes

static const IterPairType m_Iterator_end
 

Friends

class Obj
 
class Dict< Obj >
 
class Context
 
class Dict< Context, std::weak_ptr< Context > >
 

Detailed Description

template<typename T>
class newlang::Iterator< T >

Definition at line 161 of file object.h.

Member Typedef Documentation

◆ iterator

template<typename T >
typedef Iterator<T> newlang::Iterator< T >::iterator

Definition at line 178 of file object.h.

◆ const_iterator

template<typename T >
typedef Iterator<const T> newlang::Iterator< T >::const_iterator

Definition at line 179 of file object.h.

◆ IterObj

template<typename T >
typedef Dict<T> newlang::Iterator< T >::IterObj

Definition at line 181 of file object.h.

◆ IterObjPtr

template<typename T >
typedef Dict<T>::Type newlang::Iterator< T >::IterObjPtr

Definition at line 182 of file object.h.

◆ IterPairType

template<typename T >
typedef Dict<T>::PairType newlang::Iterator< T >::IterPairType

Definition at line 183 of file object.h.

◆ IterListType

template<typename T >
typedef Dict<T>::ListType newlang::Iterator< T >::IterListType

Definition at line 184 of file object.h.

◆ CompareFuncType

template<typename T >
typedef IterCmp newlang::Iterator< T >::CompareFuncType(const IterPairType &pair, const T *args, void *extra)

Definition at line 187 of file object.h.

Member Enumeration Documentation

◆ IterCmp

template<typename T >
enum class newlang::Iterator::IterCmp : int8_t
strong
Enumerator
No 
Yes 
End 

Definition at line 169 of file object.h.

Constructor & Destructor Documentation

◆ Iterator() [1/3]

template<typename T >
newlang::Iterator< T >::Iterator ( std::shared_ptr< T > obj,
const char * find_key = "(.|\\n)*" )
inlineexplicit

Итератор для элементов списка с regex фильтром по имени элемента (по умолчанию для всех элементов списка)

Parameters
obj
find_key

Definition at line 196 of file object.h.

◆ Iterator() [2/3]

template<typename T >
newlang::Iterator< T >::Iterator ( std::shared_ptr< T > obj,
CompareFuncType * func,
T * arg,
void * extra = nullptr )
inline

Итератор для элементов списка с фильтром в виде функции обратного вызова

Parameters
obj
func
arg
extra

Definition at line 207 of file object.h.

References newlang::Iterator< T >::search_loop().

◆ Iterator() [3/3]

template<typename T >
newlang::Iterator< T >::Iterator ( const Iterator< T > & iter)
inline

Definition at line 212 of file object.h.

Member Function Documentation

◆ CompareFuncDefault()

template<typename T >
static IterCmp newlang::Iterator< T >::CompareFuncDefault ( const IterPairType & pair,
const T * filter,
void * extra )
inlinestaticprivate

◆ begin()

template<typename T >
iterator newlang::Iterator< T >::begin ( )
inline

Definition at line 261 of file object.h.

References newlang::Iterator< T >::reset().

Referenced by newlang::Iterator< T >::reset().

◆ end()

◆ data() [1/2]

◆ operator*() [1/2]

template<typename T >
const IterPairType & newlang::Iterator< T >::operator* ( )
inline

Definition at line 280 of file object.h.

References newlang::Iterator< T >::data().

◆ data() [2/2]

◆ operator*() [2/2]

template<typename T >
const IterPairType & newlang::Iterator< T >::operator* ( ) const
inline

Definition at line 291 of file object.h.

References newlang::Iterator< T >::data().

◆ read_and_next()

template<typename T >
ObjPtr newlang::Iterator< T >::read_and_next ( int64_t count)

◆ operator++() [1/2]

template<typename T >
const iterator & newlang::Iterator< T >::operator++ ( ) const
inline

◆ operator++() [2/2]

template<typename T >
const iterator newlang::Iterator< T >::operator++ ( int ) const
inline

Definition at line 305 of file object.h.

References newlang::Iterator< T >::operator++().

◆ operator==()

template<typename T >
bool newlang::Iterator< T >::operator== ( const iterator & other) const
inline

Definition at line 309 of file object.h.

References newlang::Iterator< T >::m_found.

◆ operator!=()

template<typename T >
bool newlang::Iterator< T >::operator!= ( const iterator & other) const
inline

Definition at line 313 of file object.h.

References newlang::Iterator< T >::m_found.

◆ reset()

◆ search_loop()

Friends And Related Symbol Documentation

◆ Obj

template<typename T >
friend class Obj
friend

Definition at line 164 of file object.h.

◆ Dict< Obj >

template<typename T >
friend class Dict< Obj >
friend

Definition at line 164 of file object.h.

◆ Context

template<typename T >
friend class Context
friend

Definition at line 166 of file object.h.

◆ Dict< Context, std::weak_ptr< Context > >

template<typename T >
friend class Dict< Context, std::weak_ptr< Context > >
friend

Definition at line 166 of file object.h.

Member Data Documentation

◆ m_iter_obj

◆ m_match

template<typename T >
std::regex newlang::Iterator< T >::m_match
private

Definition at line 218 of file object.h.

Referenced by newlang::Iterator< T >::CompareFuncDefault().

◆ m_filter

template<typename T >
std::string newlang::Iterator< T >::m_filter
private

Definition at line 219 of file object.h.

Referenced by newlang::Iterator< T >::CompareFuncDefault().

◆ m_func

template<typename T >
CompareFuncType* newlang::Iterator< T >::m_func
private

Definition at line 220 of file object.h.

Referenced by newlang::Iterator< T >::search_loop().

◆ m_func_args

template<typename T >
T* newlang::Iterator< T >::m_func_args
private

◆ m_func_extra

template<typename T >
void* newlang::Iterator< T >::m_func_extra
private

Definition at line 222 of file object.h.

Referenced by newlang::Iterator< T >::search_loop().

◆ m_found

◆ m_base_filter

template<typename T >
const char* newlang::Iterator< T >::m_base_filter
private

Definition at line 224 of file object.h.

Referenced by newlang::Iterator< T >::CompareFuncDefault().

◆ m_Iterator_end

template<typename T >
const IterPairType newlang::Iterator< T >::m_Iterator_end
staticprivate

Definition at line 226 of file object.h.

Referenced by newlang::Iterator< T >::data(), and newlang::Iterator< T >::data().


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