git repos / oastat

commit 1a221228

sago007 · 2016-05-17 18:09
1a2212288d55ce74c745b8daddb1af1d2e3af8ec patch · browse files
parent 4a7db8e036a093bc5f193c94df93c0defb65d6d5

Removed "using namespace std"

Changed files

M .travis.yml before
M src/db/Db2DbiXX.hpp before
M src/db/Db2Xml.cpp before
M src/db/Db2Xml.hpp before
M src/db/database.hpp before
M src/oastat.cpp before
diff --git a/.travis.yml b/.travis.yml index f182551..7360d25 100644 --- a/.travis.yml +++ b/.travis.yml
@@ -21,7 +21,7 @@ cache:
- cppdb-0.3.1
before_install:
- - mkdir download && cd download
+ - mkdir -p download && cd download
- if [ ! -f cppdb-0.3.1.tar.bz2 ]; then wget --no-verbose http://downloads.sourceforge.net/project/cppcms/cppdb/0.3.1/cppdb-0.3.1.tar.bz2; fi
- cd ..
- if [ ! -d cppdb-0.3.1 ]; then tar xjf download/cppdb-0.3.1.tar.bz2; fi
diff --git a/src/db/Db2DbiXX.hpp b/src/db/Db2DbiXX.hpp index 54cd152..26fb845 100644 --- a/src/db/Db2DbiXX.hpp +++ b/src/db/Db2DbiXX.hpp
@@ -31,7 +31,6 @@ http://code.google.com/p/oastat/
#include <sstream>
#include <set>
-using namespace std;
using namespace dbixx;
class Db2DbiXX : public Database
diff --git a/src/db/Db2Xml.cpp b/src/db/Db2Xml.cpp index 05ee609..de5100c 100644 --- a/src/db/Db2Xml.cpp +++ b/src/db/Db2Xml.cpp
@@ -23,6 +23,10 @@ http://code.google.com/p/oastat/
#include "Db2Xml.hpp"
+using std::cout;
+using std::ofstream;
+using std::string;
+using std::stringstream;
Db2Xml::Db2Xml()
{
@@ -35,10 +39,10 @@ Db2Xml::Db2Xml()
fmkdir % p_output_dir;
int fmkdir_ret = system(fmkdir.str().c_str());
if (fmkdir_ret) {
- cout << "Attemting to create \"" << path << "\" with \"" << fmkdir.str() << "\", but return code was: " << fmkdir_ret << endl;
+ cout << "Attemting to create \"" << path << "\" with \"" << fmkdir.str() << "\", but return code was: " << fmkdir_ret << "\n";
}
}
-Db2Xml::Db2Xml(string dbargs)
+Db2Xml::Db2Xml(std::string dbargs)
{
boost::format path("%1%/oastat");
path % getenv("HOME");
@@ -69,7 +73,7 @@ Db2Xml::Db2Xml(string dbargs)
fmkdir % p_output_dir;
int fmkdir_ret = system(fmkdir.str().c_str());
if (fmkdir_ret) {
- cout << "Attemting to create \"" << path << "\" with \"" << fmkdir.str() << "\", but return code was: " << fmkdir_ret << endl;
+ cout << "Attemting to create \"" << path << "\" with \"" << fmkdir.str() << "\", but return code was: " << fmkdir_ret << "\n";
}
}
Db2Xml::Db2Xml(const Db2Xml& orig)
@@ -116,11 +120,11 @@ void Db2Xml::endGame(int second)
ofstream outfile;
outfile.open (filename.c_str());
if (outfile.fail()) {
- cout << "could not create " << filename << endl;
+ cout << "could not create " << filename << "\n";
}
outfile << p_xmlcontent;
outfile.close();
- cout << "End game at " << second << "with size " << p_xmlcontent.length() << " written to " << filename << endl;
+ cout << "End game at " << second << "with size " << p_xmlcontent.length() << " written to " << filename << "\n";
}
}
int Db2Xml::getGameNumber()
diff --git a/src/db/Db2Xml.hpp b/src/db/Db2Xml.hpp index 40fc19d..5cceb20 100644 --- a/src/db/Db2Xml.hpp +++ b/src/db/Db2Xml.hpp
@@ -40,11 +40,11 @@ class Db2Xml : public Database
{
public:
Db2Xml();
- Db2Xml(string dbargs);
+ Db2Xml(std::string dbargs);
Db2Xml(const Db2Xml& orig);
virtual ~Db2Xml();
void createTables();
- void startGame(int gametype, const string &mapname, const string &basegame, const string &servername, const OaStatStruct &oss);
+ void startGame(int gametype, const std::string &mapname, const std::string &basegame, const std::string &servername, const OaStatStruct &oss);
void addGameCvar(const std::string &cvar, const std::string &value);
void endGame(int second);
int getGameNumber();
@@ -64,22 +64,22 @@ public:
void addGenericTeamEvent(int second, int team, int amount, const std::string &gametype, const std::string &player1, const std::string &player2, int event, int generic1);
void doNotCommit();
private:
- string p_output_dir;
- string p_servername; //Used for filename
+ std::string p_output_dir;
+ std::string p_servername; //Used for filename
tm p_gametime; //Used for filename
- string p_xmlcontent;
- string p_postscript;
+ std::string p_xmlcontent;
+ std::string p_postscript;
bool isOk;
/*
* To make it easier to parse the XML file oastat will generate a unique id for each game
* This is used then converting back to a log file
*/
- map<string,int> psoudo_playerids;
+ std::map<std::string,int> psoudo_playerids;
int nextId;
- int getPsoudoId(const string &guid);
- string getXmlEscaped(const string &org);
+ int getPsoudoId(const std::string &guid);
+ std::string getXmlEscaped(const std::string &org);
};
#endif /* DB2XML_HPP */
diff --git a/src/db/database.hpp b/src/db/database.hpp index 8419478..84f46d1 100644 --- a/src/db/database.hpp +++ b/src/db/database.hpp
@@ -28,8 +28,6 @@ http://code.google.com/p/oastat/
#include <iostream>
#include "../oastatstruct.h"
-using namespace std;
-
/*
This is the class that all database connections need to inherit to be able to recieve data from the program
*/
diff --git a/src/oastat.cpp b/src/oastat.cpp index 4b36ae5..65046d6 100644 --- a/src/oastat.cpp +++ b/src/oastat.cpp
@@ -36,7 +36,10 @@ http://code.google.com/p/oastat/
#include <boost/program_options.hpp>
-using namespace std;
+using std::string;
+using std::vector;
+using std::list;
+using std::ifstream;
#include "db/database.hpp"
#ifdef USEDBIXX
@@ -238,7 +241,7 @@ int main (int argc, const char* argv[])
cout << argv[0] << " -f %APPDATA%/OpenArena/baseoa/games.log --backend \"CppDb\" --dbarg \"sqlite3:db=defoastat.db3\"" << endl;
cout << "tail -f \"~/.openarena/baseoa/games.log\" | "<< argv[0] << " -f \"\" --backend \"Xml\" --dbarg \"outputdir ~/oastat\"" << endl;
cout << endl;
- cout << "Look at http://code.google.com/p/oastat for more help and more details" << endl;
+ cout << "Look at https://github.com/sago007/oastat for more help and more details" << endl;
return 1;
}
if (vm.count("backend")) {