AJA NTV2 SDK  18.0.0.2122
NTV2 SDK 18.0.0.2122
NTV2DeviceSpecParser Class Reference

One-stop shop for parsing device specifications. (New in SDK 16.3) I do very little in the way of validating semantics. I simply do the parsing & provide the info needed to load & operate plugins. More...

#include <ntv2nubaccess.h>

Public Member Functions

 NTV2DeviceSpecParser (const std::string inSpec="")
 My constructor. If given device specification is non-empty, proceeds to Parse it. More...
 
void Reset (const std::string inSpec="")
 Resets me, then parses the given device specification. More...
 
const std::string & DeviceSpec (void) const
 
std::string MakeDeviceSpec (const bool urlEncodeQuery) const
 
std::string MakeQueryString (const bool urlEncode) const
 
bool HasDeviceSpec (void) const
 
bool Successful (void) const
 
bool Failed (void) const
 
bool HasScheme (void) const
 
std::string Scheme (void) const
 
bool IsLocalDevice (void) const
 
size_t ErrorCount (void) const
 
bool HasErrors (void) const
 
std::string Error (const size_t inIndex=0) const
 
NTV2StringList Errors (void) const
 
NTV2ConnectParams Results (void) const
 
bool HasResult (const std::string &inKey) const
 
std::string Result (const std::string &inKey) const
 
std::string Resource (const bool inStripLeadSlash=true) const
 
std::ostream & PrintErrors (std::ostream &oss) const
 
std::ostream & Print (std::ostream &oss, const bool inDumpResults=false) const
 
std::string InfoString (void) const
 
std::string DeviceSerial (void) const
 
std::string DeviceModel (void) const
 
NTV2DeviceID DeviceID (void) const
 
UWord DeviceIndex (void) const
 
const NTV2DictionaryQueryParams (void) const
 
std::string QueryParam (const std::string &inKey) const
 
bool HasQueryParams (void) const
 

Static Public Member Functions

static bool ParseQueryParams (const NTV2Dictionary &inSrcDict, NTV2Dictionary &outQueryParams)
 Parses the string found in the given source dictionary's 'query' key (kConnectParamQuery), storing the key/value pairs of all parsed query parameters into "outQueryParams". Query parameter values are URL-decoded before storing in the "outQueryParams" dictionary. More...
 

Detailed Description

One-stop shop for parsing device specifications. (New in SDK 16.3) I do very little in the way of validating semantics. I simply do the parsing & provide the info needed to load & operate plugins.

Note
Not thread-safe.

Definition at line 168 of file ntv2nubaccess.h.

Constructor & Destructor Documentation

◆ NTV2DeviceSpecParser()

NTV2DeviceSpecParser::NTV2DeviceSpecParser ( const std::string  inSpec = "")

My constructor. If given device specification is non-empty, proceeds to Parse it.

Definition at line 281 of file ntv2nubaccess.cpp.

Member Function Documentation

◆ DeviceID()

NTV2DeviceID NTV2DeviceSpecParser::DeviceID ( void  ) const

Definition at line 574 of file ntv2nubaccess.cpp.

◆ DeviceIndex()

UWord NTV2DeviceSpecParser::DeviceIndex ( void  ) const

Definition at line 583 of file ntv2nubaccess.cpp.

◆ DeviceModel()

std::string NTV2DeviceSpecParser::DeviceModel ( void  ) const
inline

Definition at line 194 of file ntv2nubaccess.h.

◆ DeviceSerial()

std::string NTV2DeviceSpecParser::DeviceSerial ( void  ) const
inline

Definition at line 193 of file ntv2nubaccess.h.

◆ DeviceSpec()

const std::string& NTV2DeviceSpecParser::DeviceSpec ( void  ) const
inline
Returns
the original devSpec I parsed

Definition at line 173 of file ntv2nubaccess.h.

◆ Error()

std::string NTV2DeviceSpecParser::Error ( const size_t  inIndex = 0) const
inline
Returns
The Nth error found by parser

Definition at line 184 of file ntv2nubaccess.h.

◆ ErrorCount()

size_t NTV2DeviceSpecParser::ErrorCount ( void  ) const
inline
Returns
Number of errors found by parser

Definition at line 182 of file ntv2nubaccess.h.

◆ Errors()

NTV2StringList NTV2DeviceSpecParser::Errors ( void  ) const
inline
Returns
All errors found by parser

Definition at line 185 of file ntv2nubaccess.h.

◆ Failed()

bool NTV2DeviceSpecParser::Failed ( void  ) const
inline
Returns
True if empty device spec or parser had errors

Definition at line 178 of file ntv2nubaccess.h.

◆ HasDeviceSpec()

bool NTV2DeviceSpecParser::HasDeviceSpec ( void  ) const
inline
Returns
True if I have a device specification

Definition at line 176 of file ntv2nubaccess.h.

◆ HasErrors()

bool NTV2DeviceSpecParser::HasErrors ( void  ) const
inline
Returns
True if ErrorCount is non-zero

Definition at line 183 of file ntv2nubaccess.h.

◆ HasQueryParams()

bool NTV2DeviceSpecParser::HasQueryParams ( void  ) const
inline
Returns
true if has any query params

Definition at line 199 of file ntv2nubaccess.h.

◆ HasResult()

bool NTV2DeviceSpecParser::HasResult ( const std::string &  inKey) const
inline
Returns
True if the given result exists.

Definition at line 187 of file ntv2nubaccess.h.

◆ HasScheme()

bool NTV2DeviceSpecParser::HasScheme ( void  ) const
inline
Returns
True if parser results contain a scheme

Definition at line 179 of file ntv2nubaccess.h.

◆ InfoString()

string NTV2DeviceSpecParser::InfoString ( void  ) const

Definition at line 567 of file ntv2nubaccess.cpp.

◆ IsLocalDevice()

bool NTV2DeviceSpecParser::IsLocalDevice ( void  ) const
inline
Returns
True if parser results indicate a local device

Definition at line 181 of file ntv2nubaccess.h.

◆ MakeDeviceSpec()

string NTV2DeviceSpecParser::MakeDeviceSpec ( const bool  urlEncodeQuery) const
Returns
reconstituted device spec

Definition at line 511 of file ntv2nubaccess.cpp.

◆ MakeQueryString()

string NTV2DeviceSpecParser::MakeQueryString ( const bool  urlEncode) const
Returns
reconstituted query string

Definition at line 546 of file ntv2nubaccess.cpp.

◆ ParseQueryParams()

bool NTV2DeviceSpecParser::ParseQueryParams ( const NTV2Dictionary inSrcDict,
NTV2Dictionary outQueryParams 
)
static

Parses the string found in the given source dictionary's 'query' key (kConnectParamQuery), storing the key/value pairs of all parsed query parameters into "outQueryParams". Query parameter values are URL-decoded before storing in the "outQueryParams" dictionary.

Parameters
[in]inSrcDictThe dictionary that provides the 'query' string to be parsed. It is not an error if it has no 'query' key, or if the query string is empty. The query string need not start with '?'.
[out]outQueryParamsDictionary that receives the key/value pairs parsed from the source dictionary's 'query' string. This dictionary is NOT emptied prior to parsing, but will be changed with the parse results.
Returns
True if successful; otherwise false.

Definition at line 1619 of file ntv2nubaccess.cpp.

◆ Print()

ostream & NTV2DeviceSpecParser::Print ( std::ostream &  oss,
const bool  inDumpResults = false 
) const

Definition at line 482 of file ntv2nubaccess.cpp.

◆ PrintErrors()

ostream & NTV2DeviceSpecParser::PrintErrors ( std::ostream &  oss) const

Definition at line 590 of file ntv2nubaccess.cpp.

◆ QueryParam()

std::string NTV2DeviceSpecParser::QueryParam ( const std::string &  inKey) const
inline
Returns
Query parameter value for the given query parameter key (empty string if no such key)

Definition at line 198 of file ntv2nubaccess.h.

◆ QueryParams()

const NTV2Dictionary& NTV2DeviceSpecParser::QueryParams ( void  ) const
inline
Returns
True if ErrorCount is non-zero

Definition at line 197 of file ntv2nubaccess.h.

◆ Reset()

void NTV2DeviceSpecParser::Reset ( const std::string  inSpec = "")

Resets me, then parses the given device specification.

Definition at line 286 of file ntv2nubaccess.cpp.

◆ Resource()

string NTV2DeviceSpecParser::Resource ( const bool  inStripLeadSlash = true) const
Returns
The Result for the kConnectParamResource key

Definition at line 297 of file ntv2nubaccess.cpp.

◆ Result()

std::string NTV2DeviceSpecParser::Result ( const std::string &  inKey) const
inline
Returns
The result value for the given key.

Definition at line 188 of file ntv2nubaccess.h.

◆ Results()

NTV2ConnectParams NTV2DeviceSpecParser::Results ( void  ) const
inline
Returns
A copy of my parse results, a dictionary (of key/value pairs).

Definition at line 186 of file ntv2nubaccess.h.

◆ Scheme()

std::string NTV2DeviceSpecParser::Scheme ( void  ) const
inline
Returns
The scheme (or empty if no scheme)

Definition at line 180 of file ntv2nubaccess.h.

◆ Successful()

bool NTV2DeviceSpecParser::Successful ( void  ) const
inline
Returns
True if successfully parsed

Definition at line 177 of file ntv2nubaccess.h.


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