-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgramMain.cpp
More file actions
96 lines (81 loc) · 2.64 KB
/
ProgramMain.cpp
File metadata and controls
96 lines (81 loc) · 2.64 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <exception>
#include <cstring>
#include <cassert>
#include "StreamClasses.h"
#include "FilterClasses.h"
#include "SinkClasses.h"
char* testEncodingFuncExample1(char* textData)
{
int length = strlen(textData);
for (int i = 0; i < length; i++)
{
if(*(textData + i) == '1')
{
*(textData + i) = '9';
}
}
return textData;
}
char* testEncodingFuncExample2(char* textData)
{
int length = strlen(textData);
for (int i = 0; i < length; i++)
{
if(*(textData + i) == '9')
{
*(textData + i) = '1';
}
}
return textData;
}
int main()
{
try
{
//test for Stream class
//Stream stream;
//std::cout << "Input text data and terminate by Control + D:\n";
//char* input = stream.readInput();
//test for Filter class
Stream stream("anasfnfkargov\n3adfssa\n2kargovdsfsandf");
Filter filter(stream, "kargov");
std::cout << filter.searchWordInInput() << std::endl;
//test for Sink class
//Sink sinkFilter(&filter);
//sinkFilter.printEverything();
//Sink sinkStream(&stream);
//sinkStream.printEverything();
//test for EmptyStream class
//EmptyStream emptyTextStream;
//std::cout << emptyTextStream.returnEof() << std::endl;
//test for ConstStream class
//ConstStream constantStream("helloworld123");
//test for RandomStream class
//RandomStream randomisedStream(13);
//randomisedStream.changeSymbols("124345");
//test for FileStream class
//FileStream streamFromFile("safyhsfnfadnusf/nafnjasdf");
//test for CopyFilter class
//CopyFilter copyingFilter(stream, "kargov");
//copyingFilter.printOriginalStream();
//test for CapitaliseFilter class
//CapitaliseFilter capitalisedFilterStream(stream, "kargov");
//capitalisedFilterStream.printCapitalisedStream();
//test for FunctionFilter class
//FunctionFilter testStream(stream, "kargov");
//testStream.setEncodingFunction(testEncodingFuncExample1);
//std::cout << testStream.applyEncodingFunction() << std::endl;
//testStream.setEncodingFunction(testEncodingFuncExample2);
//std::cout << testStream.applyEncodingFunction() << std::endl;
//test for FileSink class
//FileSink streamToFile(&stream, "kargovTesting.txt");
//streamToFile.saveTextDataToFile();
}
catch(const std::exception& ex)
{
std::cout << ex.what() << std::endl;
}
return 0;
}