00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef HIGHLIGHT_APP
00021 #define HIGHLIGHT_APP
00022
00023
00024 #include <iostream>
00025 #include <fstream>
00026 #include <string>
00027 #include <vector>
00028 #include <map>
00029 #include <iomanip>
00030 #include <cassert>
00031
00032
00033 #include "cmdlineoptions.h"
00034 #include "configurationreader.h"
00035 #include "codegenerator.h"
00036 #include "help.h"
00037 #include "datadir.h"
00038 #include "version.h"
00039 #include "platform_fs.h"
00040
00041 #define IO_ERROR_REPORT_LENGTH 5
00042 #define SHEBANG_CNT 12
00043
00044 typedef map<string, string> StringMap;
00045
00047
00048 class HLCmdLineApp
00049 {
00050
00051 public:
00052
00053 HLCmdLineApp() {};
00054 ~HLCmdLineApp() {};
00055
00061 int run ( const int argc, const char *argv[] );
00062
00063 private:
00064
00065 DataDir dataDir;
00066 StringMap extensions;
00067 StringMap scriptShebangs;
00068 stringstream cin_bufcopy;
00069
00071 void printVersionInfo();
00072
00074 void printConfigInfo ( const string& );
00075
00077 void printBadInstallationInfo();
00078
00080 void printIOErrorReport ( unsigned int numberErrorFiles, vector<string> & fileList, const string &action );
00081
00085 bool printInstalledThemes();
00086
00090 bool printInstalledLanguages();
00091
00096 void printDebugInfo ( const highlight::LanguageDefinition &lang,
00097 const string &langDefPath );
00098
00099 string getFileSuffix ( const string &fileName );
00100
00101 string guessFileType ( const string &suffix, const string &inputFile="" );
00102
00103 int getNumDigits ( int i );
00104
00105 void printProgressBar ( int total, int count );
00106 void printCurrentAction ( const string&outfilePath,
00107 int total, int count, int countWidth );
00108
00109 bool readInputFilePaths ( vector<string> &fileList, string wildcard,
00110 bool recursiveSearch );
00111
00112 string analyzeFile ( const string& file );
00113 bool loadFileTypeConfig ( const string& name, StringMap* map, StringMap* shebangMap );
00114
00115 };
00116
00117 #endif