Wraps a char array, providing a set of methods for parsing data from it.  
 More...
#include <CharArrayParser.h>
 | 
|   | CCharArrayParser ()=default | 
|   | 
|   | ~CCharArrayParser ()=default | 
|   | 
| void  | Reset () | 
|   | Sets the position and limit to zero.  
  | 
|   | 
| void  | Reset (const char *data, int limit) | 
|   | Updates the instance to wrap the specified data and resets the position to zero.  
  | 
|   | 
| int  | CharsLeft () | 
|   | Return the number of chars yet to be read.  
  | 
|   | 
| int  | GetPosition () | 
|   | Returns the current offset in the array.  
  | 
|   | 
| bool  | SetPosition (int position) | 
|   | Set the reading offset in the array.  
  | 
|   | 
| bool  | SkipChars (int nChars) | 
|   | Skip a specified number of chars.  
  | 
|   | 
| uint8_t  | ReadNextUnsignedChar () | 
|   | Reads the next unsigned char (it is assumed that the caller has already checked the availability of the data for its length)  
  | 
|   | 
| uint16_t  | ReadNextUnsignedShort () | 
|   | Reads the next two chars as unsigned short value (it is assumed that the caller has already checked the availability of the data for its length)  
  | 
|   | 
| uint32_t  | ReadNextUnsignedInt () | 
|   | Reads the next four chars as unsigned int value (it is assumed that the caller has already checked the availability of the data for its length)  
  | 
|   | 
| std::string  | ReadNextString (int length) | 
|   | Reads the next string of specified length (it is assumed that the caller has already checked the availability of the data for its length)  
  | 
|   | 
| bool  | ReadNextArray (int length, char *data) | 
|   | Reads the next chars array of specified length (it is assumed that the caller has already checked the availability of the data for its length)  
  | 
|   | 
| bool  | ReadNextLine (std::string &line) | 
|   | Reads a line of text. A line is considered to be terminated by any one of a carriage return ('\r'), a line feed ('\n'), or a carriage return followed by a line feed ('\r\n'), this method discards leading UTF-8 byte order marks, if present.  
  | 
|   | 
| const char *  | GetData () | 
|   | Get the current data.  
  | 
|   | 
Wraps a char array, providing a set of methods for parsing data from it. 
 
◆ CCharArrayParser()
  
  
      
        
          | CCharArrayParser::CCharArrayParser  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
default   | 
  
 
 
◆ ~CCharArrayParser()
  
  
      
        
          | CCharArrayParser::~CCharArrayParser  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
default   | 
  
 
 
◆ CharsLeft()
      
        
          | int CCharArrayParser::CharsLeft  | 
          ( | 
           | ) | 
           | 
        
      
 
Return the number of chars yet to be read. 
 
 
◆ GetData()
  
  
      
        
          | const char * CCharArrayParser::GetData  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Get the current data. 
- Returns
 - The char pointer to the current data 
 
 
 
◆ GetPosition()
      
        
          | int CCharArrayParser::GetPosition  | 
          ( | 
           | ) | 
           | 
        
      
 
Returns the current offset in the array. 
 
 
◆ ReadNextArray()
      
        
          | bool CCharArrayParser::ReadNextArray  | 
          ( | 
          int |           length,  | 
        
        
           | 
           | 
          char * |           data ) | 
        
      
 
Reads the next chars array of specified length (it is assumed that the caller has already checked the availability of the data for its length) 
- Parameters
 - 
  
    | length | The length to be read  | 
    | data[OUT] | The data read  | 
  
   
- Returns
 - True if success, otherwise false 
 
 
 
◆ ReadNextLine()
      
        
          | bool CCharArrayParser::ReadNextLine  | 
          ( | 
          std::string & |           line | ) | 
           | 
        
      
 
Reads a line of text. A line is considered to be terminated by any one of a carriage return ('\r'), a line feed ('\n'), or a carriage return followed by a line feed ('\r\n'), this method discards leading UTF-8 byte order marks, if present. 
- Parameters
 - 
  
    | line | [OUT] The line read without line-termination characters  | 
  
   
- Returns
 - True if read, otherwise false if the end of the data has already been reached 
 
 
 
◆ ReadNextString()
      
        
          | std::string CCharArrayParser::ReadNextString  | 
          ( | 
          int |           length | ) | 
           | 
        
      
 
Reads the next string of specified length (it is assumed that the caller has already checked the availability of the data for its length) 
- Parameters
 - 
  
    | length | The length to be read  | 
  
   
- Returns
 - The string value 
 
 
 
◆ ReadNextUnsignedChar()
      
        
          | uint8_t CCharArrayParser::ReadNextUnsignedChar  | 
          ( | 
           | ) | 
           | 
        
      
 
Reads the next unsigned char (it is assumed that the caller has already checked the availability of the data for its length) 
- Returns
 - The unsigned char value 
 
 
 
◆ ReadNextUnsignedInt()
      
        
          | uint32_t CCharArrayParser::ReadNextUnsignedInt  | 
          ( | 
           | ) | 
           | 
        
      
 
Reads the next four chars as unsigned int value (it is assumed that the caller has already checked the availability of the data for its length) 
- Returns
 - The unsigned int value 
 
 
 
◆ ReadNextUnsignedShort()
      
        
          | uint16_t CCharArrayParser::ReadNextUnsignedShort  | 
          ( | 
           | ) | 
           | 
        
      
 
Reads the next two chars as unsigned short value (it is assumed that the caller has already checked the availability of the data for its length) 
- Returns
 - The unsigned short value 
 
 
 
◆ Reset() [1/2]
      
        
          | void CCharArrayParser::Reset  | 
          ( | 
           | ) | 
           | 
        
      
 
Sets the position and limit to zero. 
 
 
◆ Reset() [2/2]
      
        
          | void CCharArrayParser::Reset  | 
          ( | 
          const char * |           data,  | 
        
        
           | 
           | 
          int |           limit ) | 
        
      
 
Updates the instance to wrap the specified data and resets the position to zero. 
- Parameters
 - 
  
    | data | The data  | 
    | limit | The limit of length of the data  | 
  
   
 
 
◆ SetPosition()
      
        
          | bool CCharArrayParser::SetPosition  | 
          ( | 
          int |           position | ) | 
           | 
        
      
 
Set the reading offset in the array. 
- Parameters
 - 
  
    | position | The new offset position  | 
  
   
- Returns
 - True if success, otherwise false 
 
 
 
◆ SkipChars()
      
        
          | bool CCharArrayParser::SkipChars  | 
          ( | 
          int |           nChars | ) | 
           | 
        
      
 
Skip a specified number of chars. 
- Parameters
 - 
  
    | nChars | The number of chars  | 
  
   
- Returns
 - True if success, otherwise false 
 
 
 
The documentation for this class was generated from the following files: