00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef HIGHLIGHT_APP
00014 #define HIGHLIGHT_APP
00015
00016
00017 #include <iostream>
00018 #include <fstream>
00019 #include <string>
00020 #include <vector>
00021 #include <map>
00022 #include <iomanip>
00023 #include <cassert>
00024
00025 #include "./dirstream0.4/dirstream.h"
00026 #include "cmdlineoptions.h"
00027 #include "configurationreader.h"
00028 #include "codegenerator.h"
00029 #include "help.h"
00030 #include "datadir.h"
00031 #include "version.h"
00032 #include "platform_fs.h"
00033
00034 #define IO_ERROR_REPORT_LENGTH 5
00035 #define SHEBANG_CNT 12
00036
00037 typedef map<string, string> StringMap;
00038
00043 class HighlightApp {
00044
00045 public:
00046
00047 HighlightApp(){};
00048 ~HighlightApp(){};
00049
00055 int run(int argc, char **argv);
00056
00057 private:
00058
00059 DataDir dataDir;
00060 StringMap extensions;
00061 StringMap scriptShebangs;
00062
00064 void printVersionInfo();
00065
00067 void printBadInstallationInfo();
00068
00070 void printIOErrorReport(unsigned int numberErrorFiles, vector<string> & fileList, const string &action);
00071
00075 bool listInstalledFiles(bool showThemes);
00076
00077 void printDebugInfo(highlight::LanguageDefinition &lang,
00078 const string &langDefPath);
00079
00080 string getFileSuffix(const string &fileName);
00081
00082 string guessFileType(const string &suffix, const string &inputFile="");
00083
00084 int getNumDigits(int i);
00085
00086 void printProgressBar(int total, int count);
00087 void printCurrentAction(const string&outfilePath,
00088 int total, int count, int countWidth);
00089
00090 bool readInputFilePaths(vector<string> &fileList, string wildcard,
00091 bool recursiveSearch);
00092
00093 string analyzeFile(const string& file);
00094 bool loadMapConfig(const string& name, StringMap* map);
00095
00096 };
00097
00098 #endif