COOPY » Guide  version 0.6.5
/home/paulfitz/cvs/coopy_scm/coopy/src/libcoopy_full/include/coopy/PatchParser.h
Go to the documentation of this file.
00001 #ifndef COOPY_PATCHPARSER_INC
00002 #define COOPY_PATCHPARSER_INC
00003 
00004 #include <coopy/Patcher.h>
00005 #include <coopy/Reader.h>
00006 #include <coopy/Property.h>
00007 #include <coopy/FormatSniffer.h>
00008 
00009 #include <string>
00010 
00011 namespace coopy {
00012   namespace cmp {
00013     class PatchParser; 
00014   }
00015 }
00016 
00017 class coopy::cmp::PatchParser {
00018 public:
00019   coopy::format::FormatSniffer sniffer;
00020   Patcher *patcher;
00021   coopy::store::Property config;
00022   std::string fname;
00023   std::string table_name;
00024   std::vector<std::string> oneliners;
00025   bool use_oneliners;
00026   const coopy::cmp::CompareFlags& flags;
00027   coopy::store::TextBook *preread_book;
00028 
00029   PatchParser(Patcher *patcher,
00030              coopy::cmp::CompareFlags& flags) : 
00031     patcher(patcher),
00032     use_oneliners(false),
00033     flags(flags),
00034     preread_book(0/*NULL*/)
00035   {}
00036 
00037   PatchParser(Patcher *patcher,
00038               const std::vector<std::string>& cmd,
00039               coopy::cmp::CompareFlags& flags) : 
00040     patcher(patcher), oneliners(cmd), 
00041     use_oneliners(true),
00042     flags(flags),
00043     preread_book(0/*NULL*/)
00044   {}
00045 
00046   PatchParser(Patcher *patcher,
00047               const std::string& fname,
00048               coopy::cmp::CompareFlags& flags) :
00049     patcher(patcher), fname(fname), 
00050     use_oneliners(false),
00051     flags(flags),
00052     preread_book(0/*NULL*/)
00053   {}
00054 
00055   PatchParser(Patcher *patcher,
00056               coopy::store::TextBook *book,
00057               coopy::cmp::CompareFlags& flags) :
00058     patcher(patcher), fname(""), 
00059     use_oneliners(false),
00060     flags(flags),
00061     preread_book(book)
00062   {}
00063     
00064   // deprecated, undesirable name in python
00065   bool apply();
00066 
00067   bool applyPatch() {
00068     return apply();
00069   }
00070 
00071   bool applyHiliteBook(coopy::store::TextBook& patch);
00072 
00073 private:
00074   bool applyCsv();
00075 
00076   bool applyTdiff();
00077 
00078   bool applyColor();
00079 
00080   void needTable();
00081 };
00082 
00083 #endif
00084 
00085 
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines