1 // 2 // Copyright (c) ZeroC, Inc. All rights reserved. 3 // 4 5 #ifndef PREPROCESSOR_H 6 #define PREPROCESSOR_H 7 8 #include <IceUtil/Shared.h> 9 #include <IceUtil/Handle.h> 10 #include <vector> 11 12 namespace Slice 13 { 14 15 class Preprocessor; 16 typedef IceUtil::Handle<Preprocessor> PreprocessorPtr; 17 18 class Preprocessor : public IceUtil::SimpleShared 19 { 20 public: 21 22 static PreprocessorPtr create(const std::string&, const std::string&, const std::vector<std::string>&); 23 24 ~Preprocessor(); 25 26 FILE* preprocess(bool, const std::string& = ""); 27 FILE* preprocess(bool, const std::vector<std::string>&); 28 bool close(); 29 30 enum Language { CPlusPlus, Java, CSharp, Python, Ruby, PHP, JavaScript, JavaScriptJSON, ObjC, SliceXML, MATLAB }; 31 32 bool printMakefileDependencies(std::ostream&, Language, const std::vector<std::string>&, const std::string& = "", 33 const std::string& = "cpp", const std::string& = ""); 34 bool printMakefileDependencies(std::ostream&, Language, const std::vector<std::string>&, 35 const std::vector<std::string>&, const std::string& = "cpp", 36 const std::string& = ""); 37 38 std::string getFileName(); 39 std::string getBaseName(); 40 41 static std::string addQuotes(const std::string&); 42 static std::string normalizeIncludePath(const std::string&); 43 44 private: 45 46 Preprocessor(const std::string&, const std::string&, const std::vector<std::string>&); 47 48 bool checkInputFile(); 49 50 const std::string _path; 51 const std::string _fileName; 52 const std::string _shortFileName; 53 const std::vector<std::string> _args; 54 std::string _cppFile; 55 FILE* _cppHandle; 56 }; 57 58 } 59 60 #endif 61