21#ifndef STYLEDTEXTFILE_HPP
22#define STYLEDTEXTFILE_HPP
79 std::string
getLine(
size_t line)
const;
92 void reStyle(
const std::string& sComLine,
93 const std::string& sDocComLine,
94 const std::string& sComBlockStart,
95 const std::string& sDocComBlockStart,
96 const std::string& sComBlockEnd,
97 const std::string& sStrMarks =
"",
This class represents a text file in memory (e.g. a code file). This class will try to lex the loaded...
int getLastPosition() const
Returns the last printable character position in the currently loaded file.
std::vector< std::pair< size_t, std::string > > vFileContents
std::string getStrippedLine(size_t line) const
Returns the selected line (without the line termination characters and without any comments).
int getLineStartPosition(size_t line) const
Returns the position of the first character in the selected line.
void lex()
This method runs a lexer over the loaded document to obtain styling information.
StyledTextFile(const std::string &fileName)
StyledTextFile constructor. Will load and lex the specified file using NumeRe code.
int LineFromPosition(size_t pos) const
Returns the line number containing the selected character position.
std::string getTextRange(int pos1, int pos2) const
This method returns the text between the passed two positions (including possible line termination ch...
std::string sCommentBlockStart
std::string sDocCommentLine
int getLineEndPosition(size_t line) const
Returns the position of the last printable character in the selected line (before any line terminatio...
int PositionFromLine(size_t line) const
Returns the position of the first character in the selected line.
Style getStyleAt(size_t pos) const
Returns the style at the current selected character position.
std::string sDocCommentBlockStart
int findDocStartLine(size_t line) const
Finds the first line of the current documentation comment or -1, if the current line does not contain...
void reStyle(const std::string &sComLine, const std::string &sDocComLine, const std::string &sComBlockStart, const std::string &sDocComBlockStart, const std::string &sComBlockEnd, const std::string &sStrMarks="", bool strings=true)
Can be used to change the code style detection sequences and to re-apply the lexer to the currently l...
void load()
This method loads the specified file to memory, while keeping the character positions.
int getLinesCount() const
Returns the number of lines in the current loaded file.
std::vector< std::vector< Style > > vStyles
std::string getLine(size_t line) const
Returns the selected line (without the line termination characters).
std::string getFileName() const
Returns the filename of the respresented file in memory.
char getCharAt(size_t pos) const
Returns the character located at the position pos.