-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebupdatereader.cpp
40 lines (30 loc) · 923 Bytes
/
webupdatereader.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
#include "webupdatereader.h"
WebUpdateReader::WebUpdateReader(std::string filename, UpdateChecker* uc){
//stream = std::ifstream( filename.c_str());
//std::ifstream s (filename.c_str());
stream.open(filename);
std::string line;
std::cout << "SPAMSPAMSPAM" << std::endl;
while (std::getline(stream, line)){
//Eh, just need to cycle
std::cout << line << std::endl;
}
callback = uc;
}
void WebUpdateReader::checkForUpdates(){
if (stream.eof()){
stream.clear();
}
std::string line;
while(std::getline(stream, line)){
processLine(line);
std::cout << line << std::endl;
}
}
//Assumes well formed input, this is probably dumb.
void WebUpdateReader::processLine(std::string line){
std::size_t split_pos = line.find_first_of("=");
std::string first = line.substr(0, split_pos);
std::string second = line.substr(split_pos+1);
callback->HandleUpdate(first, second);
}