OMNeT++ NEDXML 6.1
Discrete Event Simulation Library
SourceDocument Class Reference

Description

Stores the full text of a NED/MSG file.

Used internally by NedParser. Stores the full text of a source file, and makes it possible to retrieve parts of it by (line1,col1,line2,col2) coordinates passed in an YYLTYPE structure. Also finds and retrieves comments near a position passed in an YYLTYPE.

Public Member Functions

 SourceDocument ()
 
 ~SourceDocument ()
 
bool readFile (const char *filename)
 
bool setData (const char *data)
 
const char * get (YYLoc pos)
 
const char * getFileComment ()
 
const char * getBannerComment (YYLoc pos)
 
const char * getTrailingComment (YYLoc pos)
 
const char * getNextInnerComment (YYLoc &pos)
 
YYLoc getFullTextPos ()
 
const char * getFullText ()
 
void trimSpaceAndComments (YYLoc &pos)
 

Constructor & Destructor Documentation

◆ SourceDocument()

Constructor.

◆ ~SourceDocument()

Destructor.

Member Function Documentation

◆ readFile()

bool readFile ( const char *  filename)

Reads NED file given with its filename.

See also
setData()

◆ setData()

bool setData ( const char *  data)

Uses literal NED text.

See also
readFile()

◆ get()

const char* get ( YYLoc  pos)

Returns pointer to a text region defined by (beg-line, beg-col) and (end-line, end-col). The text is NOT copied, only a null character is written temporarily into the stored string at (end-line, end-col) – this also means you should NOT keep more than one pointer returned by get()!

◆ getFileComment()

const char* getFileComment ( )

Returns comment at top of file. Uses get()!

◆ getBannerComment()

const char* getBannerComment ( YYLoc  pos)

Returns banner comment above text range passed in pos. Uses get()!

◆ getTrailingComment()

const char* getTrailingComment ( YYLoc  pos)

Returns trailing comment below text range passed in pos. Uses get()!

◆ getNextInnerComment()

const char* getNextInnerComment ( YYLoc pos)

Returns the next comment inside the given region, and moves the region's start past the comment. Uses get()!

◆ getFullTextPos()

YYLoc getFullTextPos ( )

Returns 1:0...end.

◆ getFullText()

const char* getFullText ( )

Returns pointer to the full source code. Uses get()!

◆ trimSpaceAndComments()

void trimSpaceAndComments ( YYLoc pos)

Shrinks the given region to exclude any leading/trailing whitespace and comments.


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