"Fossies" - the Fresh Open Source Software Archive

Member "highlight-3.57-x64/src/include/stylecolour.h" (12 May 2020, 3130 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.

    1 /***************************************************************************
    2                           stylecolour.h  -  description
    3                              -------------------
    4     begin                : Die Nov 5 2002
    5     copyright            : (C) 2002 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 STYLECOLOUR_H
   29 #define STYLECOLOUR_H
   30 
   31 #include "enums.h"
   32 
   33 #include <string>
   34 
   35 
   36 using namespace std;
   37 
   38 namespace highlight
   39 {
   40 
   41 /**\brief Stores colours and returns red, green and blue values in different formats
   42 * @author Andre Simon
   43  */
   44 
   45 struct RGBVal {
   46     int iRed,    ///< Red value
   47         iGreen,  ///< Green value
   48         iBlue;   ///< Blue value
   49 };
   50 
   51 class Colour
   52 {
   53 public:
   54     /** Constructor
   55         \param red Red value in hex notation
   56         \param green Blue value in hex notation
   57         \param blue Green value in hex notation
   58     */
   59     Colour ( const string & red, const string & green, const string & blue );
   60 
   61     /** Constructor
   62         \param ColourString String with rgb values
   63     */
   64     Colour ( const string & colourString );
   65 
   66     Colour();
   67     ~Colour() {};
   68 
   69     /** Sets red, green and blue values
   70       \param ColourString String containing colour attributes
   71     */
   72     void setRGB ( const string & colourString );
   73 
   74 
   75     /** Sets red value
   76         \param red New red value */
   77     void setRed ( const string & red );
   78 
   79     /** Sets green value
   80         \param green New green value */
   81     void setGreen ( const string & green );
   82 
   83     /** Sets blue value
   84         \param blue New blue value */
   85     void setBlue ( const string & blue );
   86 
   87     /**  @param type Output type
   88          @return Red value in color representation according to output type */
   89     string getRed ( OutputType type ) const;
   90     /**  @param type Output type
   91          @return Green value in color representation according to output type */
   92     string getGreen ( OutputType type ) const;
   93     /**  @param type Output type
   94          @return Blue value in color representation according to output type */
   95     string getBlue ( OutputType type ) const;
   96     
   97     
   98     /**  @return red value */
   99     int getRed () const;
  100     
  101     /**  @return green value */
  102     int getGreen () const;
  103     
  104     /**  @return blue value */
  105     int getBlue () const;
  106 
  107 private:
  108     RGBVal rgb;
  109     string int2str ( int, std::ios_base& ( *f ) ( std::ios_base& ) ) const;
  110     string float2str ( double ) const;
  111 };
  112 
  113 }
  114 
  115 #endif