45 std::getline(file, sLine);
77 vStyles.push_back(std::vector<Style>(2, lastStyle));
88 for (; j <
vStyles[i].size(); j++)
94 for (; j <
vStyles[i].size(); j++)
123 size_t blockEndLength;
149 if (pos == std::string::npos)
151 for (; j <
vStyles[i].size(); j++)
156 for (; j < pos+blockEndLength; j++)
218 if (line1 == -1 || line2 == -1)
225 std::string sTextRange;
229 sTextRange = (
vFileContents[line1].second +
"\r\n").substr(pos1, pos2-pos1);
232 sTextRange = (
vFileContents[line1].second +
"\r\n").substr(pos1);
234 for (
int line = line1+1; line < line2; line++)
237 sTextRange += (
vFileContents[line2].second +
"\r\n").substr(0, pos2);
276 for (
size_t i = 0; i <
vFileContents[line].second.length(); i++)
396 size_t pos =
vFileContents[line].second.find_first_not_of(
" \t");
398 if (pos == std::string::npos
404 size_t nWhitespace = 0;
474 const std::string& sDocComLine,
475 const std::string& sComBlockStart,
476 const std::string& sDocComBlockStart,
477 const std::string& sComBlockEnd,
478 const std::string& sStrMarks,
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.