JODA  0.13.1 (59b41972)
JSON On-Demand Analysis
Public Types | Public Member Functions | Static Public Member Functions
FileOrigin Class Reference

#include <FileOrigin.h>

Inheritance diagram for FileOrigin:
[legend]
Collaboration diagram for FileOrigin:
[legend]

Public Types

typedef std::pair< FILEID, std::pair< long, long > > ParseInterval
 

Public Member Functions

 FileOrigin (FILEID id)
 
 FileOrigin (FILEID file, long start, long end, int index)
 
bool isReparsable () const override
 
std::unique_ptr< IOriginclone () const override
 
std::unique_ptr< RJDocumentreparse (RJMemoryPoolAlloc &alloc) const override
 
std::string toString () const override
 
std::string getStreamName () const override
 
FILEID getFile () const
 
ParseInterval getInterval () const
 
- Public Member Functions inherited from IDPositionOrigin
 IDPositionOrigin (FILEID id)
 
 IDPositionOrigin (FILEID id, long start, long end, int index)
 
std::unique_ptr< RJDocumentreparse (RJMemoryPoolAlloc &alloc) const override
 
bool isReparsable () const override
 
virtual ~IDPositionOrigin () override=default
 
long getStart () const
 
void setStart (long start)
 
long getEnd () const
 
void setEnd (long end)
 
int getIndex () const
 
void setIndex (int index)
 
virtual bool operator< (const IOrigin &x) const override final
 
bool operator< (const IDPositionOrigin &other) const
 
bool operator== (const IDPositionOrigin &other) const
 
- Public Member Functions inherited from IOrigin
virtual ~IOrigin ()=default
 
bool operator== (const IOrigin &x) const
 
virtual bool operator<= (const IOrigin &x) const
 
virtual bool operator> (const IOrigin &x) const
 
virtual bool operator>= (const IOrigin &x) const
 

Static Public Member Functions

static std::vector< ParseIntervalmergeIntervals (std::vector< ParseInterval > &&intervals)
 
static std::vector< std::unique_ptr< RJDocument > > parseIntervals (RJMemoryPoolAlloc &alloc, std::vector< ParseInterval > &&intervals)
 

Additional Inherited Members

- Protected Attributes inherited from IDPositionOrigin
FILEID id
 
long start {}
 
long end {}
 
int index {}
 

Detailed Description

FileOrigin represents a document originating from a file on the disk. It stores the filepath and byte start/stop offsets for rapid reparsing

Member Typedef Documentation

◆ ParseInterval

typedef std::pair<FILEID, std::pair<long, long> > FileOrigin::ParseInterval

Constructor & Destructor Documentation

◆ FileOrigin() [1/2]

FileOrigin::FileOrigin ( FILEID  id)

◆ FileOrigin() [2/2]

FileOrigin::FileOrigin ( FILEID  file,
long  start,
long  end,
int  index 
)
Here is the call graph for this function:

Member Function Documentation

◆ clone()

std::unique_ptr< IOrigin > FileOrigin::clone ( ) const
overridevirtual

Clones the IOrigin for use in another document

Returns
New IOrigin with the same parameters.

Implements IDPositionOrigin.

◆ getFile()

FILEID FileOrigin::getFile ( ) const

Returns the FILEID of the origin file

Returns

◆ getInterval()

FileOrigin::ParseInterval FileOrigin::getInterval ( ) const

Returns a ParseIntervalParseInterval for this specific document

Returns

◆ getStreamName()

std::string FileOrigin::getStreamName ( ) const
overridevirtual

Returns a human readable representation of the ID (without the offsets)

Returns

Implements IDPositionOrigin.

Here is the call graph for this function:

◆ isReparsable()

bool FileOrigin::isReparsable ( ) const
overridevirtual

Returns if the IOrigin is reparsable

Returns
true, if yes, false if not

Reimplemented from IOrigin.

◆ mergeIntervals()

std::vector< FileOrigin::ParseInterval > FileOrigin::mergeIntervals ( std::vector< ParseInterval > &&  intervals)
static

Merges a list of ParseIntervals to the minimal possible list

Parameters
intervalsthe list of intervals to merge
Returns
the merged list
Here is the caller graph for this function:

◆ parseIntervals()

std::vector< std::unique_ptr< RJDocument > > FileOrigin::parseIntervals ( RJMemoryPoolAlloc alloc,
std::vector< ParseInterval > &&  intervals 
)
static

Parses a list of ParseIntervals to a list of RJDocuments

Parameters
allocThe memory allocator to use
intervalsthe list of intervals to parse
Returns
the list of parsed documents
Here is the call graph for this function:
Here is the caller graph for this function:

◆ reparse()

std::unique_ptr< RJDocument > FileOrigin::reparse ( RJMemoryPoolAlloc alloc) const
overridevirtual

Reparses the origin into a new RJDocument. The allocator is used to increase performance

Parameters
allocAllocator used for allocating memoty
Returns
Reparsed RJDocument, or nullpointer if not reparsable

Reimplemented from IOrigin.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toString()

std::string FileOrigin::toString ( ) const
overridevirtual

Returns a textual representation of the IOrigin

Returns

Implements IDPositionOrigin.


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