00001 #pragma once
00002
00003 #include <fstream>
00004 #include <string>
00005
00006 #include "OutputFileStream.h"
00007
00008 namespace MosesTraining {
00009 namespace Syntax {
00010
00013 class Tool {
00014 public:
00015 virtual ~Tool() {}
00016
00018 const std::string &name() const { return name_; }
00019
00021 virtual int Main(int argc, char *argv[]) = 0;
00022
00023 protected:
00024 Tool(const std::string &name) : name_(name) {}
00025
00028 static int MosesOptionStyle();
00029
00031 void Warn(const std::string &) const;
00032
00034 void Error(const std::string &msg) const;
00035
00038 void OpenInputFileOrDie(const std::string &, std::ifstream &);
00039
00042 void OpenOutputFileOrDie(const std::string &, std::ofstream &);
00043
00046 void OpenOutputFileOrDie(const std::string &, Moses::OutputFileStream &);
00047
00048 private:
00049 std::string name_;
00050 };
00051
00052 }
00053 }