"Fossies" - the Fresh Open Source Software Archive

Member "ansifilter-2.18/src/elementstyle.cpp" (30 Jan 2021, 2423 Bytes) of package /linux/privat/ansifilter-2.18.tar.bz2:


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. For more information about "elementstyle.cpp" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 2.13_vs_2.14.

    1 /***************************************************************************
    2                           elementstyle.cpp  -  description
    3                              -------------------
    4     copyright            : (C) 2007-2011 by Andre Simon
    5     email                : a.simon@mailbox.org
    6  ***************************************************************************/
    7 
    8 /*
    9 This file is part of ANSIFilter.
   10 
   11 ANSIFilter is free software: you can redistribute it and/or modify
   12 it under the terms of the GNU General Public License as published by
   13 the Free Software Foundation, either version 3 of the License, or
   14 (at your option) any later version.
   15 
   16 ANSIFilter is distributed in the hope that it will be useful,
   17 but WITHOUT ANY WARRANTY; without even the implied warranty of
   18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   19 GNU General Public License for more details.
   20 
   21 You should have received a copy of the GNU General Public License
   22 along with ANSIFilter.  If not, see <http://www.gnu.org/licenses/>.
   23 */
   24 
   25 #include "elementstyle.h"
   26 #include <iostream>
   27 namespace ansifilter
   28 {
   29 
   30 
   31 ElementStyle::ElementStyle()
   32     : bold(false), italic(false), underline(false), blink(false),
   33       reset(true), isNegativeMode(false), conceal(false), bgColorSet(false), fgColorSet(false),
   34       fgColID(0),
   35       bgColID(-1)
   36 {}
   37 
   38 ElementStyle::~ElementStyle()
   39 {}
   40 
   41 bool ElementStyle::isItalic() const
   42 {
   43     return italic;
   44 }
   45 bool ElementStyle::isBlink() const
   46 {
   47     return blink;
   48 }
   49 bool ElementStyle::isBold() const
   50 {
   51     return bold;
   52 }
   53 bool ElementStyle::isUnderline() const
   54 {
   55     return underline;
   56 }
   57 bool ElementStyle::isConceal() const
   58 {
   59     return conceal;
   60 }
   61 bool ElementStyle::isBgColorSet() const
   62 {
   63     return bgColorSet;
   64 }
   65 bool ElementStyle::isFgColorSet() const
   66 {
   67     return fgColorSet;
   68 }
   69 const StyleColour ElementStyle::getFgColour() const
   70 {
   71     return fgColour;
   72 }
   73 const StyleColour ElementStyle::getBgColour() const
   74 {
   75     return bgColour;
   76 }
   77 
   78 void  ElementStyle::imageMode(bool negative)
   79 {
   80     if (negative !=isNegativeMode) {
   81         StyleColour swapCol=getFgColour();
   82         setFgColour(getBgColour());
   83         setBgColour(swapCol);
   84         isNegativeMode=!isNegativeMode;
   85     }
   86 }
   87 
   88 void ElementStyle::setReset(bool b)
   89 {
   90   
   91   
   92     reset=b;
   93     if (reset) {
   94       setFgColour("#000000");
   95       setFgColourID(0);
   96       setBgColourID(-1);
   97       bold= italic= underline= conceal = blink = bgColorSet = fgColorSet = false;
   98     }
   99 }
  100 
  101 }