WD
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
webdriver::RouteTable Class Reference

#include <webdriver_route_table.h>

Inheritance diagram for webdriver::RouteTable:

Public Member Functions

 RouteTable ()
 
 RouteTable (const RouteTable &obj)
 
RouteTableoperator= (const RouteTable &obj)
 
virtual ~RouteTable ()
 
template<typename CommandType >
bool Add (const std::string &pattern)
 
void Remove (const std::string &pattern)
 
void Clear ()
 
bool HasRoute (const std::string &pattern)
 
CommandCreatorPtr GetRouteForURL (const std::string &url, std::string *pattern=NULL) const
 
std::vector< std::string > GetRoutes ()
 

Detailed Description

Container for routes. Each route is a pair - url pattern and command creator. url pattern is string. Some path segments in this url pattern can be wildcarded with single '*'. In example - "/session/*/log"

Constructor & Destructor Documentation

webdriver::RouteTable::RouteTable ( )
explicit

Creates a new RouteTable that will register all URL commands with the given context.

webdriver::RouteTable::RouteTable ( const RouteTable obj)

Copy constructor.

virtual webdriver::RouteTable::~RouteTable ( )
virtual

Member Function Documentation

template<typename CommandType >
bool webdriver::RouteTable::Add ( const std::string &  pattern)

Registers a command for a WebDriver command using the given URL pattern.

Template Parameters
<CommandType>class of command to handle this route. Must be subtype of webdriver::Command
Parameters
patternurl pattern of route to add
Returns
true, if added successfully, false - otherwise.
void webdriver::RouteTable::Clear ( )

Removes all routes.

CommandCreatorPtr webdriver::RouteTable::GetRouteForURL ( const std::string &  url,
std::string *  pattern = NULL 
) const

Find matched route for given url and retrieve CommandCreator for this route.

Parameters
urlurl to handle
[out]patternoptional output - matched pattern for url
Returns
pointer to CommandCreator, NULL if route not found
std::vector<std::string> webdriver::RouteTable::GetRoutes ( )

Returns list of registered routes

Returns
vector of registered patterns
bool webdriver::RouteTable::HasRoute ( const std::string &  pattern)

Checks if route is already registered

Parameters
patternurl pattern of route to check
RouteTable& webdriver::RouteTable::operator= ( const RouteTable obj)

assignment operator

void webdriver::RouteTable::Remove ( const std::string &  pattern)

Removes a command for pattern registered previously.

Parameters
patternurl pattern of route to remove

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