cesium-native 0.46.0
Loading...
Searching...
No Matches
CesiumITwinClient::PagedList< T > Class Template Reference

Allows access to a set of resources from a paginated list. More...

#include <CesiumITwinClient/PagedList.h>

Public Types

using PageOperation
 Callback used to obtain a page of results from a URL.
 

Public Member Functions

 PagedList (rapidjson::Document &doc, std::vector< T > &&items, PageOperation &&operation)
 Creates a new PagedList from a set of items, an iTwin API response, and a callback to retrieve more items.
 
T & operator[] (size_t index)
 Returns the contained item at index.
 
const T & operator[] (size_t index) const
 Returns the contained item at index.
 
size_t size () const
 Returns the number of contained items.
 
auto begin ()
 The begin iterator of the underlying vector.
 
auto begin () const
 The begin iterator of the underlying vector.
 
auto end ()
 The end iterator of the underlying vector.
 
auto end () const
 The end iterator of the underlying vector.
 
CesiumAsync::Future< CesiumUtility::Result< PagedList< T > > > next (CesiumAsync::AsyncSystem &asyncSystem, Connection &connection) const
 Returns a future that will return the next page of items.
 
CesiumAsync::Future< CesiumUtility::Result< PagedList< T > > > prev (CesiumAsync::AsyncSystem &asyncSystem, Connection &connection) const
 Returns a future that will return the previous page of items.
 

Detailed Description

template<typename T>
class CesiumITwinClient::PagedList< T >

Allows access to a set of resources from a paginated list.

Many endpoints in the iTwin API return links to the previous and next pages, if any, in their results. This class allows these links to be easily traversed.

Definition at line 26 of file PagedList.h.

Member Typedef Documentation

◆ PageOperation

template<typename T >
using CesiumITwinClient::PagedList< T >::PageOperation
Initial value:
std::function<CesiumAsync::Future<
CesiumUtility::Result<PagedList<T>>>(Connection&, const std::string&)>
A value that will be available in the future, as produced by AsyncSystem.
Definition Promise.h:12
Holds the result of an operation. If the operation succeeds, it will provide a value....
Definition Result.h:16

Callback used to obtain a page of results from a URL.

Definition at line 31 of file PagedList.h.

Constructor & Destructor Documentation

◆ PagedList()

template<typename T >
CesiumITwinClient::PagedList< T >::PagedList ( rapidjson::Document & doc,
std::vector< T > && items,
PageOperation && operation )
inline

Creates a new PagedList from a set of items, an iTwin API response, and a callback to retrieve more items.

Parameters
docThe JSON document obtained from the iTwin API.
itemsThe parsed items that should be returned to the user.
operationCallback that can obtain a new page of results from a given URL.

Definition at line 43 of file PagedList.h.

Member Function Documentation

◆ begin() [1/2]

template<typename T >
auto CesiumITwinClient::PagedList< T >::begin ( )
inline

The begin iterator of the underlying vector.

Definition at line 94 of file PagedList.h.

◆ begin() [2/2]

template<typename T >
auto CesiumITwinClient::PagedList< T >::begin ( ) const
inline

The begin iterator of the underlying vector.

Definition at line 98 of file PagedList.h.

◆ end() [1/2]

template<typename T >
auto CesiumITwinClient::PagedList< T >::end ( )
inline

The end iterator of the underlying vector.

Definition at line 103 of file PagedList.h.

◆ end() [2/2]

template<typename T >
auto CesiumITwinClient::PagedList< T >::end ( ) const
inline

The end iterator of the underlying vector.

Definition at line 107 of file PagedList.h.

◆ next()

template<typename T >
CesiumAsync::Future< CesiumUtility::Result< PagedList< T > > > CesiumITwinClient::PagedList< T >::next ( CesiumAsync::AsyncSystem & asyncSystem,
Connection & connection ) const
inline

Returns a future that will return the next page of items.

Parameters
asyncSystemThe AsyncSystem to use.
connectionThe Connection to use to fetch the next page of results.

Definition at line 117 of file PagedList.h.

◆ operator[]() [1/2]

template<typename T >
T & CesiumITwinClient::PagedList< T >::operator[] ( size_t index)
inline

Returns the contained item at index.

Definition at line 79 of file PagedList.h.

◆ operator[]() [2/2]

template<typename T >
const T & CesiumITwinClient::PagedList< T >::operator[] ( size_t index) const
inline

Returns the contained item at index.

Definition at line 84 of file PagedList.h.

◆ prev()

template<typename T >
CesiumAsync::Future< CesiumUtility::Result< PagedList< T > > > CesiumITwinClient::PagedList< T >::prev ( CesiumAsync::AsyncSystem & asyncSystem,
Connection & connection ) const
inline

Returns a future that will return the previous page of items.

Parameters
asyncSystemThe AsyncSystem to use.
connectionThe Connection to use to fetch the previous page of results.

Definition at line 134 of file PagedList.h.

◆ size()

template<typename T >
size_t CesiumITwinClient::PagedList< T >::size ( ) const
inline

Returns the number of contained items.

Definition at line 89 of file PagedList.h.


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