From 01746a0e03267b6c082b58436c1370567f7cb7c5 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sun, 22 Nov 2015 18:49:58 -0500 Subject: Added malapropisms --- freevars.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'freevars.cpp') diff --git a/freevars.cpp b/freevars.cpp index 6472fef..8c3eda4 100644 --- a/freevars.cpp +++ b/freevars.cpp @@ -4,17 +4,17 @@ freevars::freevars() { - vars = new map* >(); + vars = new std::map* >(); } -void freevars::addVar(string name, string filename) +void freevars::addVar(std::string name, std::string filename) { - vector* eltlist = new vector(); + std::vector* eltlist = new std::vector(); - ifstream infile(filename.c_str()); + std::ifstream infile(filename.c_str()); if (infile) { - string line; + std::string line; while (getline(infile, line)) { @@ -27,18 +27,18 @@ void freevars::addVar(string name, string filename) (*vars)[name] = eltlist; } -string freevars::parse(string in) +std::string freevars::parse(std::string in) { - string res(in); + std::string res(in); - for (map* >::iterator it = vars->begin(); it != vars->end(); it++) + for (std::map* >::iterator it = vars->begin(); it != vars->end(); it++) { - string tofind = "$" + it->first + "$"; + std::string tofind = "$" + it->first + "$"; size_t fpos = res.find(tofind); - if (fpos != string::npos) + if (fpos != std::string::npos) { int r = rand() % it->second->size(); - res.replace(fpos, tofind.length(), (*it->second)[r], 0, string::npos); + res.replace(fpos, tofind.length(), (*it->second)[r], 0, std::string::npos); } } -- cgit 1.4.1