Design Pattern Examples
Overview of object-oriented design patterns
IteratorContainer_Class Class Reference

Represents a container that offers up two kinds of iterators for the hardcoded contents, ItemPair and std::string. More...

#include <Iterator_Class.h>

Collaboration diagram for IteratorContainer_Class:
Collaboration graph

Public Member Functions

std::shared_ptr< IIterator< ItemPair > > GetItems ()
 Retrieve an iterator over the data that returns an ItemPair object containing both key and value for each entry.
 
std::shared_ptr< IIterator< std::string > > GetKeys ()
 Retrieve an iterator over the "key" part of the data, where the data returned from the iterator is a string type.
 
std::shared_ptr< IIterator< std::string > > GetValues ()
 Retrieve an iterator over the "value" part of the data, where the data returned from the iterator is a string type.
 

Detailed Description

Represents a container that offers up two kinds of iterators for the hardcoded contents, ItemPair and std::string.

This container is not a dictionary despite the use of keys and values but it was the simplest form of data I could come up with that didn't use any of the C++ containers.

Definition at line 197 of file Iterator_Class.h.

Member Function Documentation

◆ GetItems()

std::shared_ptr< IIterator< ItemPair > > GetItems ( )

Retrieve an iterator over the data that returns an ItemPair object containing both key and value for each entry.

Returns
An IIterator object for getting ItemPair objects.

Definition at line 23 of file Iterator_Class.cpp.

References _countof, _keys, and _values.

Referenced by DesignPatternExamples_cpp::Iterator_Exercise().

◆ GetKeys()

std::shared_ptr< IIterator< std::string > > GetKeys ( )

Retrieve an iterator over the "key" part of the data, where the data returned from the iterator is a string type.

Returns
An IIterator object for getting strings.

Definition at line 37 of file Iterator_Class.cpp.

References _countof, and _keys.

Referenced by DesignPatternExamples_cpp::Iterator_Exercise().

◆ GetValues()

std::shared_ptr< IIterator< std::string > > GetValues ( )

Retrieve an iterator over the "value" part of the data, where the data returned from the iterator is a string type.

Returns
An IIterator object for getting strings.

Definition at line 43 of file Iterator_Class.cpp.

References _countof, and _values.

Referenced by DesignPatternExamples_cpp::Iterator_Exercise().


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