Google APIs Client Library for C++
BaseServiceRequestPager Class Reference

Base class for component that pages through REST results. More...

#include "client/service/service_request_pager.h"

+ Inheritance diagram for BaseServiceRequestPager:

List of all members.

Public Member Functions

 BaseServiceRequestPager (ClientServiceRequest *request)
 Standard constructor.
virtual ~BaseServiceRequestPager ()
 Standard destructor.
ClientServiceRequestrequest ()
 Returns the current page request.
HttpResponsehttp_response ()
 Returns the current page response.
bool is_done () const
 Determine if this was the last known page.
bool NextPage ()
 Fetch the next page.
void Reset ()
 Resets the pager back to the start.

Protected Member Functions

virtual util::Status ExecuteNextPage ()=0
 Does the actual messaging to the service to get the next page.
const string & next_page_token () const
 Returns the token parameter to use when fetching the next page.
void set_next_page_token (int64 token)
 Sets the [scalar] request token identifying the next desired page.
void set_next_page_token (const StringPiece &token)
 Sets the [string] request token identifying the next desired page.

Detailed Description

Base class for component that pages through REST results.

This class is abstract requiring ExecuteNextPage to be implemented to instruct the pager how to specify (and determine) the next page.

Normally the concrete ServiceRequestPager is used.


Constructor & Destructor Documentation

BaseServiceRequestPager ( ClientServiceRequest request) [explicit]

Standard constructor.

Parameters:
[in]requestA reference to a prototype request used to fetch the next page. Ownership is retained by the caller.
virtual ~BaseServiceRequestPager ( ) [virtual]

Standard destructor.


Member Function Documentation

virtual util::Status ExecuteNextPage ( ) [protected, pure virtual]

Does the actual messaging to the service to get the next page.

Returns:
ok or reason for failure.

Implemented in ServiceRequestPager< REQUEST, DATA >.

HttpResponse* http_response ( ) [inline]

Returns the current page response.

Returns:
Ownership is retained by this instance.
bool is_done ( ) const [inline]

Determine if this was the last known page.

Returns:
true if we are done, false if not. We might still be done even if false is returned if the end was on a page boundary.
const string& next_page_token ( ) const [inline, protected]

Returns the token parameter to use when fetching the next page.

bool NextPage ( )

Fetch the next page.

Returns:
true if we could fetch another page, false if we are done.

Returns the current page request.

Returns:
Ownership is retained by this instance.

Reimplemented in ServiceRequestPager< REQUEST, DATA >.

void Reset ( )

Resets the pager back to the start.

The next iteration may be different than the previous one depending on the backend service.

void set_next_page_token ( int64  token) [inline, protected]

Sets the [scalar] request token identifying the next desired page.

This is for service APIs that use scalar token values.

Parameters:
[in]tokenSpecifies the desired page.
See also:
Reset
void set_next_page_token ( const StringPiece &  token) [inline, protected]

Sets the [string] request token identifying the next desired page.

This is for service APIs that use string token values.

Parameters:
[in]tokenSpecifies the desired page.
See also:
Reset

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