#pragma once #ifndef HIGHLIGHTER_H #define HIGHLIGHTER_H #include "XMLLexer.h" #include #include #include #include class Highlighter { public: Highlighter(std::istream &file); virtual ~Highlighter(); virtual void highlight(std::ostream &os)=0; protected: void process(); enum TokenType { TAG, CONTENT, ELEMENT, ATTRIBUTE, ATTRIBURE_CONTENT, WHITESPACE, BRACKET, nonmatching }; enum Color { Red, Green, Blue, Orange, Yellow, Cyan, Grey, Black, White, Magenta, Pink, Brown, Indigo, Violet, Undefined}; // All the colors, not all of them are used, but it's easy to change now struct Token { std::string content = ""; Color color; TokenType type; }; std::map colormap; std::vector m_tokens; XMLLexer *m_lexer; }; class ConsoleHighlighter: public Highlighter { public: ConsoleHighlighter(std::istream &file); void highlight(std::ostream &os); }; #endif // HIGHLIGHTER_H