Android-cuttlefish cvd tool
Public Member Functions | Private Attributes | List of all members
cuttlefish::CommandParser Class Reference

#include <command_parser.h>

Collaboration diagram for cuttlefish::CommandParser:
Collaboration graph
[legend]

Public Member Functions

 CommandParser (const std::string &command)
 
 ~CommandParser ()=default
 
 CommandParser (CommandParser &&)=default
 
CommandParseroperator= (CommandParser &&)=default
 
void SkipPrefix ()
 
void SkipPrefixAT ()
 
void SkipComma ()
 
void SkipWhiteSpace ()
 
std::string_view GetNextStr ()
 
std::string_view GetNextStr (char flag)
 
std::string GetNextStrDeciToHex ()
 
int GetNextInt ()
 
int GetNextHexInt ()
 
const std::string_view * operator-> () const
 
const std::string_view & operator* () const
 
bool operator== (const std::string &rhs) const
 
std::string_view::const_reference & operator[] (int index) const
 

Private Attributes

std::string copy_command_
 
std::string_view command_
 

Constructor & Destructor Documentation

◆ CommandParser() [1/2]

cuttlefish::CommandParser::CommandParser ( const std::string &  command)
inlineexplicit

◆ ~CommandParser()

cuttlefish::CommandParser::~CommandParser ( )
default

◆ CommandParser() [2/2]

cuttlefish::CommandParser::CommandParser ( CommandParser &&  )
default

Member Function Documentation

◆ GetNextHexInt()

int cuttlefish::CommandParser::GetNextHexInt ( )

Parses the next base 16 integer in the AT command returns the value on success and -1 on fail updates command_

◆ GetNextInt()

int cuttlefish::CommandParser::GetNextInt ( )

Parses the next base 10 integer in the AT command returns the value on success and -1 on fail updates command_

◆ GetNextStr() [1/2]

std::string_view cuttlefish::CommandParser::GetNextStr ( )

Parses the next string between double quotes returns the string on success and "" on fail updates command_

◆ GetNextStr() [2/2]

std::string_view cuttlefish::CommandParser::GetNextStr ( char  flag)

Parses the next string before the flag If flag not exists, returns the whole command_ updates command_

◆ GetNextStrDeciToHex()

std::string cuttlefish::CommandParser::GetNextStrDeciToHex ( )

Parses the next base 10 integer in the AT command and convert to upper case hex string returns the hex string on success and "" on fail updates command_

Specially, for AT+CRSM

◆ operator*()

const std::string_view & cuttlefish::CommandParser::operator* ( ) const
inline

◆ operator->()

const std::string_view * cuttlefish::CommandParser::operator-> ( ) const
inline

◆ operator=()

CommandParser & cuttlefish::CommandParser::operator= ( CommandParser &&  )
default

◆ operator==()

bool cuttlefish::CommandParser::operator== ( const std::string &  rhs) const
inline

◆ operator[]()

std::string_view::const_reference & cuttlefish::CommandParser::operator[] ( int  index) const
inline

◆ SkipComma()

void cuttlefish::CommandParser::SkipComma ( )
inline

Skip the next comma updates command_

◆ SkipPrefix()

void cuttlefish::CommandParser::SkipPrefix ( )
inline

Skip the substring before the first '=', including '=' updates command_ If '=' not exists, command_ remains unchanged

◆ SkipPrefixAT()

void cuttlefish::CommandParser::SkipPrefixAT ( )
inline

Skip the next "AT" substring updates command_

◆ SkipWhiteSpace()

void cuttlefish::CommandParser::SkipWhiteSpace ( )
inline

Skip the next whitespace updates command_

Member Data Documentation

◆ command_

std::string_view cuttlefish::CommandParser::command_
private

◆ copy_command_

std::string cuttlefish::CommandParser::copy_command_
private

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