Make custom change printer example more mature
printers.hpp does not depend anymore on includes or usings order inside strdiff_cp.cpp file.
This commit is contained in:
parent
6b030d6397
commit
afddfbccf6
@ -1,23 +1,25 @@
|
||||
#ifndef DTL_PRINTERS
|
||||
#define DTL_PRINTERS
|
||||
|
||||
#include <dtl/dtl.hpp>
|
||||
|
||||
template <typename sesElem, typename stream = ostream >
|
||||
class customChangePrinter : public Printer < sesElem, stream >
|
||||
class customChangePrinter : public dtl::Printer < sesElem, stream >
|
||||
{
|
||||
public :
|
||||
customChangePrinter () : Printer < sesElem, stream > () {}
|
||||
customChangePrinter (stream& out) : Printer < sesElem, stream > (out) {}
|
||||
customChangePrinter () : dtl::Printer < sesElem, stream > () {}
|
||||
customChangePrinter (stream& out) : dtl::Printer < sesElem, stream > (out) {}
|
||||
~customChangePrinter () {}
|
||||
void operator() (const sesElem& se) const {
|
||||
switch (se.second.type) {
|
||||
case SES_ADD:
|
||||
this->out_ << "Add: " << se.first << endl;
|
||||
case dtl::SES_ADD:
|
||||
this->out_ << "Add: " << se.first << std::endl;
|
||||
break;
|
||||
case SES_DELETE:
|
||||
this->out_ << "Delete: " << se.first << endl;
|
||||
case dtl::SES_DELETE:
|
||||
this->out_ << "Delete: " << se.first << std::endl;
|
||||
break;
|
||||
case SES_COMMON:
|
||||
this->out_ << "Common: " << se.first << endl;
|
||||
case dtl::SES_COMMON:
|
||||
this->out_ << "Common: " << se.first << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +1,14 @@
|
||||
|
||||
#include <dtl/dtl.hpp>
|
||||
#include "common.hpp"
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include "printers.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
using dtl::Diff;
|
||||
using dtl::SES_ADD;
|
||||
using dtl::SES_DELETE;
|
||||
using dtl::SES_COMMON;
|
||||
using dtl::Printer;
|
||||
|
||||
#include "printers.hpp"
|
||||
|
||||
int main(int argc, char *argv[]){
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user