NCBI C++ ToolKit
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
CCgiUserAgent Class Reference

Search Toolkit Book for CCgiUserAgent

CCgiUserAgent --. More...

#include <cgi/user_agent.hpp>

+ Collaboration diagram for CCgiUserAgent:

List of all members.

Public Types

enum  EFlags { fNoCase = (1 << 1), fUseBotPatterns = (1 << 2), fUseDevicePatterns = (1 << 3) }
 Comparison and parsing flags. More...
enum  EBrowser {
  eUnknown = 0, eIE, eEdge, eiCab,
  eLynx, eNetscape, eOpera, eOregano,
  eW3m, eNagios, eBeonex, eCamino,
  eChimera, eFirefox, eFlock, eIceCat,
  eIceweasel, eGaleon, eGranParadiso, eKazehakase,
  eKMeleon, eKNinja, eMadfox, eMultiZilla,
  eSeaMonkey, eAcooBrowser, eAOL, eAvantBrowser,
  eCrazyBrowser, eEnigmaBrowser, eIRider, eMaxthon,
  eNetCaptor, eChrome, eFluid, eKonqueror,
  eMidori, eNetNewsWire, eOmniWeb, eQtWeb,
  eSafari, eShiira, eStainless, eCrawler,
  eOfflineBrowser, eScript, eLinkChecker, eWebValidator,
  eAirEdge, eAvantGo, eBlackberry, eDoCoMo,
  eEudoraWeb, eMinimo, eNetFront, eOperaMini,
  eOperaMobile, eOpenWave, ePIE, ePlucker,
  ePocketLink, ePolaris, eReqwireless, eSafariMobile,
  eSEMCBrowser, eTelecaObigo, euZardWeb, eVodafone,
  eXiino, eMozilla, eMozillaCompatible
}
 Browser types. More...
enum  EBrowserEngine {
  eEngine_Unknown = eUnknown, eEngine_IE = eIE, eEngine_Edge = eEdge, eEngine_Gecko = eMozilla,
  eEngine_KHTML = eKonqueror, eEngine_WebKit = eSafari, eEngine_Blink = eChrome, eEngine_Bot = eCrawler
}
 Browser engine types. More...
enum  EBrowserPlatform {
  ePlatform_Unknown = eUnknown, ePlatform_Windows, ePlatform_Mac, ePlatform_Unix,
  ePlatform_Android, ePlatform_Palm, ePlatform_Symbian, ePlatform_WindowsCE,
  ePlatform_MobileDevice
}
 Platform types. More...
enum  EBotFlags {
  fBotCrawler = (1<<1), fBotOfflineBrowser = (1<<2), fBotScript = (1<<3), fBotLinkChecker = (1<<4),
  fBotWebValidator = (1<<5), fBotAll = 0xFF
}
 Bots check flags (what consider to be a bot). More...
enum  EDeviceFlags { fDevice_Phone = (1<<1), fDevice_Tablet = (1<<2), fDevice_Mobile = fDevice_Phone | fDevice_Tablet }
 Flags to check device type. More...
typedef unsigned int TFlags
 Binary OR of "EFlags".
typedef unsigned int TBotFlags
 Binary OR of "EBotFlags".
typedef unsigned int TDeviceFlags
 Binary OR of "EDeviceFlags".

Public Member Functions

 CCgiUserAgent (TFlags flags=0)
 Default constructor.
 CCgiUserAgent (const string &user_agent, TFlags flags=0)
 Constructor.
void Reset (const string &user_agent)
 Parse new user agent string.
string GetUserAgentStr (void) const
 Get user agent string.
EBrowser GetBrowser (void) const
 Get browser type.
const stringGetBrowserName (void) const
 Get browser name.
EBrowserEngine GetEngine (void) const
 Get browser engine type and name.
string GetEngineName (void) const
EBrowserPlatform GetPlatform (void) const
 Get platform (OS) type and name.
string GetPlatformName (void) const
const TUserAgentVersionGetBrowserVersion (void) const
 Get browser version information.
const TUserAgentVersionGetEngineVersion (void) const
const TUserAgentVersionGetMozillaVersion (void) const
bool IsBrowser (void) const
 Check that this is known browser.
bool IsBot (TBotFlags flags=fBotAll, const string &include_patterns=kEmptyStr, const string &exclude_patterns=kEmptyStr) const
 Check that this is known search robot/bot.
TDeviceFlags GetDeviceType (void) const
 Get device type.
bool IsPhoneDevice (const string &include_patterns=kEmptyStr, const string &exclude_patterns=kEmptyStr) const
 Check that this is a known phone-size device.
bool IsTabletDevice (const string &include_patterns=kEmptyStr, const string &exclude_patterns=kEmptyStr) const
 Check that this is a known tablet device.
bool IsMobileDevice (const string &include_patterns=kEmptyStr, const string &exclude_patterns=kEmptyStr) const
 Check that this is a known mobile device.

Protected Member Functions

void x_Init (void)
 Init class members.
void x_Parse (const string &user_agent)
 Parse user agent string.
bool x_ParseToken (const string &token, int where)
 Parse token with browser name and version.
bool x_CheckPattern (int what, bool current_status, bool use_patterns, const string &include_patterns=kEmptyStr, const string &exclude_patterns=kEmptyStr) const
 Helper method to check UA-string against external pattern lists.

Protected Attributes

string m_UserAgent
 User-Agent string.
TFlags m_Flags
 Comparison and parsing flags.
EBrowser m_Browser
 Browser type.
string m_BrowserName
 Browser name.
TUserAgentVersion m_BrowserVersion
 Browser version info.
EBrowserEngine m_Engine
 Browser engine type.
TUserAgentVersion m_EngineVersion
 Browser engine version.
TUserAgentVersion m_MozillaVersion
 Browser mozilla version.
EBrowserPlatform m_Platform
 Platform type.
TDeviceFlags m_DeviceFlags
 Device type flags.

Detailed Description

CCgiUserAgent --.

Define class to parse user agent strings. Basically, support only Mozilla 'compatible' format.

Definition at line 58 of file user_agent.hpp.


The documentation for this class was generated from the following files:
Modified on Wed May 06 12:02:17 2015 by modify_doxy.py rev. 426318