"Fossies" - the Fresh Open Source Software Archive

Member "highlight-3.57-x64/src/include/datadir.h" (12 May 2020, 4714 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 "datadir.h": 3.54_vs_3.55.

    1 /***************************************************************************
    2                           datadir.h  -  description
    3                              -------------------
    4     begin                : Sam March 1 2003
    5     copyright            : (C) 2003-2019 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 DATADIR_H
   29 #define DATADIR_H
   30 
   31 #include <map>
   32 #include <boost/xpressive/xpressive_dynamic.hpp>
   33 #include <Diluculum/LuaState.hpp>
   34 
   35 #include "stringtools.h"
   36 
   37 using namespace std;
   38 
   39 typedef map<string, string> StringMap;
   40 
   41 
   42 /** \brief Manages access to installation directories.
   43 
   44     Apart from the standard installation directory, one can define additional
   45     search paths. If the additional paths do not exist, the default paths are
   46     returned.
   47  **/
   48 
   49 class DataDir
   50 {
   51     vector <string> possibleDirs;
   52     
   53 private:
   54 
   55     const string searchFile(const string path);
   56     
   57     string getFileBaseName(const string& fileName);
   58 
   59     string analyzeFile ( const string& file );
   60     
   61     void readLuaList(const string& paramName, const string& langName,Diluculum::LuaValue &luaVal, StringMap* extMap);
   62     
   63     // object needs to life until cin is no longer used
   64     stringstream cin_bufcopy;
   65     
   66 public:
   67 
   68     StringMap assocByExtension, assocByFilename, assocByShebang, encodingHint;
   69 
   70     static string LSB_DATA_DIR;
   71     static string LSB_CFG_DIR;
   72     static string LSB_DOC_DIR;
   73 
   74     /** search for a valid installation directory
   75         \param  userDefinedDir Directory defined by user
   76         \return True if directory was found */
   77     void initSearchDirectories ( const string &userDefinedDir );
   78 
   79     // Deprecated
   80     void searchDataDir( const string &userDefinedDir );
   81 
   82     const void printConfigPaths();
   83 
   84     /**  \param file file
   85          \return Location of given syntax definition */
   86     const string getLangPath ( const string & file) ;
   87 
   88     /** \return System themes location */
   89     const string getThemePath ( ) ;
   90 
   91     /** \return System syntax location */
   92     const string getLangPath ( ) ;
   93 
   94     /** \return System syntax location */
   95     const string getSystemDataPath ( ) ;
   96 
   97     /** \return Location of plugins */
   98     const string getPluginPath ();
   99 
  100     /** \param file file
  101      *  \param base16 set to true if the theme is located in the base16 sub dir
  102         \return Location of given theme */
  103     const string getThemePath ( const string & file, bool base16=false ) ;
  104 
  105     /** \param file file
  106         \return Location of given configuration file */
  107     const string getFiletypesConfPath (const string &path="filetypes.conf");
  108     
  109     /** \param file file
  110         \return Location of given plugin file */
  111     const string getPluginPath (const string &);
  112 
  113     /** \return Location of GUI menu translation files */
  114     const string getI18nDir();
  115 
  116     /** \return Location of GUI file extension filter files */
  117     const string getExtDir();
  118 
  119     /** \return Location of documentation (README) files (GUI) */
  120     const string getDocDir();
  121     
  122     /** \param snytax name
  123         \return Encoding hint assigned to the syntax */
  124     const string getEncodingHint (const string &);
  125     
  126         
  127     /**
  128      * \param fileName input file name 
  129      * \return file extension or the base filename if no file extension exists
  130     */
  131     string getFileSuffix ( const string &fileName );
  132 
  133     /**
  134      * \param suffix file name suffix
  135      * \param inputFile name of the input file
  136      * \param useUserSuffix true if user has defined a syntax suffix
  137      * \param forceShebangCheckStdin true if stdin should be peeked to look for shebang patterns 
  138      * \return file type deferred from extension or file shebang comment
  139     */
  140     string guessFileType ( const string &suffix, const string &inputFile, 
  141                            bool useUserSuffix=false, bool forceShebangCheckStdin=false );
  142     
  143     /**
  144      * \param name absolute path of filetypes.conf
  145      * \return true if successful
  146     */
  147     bool loadFileTypeConfig ( const string& name);
  148 };
  149 
  150 #endif