"Fossies" - the Fresh Open Source Software Archive

Member "highlight-3.57-x64/src/include/themereader.h" (12 May 2020, 4445 Bytes) of package /windows/www/highlight-3.57-x64.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "themereader.h": 3.53_vs_3.54.

    1 /***************************************************************************
    2                           themereader.h  -  description
    3                              -------------------
    4     begin                : Son Nov 10 2002
    5     copyright            : (C) 2002-2010 by Andre Simon
    6     email                : a.simon@mailbox.org
    7  ***************************************************************************/
    8 
    9 
   10 /*
   11 This file is part of Highlight.
   12 
   13 Highlight is free software: you can redistribute it and/or modify
   14 it under the terms of the GNU General Public License as published by
   15 the Free Software Foundation, either version 3 of the License, or
   16 (at your option) any later version.
   17 
   18 Highlight is distributed in the hope that it will be useful,
   19 but WITHOUT ANY WARRANTY; without even the implied warranty of
   20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   21 GNU General Public License for more details.
   22 
   23 You should have received a copy of the GNU General Public License
   24 along with Highlight.  If not, see <http://www.gnu.org/licenses/>.
   25 */
   26 
   27 
   28 #ifndef THEMEREADER_H
   29 #define THEMEREADER_H
   30 
   31 #include <string>
   32 
   33 #include <Diluculum/LuaState.hpp>
   34 #include <Diluculum/LuaFunction.hpp>
   35 #include <Diluculum/LuaVariable.hpp>
   36 
   37 #include "elementstyle.h"
   38 #include "stylecolour.h"
   39 
   40 using namespace std;
   41 
   42 namespace highlight
   43 {
   44 
   45 /** maps keyword class names and the corresponding formatting information*/
   46 typedef map <string, ElementStyle> KeywordStyles;
   47 
   48 /** iterator for keyword styles*/
   49 typedef KeywordStyles::const_iterator KSIterator;
   50 
   51 /** \brief Contains information about document formatting properties.
   52  * @author Andre Simon
   53  */
   54 
   55 class ThemeReader
   56 {
   57 private:
   58     ElementStyle comment, slcomment, str, dstr,
   59                  escapeChar, number, directive, line, operators, interpolation;
   60     ElementStyle defaultElem;
   61     ElementStyle canvas;
   62 
   63     string errorMsg;
   64     string desc, categories;
   65     string themeInjections;
   66         
   67     vector<Diluculum::LuaFunction*> pluginChunks;
   68 
   69     bool fileOK, restoreStyles, dirtyAttributes;
   70 
   71     KeywordStyles keywordStyles, originalStyles;
   72 
   73     void initStyle(ElementStyle& style, const Diluculum::LuaVariable& var);
   74 
   75 public:
   76     /** Constructor */
   77     ThemeReader();
   78     ~ThemeReader();
   79 
   80     /** load style definition
   81           \param styleDefinitionFile Style definition path
   82           \return True if successful */
   83     bool load ( const string & styleDefinitionFile, OutputType outputType=HTML );
   84 
   85     void addUserChunk(const Diluculum::LuaFunction& chunk)
   86     {
   87         pluginChunks.push_back(new Diluculum::LuaFunction(chunk));
   88     }
   89 
   90     /** \return class names defined in the theme file */
   91     vector <string> getClassNames() const;
   92 
   93     /** \return keyword styles */
   94     KeywordStyles getKeywordStyles() const;
   95 
   96     /** \return Font size */
   97     string getErrorMessage() const;
   98 
   99     const string &getDescription() const
  100     {
  101         return desc;
  102     }
  103 
  104     const string &getCategoryDescription() const
  105     {
  106         return categories;
  107     }
  108 
  109     string getInjections() const;
  110 
  111     /** \return Background colour*/
  112     Colour getBgColour() const;
  113 
  114     /** \return Style of default (unrecognized) strings */
  115     ElementStyle getDefaultStyle() const;
  116 
  117     /** \return Comment style*/
  118     ElementStyle getCommentStyle() const;
  119 
  120     /** \return Single line comment style*/
  121     ElementStyle getSingleLineCommentStyle() const;
  122 
  123     /** \return String style*/
  124     ElementStyle getStringStyle() const;
  125 
  126     /** \return Directive line string style*/
  127     ElementStyle getPreProcStringStyle() const;
  128 
  129     /** \return Escape character style*/
  130     ElementStyle getEscapeCharStyle() const;
  131 
  132     /** \return String interpolation style*/
  133     ElementStyle getInterpolationStyle() const;
  134 
  135     /** \return Number style*/
  136     ElementStyle getNumberStyle() const;
  137 
  138     /** \return Directive style*/
  139     ElementStyle getPreProcessorStyle() const;
  140 
  141     /** \return Type style*/
  142     ElementStyle getTypeStyle() const;
  143 
  144     /** \return Line number style*/
  145     ElementStyle getLineStyle() const;
  146 
  147     /** \return Operator style*/
  148     ElementStyle getOperatorStyle() const;
  149 
  150     /** \param className Name of keyword class (eg kwa, kwb, .., kwd)
  151         \return keyword style of the given className
  152     */
  153     ElementStyle getKeywordStyle ( const string &className ) ;
  154 
  155     /** \return True if language definition was found */
  156     bool found() const ;
  157     
  158     void overrideAttributes( vector<int>& attributes);
  159 };
  160 
  161 }
  162 
  163 #endif