summaryrefslogtreecommitdiff
path: root/src/configreader.cpp
blob: 5a5d531715c927009ecfbd3905f5de4d3422966d (plain) (blame)
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
#include <fstream>

#include <configreader.h>

using namespace noos;

configreader::configreader(const std::string& file) : filename(file) {
	reload();
}

configreader::~configreader() { }

const std::vector<std::string>& configreader::get_urls() {
	return urls;
}

void configreader::reload() {
	std::fstream f;
	f.open(filename.c_str(),std::fstream::in);
	if (f.is_open()) {
		std::string line;
		do {
			getline(f,line);
			if (!f.eof())
				urls.push_back(line);
		} while (!f.eof());
	}
}

void configreader::load_config(const std::string& file) {
	filename = file;
	reload();
}