Google APIs Client Library for C++
ServiceRequestPager< REQUEST, DATA > Class Template Reference

A pager over referenced REST APIs having a standard paging interface. More...

#include "client/service/service_request_pager.h"

+ Inheritance diagram for ServiceRequestPager< REQUEST, DATA >:

List of all members.

Public Member Functions

 ServiceRequestPager (REQUEST *request, DATA *page_data_storage)
 Standard constructor.
virtual ~ServiceRequestPager ()
 Standard destructor.
DATA * data ()
 Returns the current page data.
REQUEST * request ()
 Returns the current page request.
virtual util::Status ExecuteNextPage ()
 Fetches the next page, if any.

Detailed Description

template<class REQUEST, class DATA>
class googleapis::client::ServiceRequestPager< REQUEST, DATA >

A pager over referenced REST APIs having a standard paging interface.

This template relies on the existence of REQUEST.set_page_token and RESPONSE.get_next_page_token methods to control the page iteration.

This class does not own the request or data objects. See the EncapsulatedServiceRequestPager as a variant that adds memory management.

Template Parameters:
REQUESTmust be a subclass of ClientServiceRequest and have a set_page_token method.
DATAmust be a subclass of SerializableJson and have a get_next_page_token method.

Constructor & Destructor Documentation

ServiceRequestPager ( REQUEST *  request,
DATA *  page_data_storage 
) [inline]

Standard constructor.

Parameters:
[in]requestThe prototype request used to fetch pages. The caller retains ownershp.
[in]page_data_storageHolds the underlying response data returned for the last requested page. The claeer retains ownership.
virtual ~ServiceRequestPager ( ) [inline, virtual]

Standard destructor.


Member Function Documentation

DATA* data ( ) [inline]

Returns the current page data.

Returns:
Ownership is retained by this instance as far at the caller is concerned.
virtual util::Status ExecuteNextPage ( ) [inline, virtual]

Fetches the next page, if any.

To distinguish the difference between a failure and no more pages, check the http_response()->http_status().

Returns:
false on failure or when there are no more pages.

This method is called by the base class which guards with is_done so we dont need to check here. But we'll do so anyway just to be sure it didnt get here through some other route.

Implements BaseServiceRequestPager.

REQUEST* request ( ) [inline]

Returns the current page request.

Returns:
Ownership is retained by this instance as far at the caller is concerned.

Reimplemented from BaseServiceRequestPager.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines