Google APIs Client Library for C++
|
Abstract interface for creating concrete HttpTransport instances. More...
#include "client/transport/http_transport.h"
Public Member Functions | |
HttpTransportFactory () | |
Default constructor creates instances with the default configuration default HttpTransportOptions . | |
HttpTransportFactory (const HttpTransportLayerConfig *config) | |
Standard constructor. | |
virtual | ~HttpTransportFactory () |
Standard destructor. | |
HttpTransport * | NewWithOptions (const HttpTransportOptions &options) |
Construct a new transport instance with the provided options. | |
HttpTransport * | New () |
Construct a new instance using the default transport options given to this factory instance. | |
HttpRequestOptions * | mutable_request_options () |
Get the modifiable default request options given the transport instances created by this factory. | |
const HttpRequestOptions & | default_request_options () const |
Returns the default request options assigned by this factory instance. | |
const string & | default_id () const |
Returns the default id to assign new transport instances created. | |
void | set_default_id (const StringPiece &id) |
Change the default transport identifier for new instances. | |
void | reset_scribe (HttpScribe *scribe) |
Sets the scribe to bind to instances. | |
HttpScribe * | scribe () |
Returns the scribe, if any. | |
const HttpTransportLayerConfig * | config () |
Returns the configuration that this factory was constructed with. | |
Protected Member Functions | |
virtual HttpTransport * | DoAlloc (const HttpTransportOptions &options)=0 |
Specialized factories override this method to create new instances. |
Abstract interface for creating concrete HttpTransport instances.
This class implements a Factory pattern for instantiating new HttpTransport instances. It acts as the base class for all HttpTransport factories used by the Google APIs Client Library for C++ runtime library.
It is recommended that you always use this class when defining classes and interfaces rather than the concrete subclasses. If you need a factory but do not care about the implementation, consider HttpTransport::default_transport_factory().
Current HttpTransport::default_transport_factory must be explicit set at some point during execution (such as application startup).
Default constructor creates instances with the default configuration default HttpTransportOptions
.
This method still calls DoAlloc with the default options.
HttpTransportFactory | ( | const HttpTransportLayerConfig * | config | ) | [explicit] |
Standard constructor.
Caller maintains ownership of the configuration, which can be shared across mutliple factory instances.
[in] | config | If NULL then this behaves similar to the default constructor. If non-null the caller retains ownership. |
virtual ~HttpTransportFactory | ( | ) | [virtual] |
Standard destructor.
const HttpTransportLayerConfig* config | ( | ) | [inline] |
Returns the configuration that this factory was constructed with.
const string& default_id | ( | ) | const [inline] |
Returns the default id to assign new transport instances created.
const HttpRequestOptions& default_request_options | ( | ) | const [inline] |
Returns the default request options assigned by this factory instance.
virtual HttpTransport* DoAlloc | ( | const HttpTransportOptions & | options | ) | [protected, pure virtual] |
Specialized factories override this method to create new instances.
The base class will add the scribe and other factory configurations.
Implemented in JsonPlaybackTransportFactory, and CurlHttpTransportFactory.
HttpRequestOptions* mutable_request_options | ( | ) | [inline] |
Get the modifiable default request options given the transport instances created by this factory.
Changing these options will affect future transport instances created but will not affect exsting transport or request instances.
HttpTransport* New | ( | ) | [inline] |
Construct a new instance using the default transport options given to this factory instance.
HttpTransport* NewWithOptions | ( | const HttpTransportOptions & | options | ) |
Construct a new transport instance with the provided options.
void reset_scribe | ( | HttpScribe * | scribe | ) |
Sets the scribe to bind to instances.
If this is non-NULL then it must remain valid until any transports created with this factory are finished. Since the factory will own the scribe, that means the factory cannot be destroyed either until all transports created from this are no longer in used.
[in] | scribe | Ownership is passed. NULL will clear. |
HttpScribe* scribe | ( | ) | [inline] |
Returns the scribe, if any.
void set_default_id | ( | const StringPiece & | id | ) | [inline] |
Change the default transport identifier for new instances.
[in] | id | The initial identifier to use for new instances is typically the name of the transport implementation. |