-
Notifications
You must be signed in to change notification settings - Fork 5
/
test.cpp
83 lines (62 loc) · 1.82 KB
/
test.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include "WriterFactory.h"
#include "ReaderFactory.h"
#include "ReaderInterface.h"
#include "WriterInterface.h"
int main(int argc, char* argv[])
{
using namespace DoxEngine;
using namespace std;
DebugLog log;
try
{
if (argc != 4)
{
std::cout << "test <infile> <outfile> <repititions>\n";
return 0;
}
int i;
for (i=0; i<atoi(argv[3]); i++)
{
ifstream input(argv[1], fstream::in);
ofstream output(argv[2], fstream::out);
DoxEngine::WriterFactories &writerFactories = DoxEngine::WriterFactoriesSingleton::GetWriterFactories();
DoxEngine::WriterFactories::iterator writerIterator = writerFactories.find(FORMAT_RTF);
DoxEngine::WriterInterface *writer;
if (writerIterator == writerFactories.end())
{
std::cerr << "Internal error initialising writer";
break;
}
else
{
// First type is the key (file format)
// Second type is the value (factory instance)
writer = writerIterator->second->Create(output, log);
}
DoxEngine::ReaderFactories &readerFactories = DoxEngine::ReaderFactoriesSingleton::GetReaderFactories();
DoxEngine::ReaderFactories::iterator readerIterator = readerFactories.find(FORMAT_HTML);
DoxEngine::ReadInterface *reader;
if (readerIterator == readerFactories.end())
{
std::cerr << "Internal error initialising reader";
break;
}
else
{
// First type is the key (file format)
// Second type is the value (factory instance)
reader = readerIterator->second->Create(input, *writer, log);
}
while(reader->processData());
delete reader;
delete writer;
}
}
catch(...)
{
cout<<"Exception occured";
}
}