LLVM  10.0.0svn
Public Member Functions | Friends | List of all members
llvm::DataExtractor::Cursor Class Reference

A class representing a position in a DataExtractor, as well as any error encountered during extraction. More...

#include "llvm/Support/DataExtractor.h"

Public Member Functions

 Cursor (uint64_t Offset)
 Construct a cursor for extraction from the given offset. More...
 
 operator bool ()
 Checks whether the cursor is valid (i.e. More...
 
uint64_t tell () const
 Return the current position of this Cursor. More...
 
Error takeError ()
 Return error contained inside this Cursor, if any. More...
 

Friends

class DataExtractor
 

Detailed Description

A class representing a position in a DataExtractor, as well as any error encountered during extraction.

It enables one to extract a sequence of values without error-checking and then checking for errors in bulk at the end. The class holds an Error object, so failing to check the result of the parse will result in a runtime error. The error flag is sticky and will cause all subsequent extraction functions to fail without even attempting to parse and without updating the Cursor offset. After clearing the error flag, one can again use the Cursor object for parsing.

Definition at line 54 of file DataExtractor.h.

Constructor & Destructor Documentation

◆ Cursor()

llvm::DataExtractor::Cursor::Cursor ( uint64_t  Offset)
inlineexplicit

Construct a cursor for extraction from the given offset.

Definition at line 62 of file DataExtractor.h.

Member Function Documentation

◆ operator bool()

llvm::DataExtractor::Cursor::operator bool ( )
inlineexplicit

Checks whether the cursor is valid (i.e.

no errors were encountered). In case of errors, this does not clear the error flag – one must call takeError() instead.

Definition at line 67 of file DataExtractor.h.

◆ takeError()

Error llvm::DataExtractor::Cursor::takeError ( )
inline

Return error contained inside this Cursor, if any.

Clears the internal Cursor state.

Definition at line 75 of file DataExtractor.h.

Referenced by llvm::DWARFDebugLoclists::parseOneLocationList().

◆ tell()

uint64_t llvm::DataExtractor::Cursor::tell ( ) const
inline

Return the current position of this Cursor.

In the error state this is the position of the Cursor before the first error was encountered.

Definition at line 71 of file DataExtractor.h.

Referenced by llvm::DWARFDebugLoclists::parseOneLocationList().

Friends And Related Function Documentation

◆ DataExtractor

friend class DataExtractor
friend

Definition at line 58 of file DataExtractor.h.


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