"Fossies" - the Fresh Open Source Software Archive

Member "ansifilter-2.18-x64/src/cmdlineoptions.h" (30 Jan 2021, 5876 Bytes) of package /windows/misc/ansifilter-2.18-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 "cmdlineoptions.h": 2.16_vs_2.17.

    1 /***************************************************************************
    2                           cmdlineoptions.h  -  description
    3                              -------------------
    4     begin                : Sun Oct 13 2007
    5     copyright            : (C) 2007-2018 by Andre Simon
    6     email                : a.simon@mailbox.org
    7  ***************************************************************************/
    8 
    9 /*
   10 This file is part of ANSIFilter.
   11 
   12 ANSIFilter is free software: you can redistribute it and/or modify
   13 it under the terms of the GNU General Public License as published by
   14 the Free Software Foundation, either version 3 of the License, or
   15 (at your option) any later version.
   16 
   17 ANSIFilter is distributed in the hope that it will be useful,
   18 but WITHOUT ANY WARRANTY; without even the implied warranty of
   19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   20 GNU General Public License for more details.
   21 
   22 You should have received a copy of the GNU General Public License
   23 along with ANSIFilter.  If not, see <http://www.gnu.org/licenses/>.
   24 */
   25 
   26 #ifndef CMDLINEOPTIONS_H
   27 #define CMDLINEOPTIONS_H
   28 
   29 #include <string>
   30 #include <map>
   31 #include <cstdlib>
   32 #include <iostream>
   33 #include <fstream>
   34 #include <vector>
   35 #include "enums.h"
   36 
   37 
   38 using namespace std;
   39 
   40 /// handle command line options
   41 
   42 class CmdLineOptions
   43 {
   44 public:
   45 
   46     /**Constructor
   47      \param argc Argument count
   48      \param argv Argument strings
   49     */
   50     CmdLineOptions( const int argc, const char *argv[] );
   51     ~CmdLineOptions();
   52 
   53     /** \return Single output file name*/
   54     string getSingleOutFilename();
   55 
   56     /** \return Single input file name*/
   57     string getSingleInFilename() const;
   58 
   59     /** \return Output directory*/
   60     string getOutDirectory() ;
   61 
   62     /** \return Character encoding*/
   63     string getEncoding() const;
   64 
   65     /** \return font name*/
   66     string getFont() const;
   67 
   68     /** \return font size*/
   69     string getFontSize() const;
   70 
   71     /** \return path to color map*/
   72     string getMapPath() const;
   73     
   74     /** \return True if version information should be printed*/
   75     bool printVersion() const;
   76 
   77     /** \return True if help information should be printed*/
   78     bool printHelp() const;
   79 
   80     /** \return True if output should be fragmented*/
   81     bool fragmentOutput() const;
   82 
   83     /** \return output file suffix */
   84     string getOutFileSuffix() const;
   85 
   86     /** \return Output file format */
   87     ansifilter::OutputType getOutputType() const;
   88 
   89     /** \return True if encoding specification should be omitted in output*/
   90     bool omitEncoding() const;
   91 
   92     /** \return True if formatting infotmation should not be outputted */
   93     bool plainOutput() const;
   94 
   95     /** \return True if input files should be raed after EOF occoured */
   96     bool ignoreInputEOF() const;
   97 
   98     /** \return True if line numbers should be printed */
   99     bool showLineNumbers() const;
  100 
  101     /** \return True if anchors should be added to line numbers */
  102     bool addAnchors() const;
  103 
  104     /** \return True if line numbers should be printed */
  105     bool wrapNoNumbers() const;
  106 
  107     /** \return True if input should be treated as codepage 437 ASCII art */
  108     bool parseCP437() const;
  109     
  110     /** \return True if input should be treated as BIN ASCII art */
  111     bool parseAsciiBin() const;
  112 
  113     /** \return True if input should be treated as Tundra ASCII art */
  114     bool parseAsciiTundra() const;
  115    
  116      /** \return True if output should not be terminated with carriage return */
  117     bool omitTrailingCR() const;
  118 
  119     /** \return True if output should not contain a version info comment */
  120     bool omitVersionInfo() const;
  121     
  122     /** \return True if clear sequences (ESC K) should be ignored */
  123     bool ignoreClearSeq() const;
  124 
  125         /** \return True if CSI sequences should be ignored */
  126     bool ignoreCSISeq() const;
  127     
  128     /** \return True if output should contain dynamic style classes instead of inline styles */
  129     bool applyDynStyles() const;
  130     
  131     /** \return True if dynamic styles should be saved to a file */
  132     bool genDynStyles() const;
  133     
  134     bool addFunnyAnchors() const;
  135 
  136     /** \return Document title */
  137     string getDocumentTitle() const ;
  138 
  139     /** \return Document title */
  140     string getStyleSheetPath() const ;
  141 
  142     /** \return List of input file names*/
  143     const vector <string> & getInputFileNames() const;
  144 
  145     int getWrapLineLength() const;
  146 
  147     /** \return XBIN width */
  148     int getAsciiArtWidth() const;
  149 
  150     /** \return XBIN height */
  151     int getAsciiArtHeight() const;
  152 
  153     /** \return SVG width */
  154     string getWidth() const;
  155 
  156     /** \return SVG height */
  157     string getHeight() const;
  158 
  159     /** \return Allowed input file size */
  160     off_t getMaxFileSize() const;
  161 
  162 private:
  163     ansifilter::OutputType outputType;
  164 
  165     bool opt_help;
  166     bool opt_version ;
  167     bool opt_fragment;
  168     bool opt_plain;
  169     bool opt_ignoreEOF;
  170     bool opt_linenum;
  171     bool opt_wrapNoNum;
  172     bool opt_anchors;
  173     bool opt_cp437;
  174     bool opt_asciiBin;
  175     bool opt_asciiTundra;
  176 
  177     bool opt_omit_trailing_cr;
  178     bool opt_omit_version_info;
  179     bool opt_ignoreClear;
  180     bool opt_ignoreCSI;
  181     
  182     bool opt_applyDynStyles;
  183     bool opt_genDynStyles;
  184     bool opt_funny_anchors;
  185 
  186     // name of single output file
  187     string outFilename;
  188     string docTitle;
  189     string encodingName;
  190     string outDirectory;
  191     string font;
  192     string fontSize;
  193     string styleSheetPath;
  194     string colorMapPath;
  195     string width;
  196     string height;
  197 
  198     int wrapLineLen;
  199     int asciiArtWidth;
  200     int asciiArtHeight;
  201     
  202     off_t maxFileSize;
  203 
  204     /** list of all input file names */
  205     vector <string> inputFileNames;
  206 
  207     /** \return Valid path name */
  208     string validateDirPath(const string & path);
  209 
  210     /** \return directory name of path */
  211     string getDirName( const string & path);
  212 
  213     void parseRuntimeOptions( const int argc, const char *argv[], bool readInputFilenames=true);
  214 };
  215 
  216 #endif