From: <arn...@us...> - 2007-11-18 19:03:41
|
Revision: 92 http://adchpp.svn.sourceforge.net/adchpp/?rev=92&view=rev Author: arnetheduck Date: 2007-11-18 11:03:32 -0800 (Sun, 18 Nov 2007) Log Message: ----------- Don't import std Modified Paths: -------------- adchpp/trunk/SConstruct adchpp/trunk/adchpp/AdcCommand.cpp adchpp/trunk/adchpp/AdcCommand.h adchpp/trunk/adchpp/CID.h adchpp/trunk/adchpp/Client.cpp adchpp/trunk/adchpp/Client.h adchpp/trunk/adchpp/ClientManager.cpp adchpp/trunk/adchpp/ClientManager.h adchpp/trunk/adchpp/Encoder.cpp adchpp/trunk/adchpp/Encoder.h adchpp/trunk/adchpp/Exception.h adchpp/trunk/adchpp/File.cpp adchpp/trunk/adchpp/File.h adchpp/trunk/adchpp/LogManager.cpp adchpp/trunk/adchpp/LogManager.h adchpp/trunk/adchpp/ManagedSocket.cpp adchpp/trunk/adchpp/ManagedSocket.h adchpp/trunk/adchpp/PluginManager.cpp adchpp/trunk/adchpp/PluginManager.h adchpp/trunk/adchpp/Pool.h adchpp/trunk/adchpp/ResourceManager.cpp adchpp/trunk/adchpp/ResourceManager.h adchpp/trunk/adchpp/SettingsManager.cpp adchpp/trunk/adchpp/SettingsManager.h adchpp/trunk/adchpp/Signal.h adchpp/trunk/adchpp/SimpleXML.cpp adchpp/trunk/adchpp/SimpleXML.h adchpp/trunk/adchpp/Socket.cpp adchpp/trunk/adchpp/Socket.h adchpp/trunk/adchpp/SocketManager.cpp adchpp/trunk/adchpp/SocketManager.h adchpp/trunk/adchpp/StringDefs.cpp adchpp/trunk/adchpp/StringDefs.h adchpp/trunk/adchpp/TigerHash.cpp adchpp/trunk/adchpp/Util.cpp adchpp/trunk/adchpp/Util.h adchpp/trunk/adchpp/adchpp.cpp adchpp/trunk/adchpp/adchpp.h adchpp/trunk/adchpp/common.h adchpp/trunk/adchpp/version.cpp adchpp/trunk/adchpp/version.h adchpp/trunk/plugins/Script/src/Engine.h adchpp/trunk/plugins/Script/src/LuaEngine.cpp adchpp/trunk/plugins/Script/src/LuaEngine.h adchpp/trunk/plugins/Script/src/LuaScript.cpp adchpp/trunk/plugins/Script/src/LuaScript.h adchpp/trunk/plugins/Script/src/ScriptManager.cpp adchpp/trunk/plugins/Script/src/ScriptManager.h adchpp/trunk/swig/adchpp.i Modified: adchpp/trunk/SConstruct =================================================================== --- adchpp/trunk/SConstruct 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/SConstruct 2007-11-18 19:03:32 UTC (rev 92) @@ -152,13 +152,11 @@ conf = Configure(env) if conf.CheckCHeader('sys/epoll.h'): - conf.env.Append(CPPDEFINES='HAVE_SYS_EPOLL_H') -if conf.CheckCHeader('sys/poll.h'): - conf.env.Append(CPPDEFINES='HAVE_SYS_POLL_H') + conf.env.Append(CPPDEFINES=['HAVE_SYS_EPOLL_H']) if conf.CheckLib('dl', 'dlopen'): - conf.env.Append(CPPDEFINES='HAVE_DL') + conf.env.Append(CPPDEFINES=['HAVE_DL']) if conf.CheckLib('pthread', 'pthread_create'): - conf.env.Append(CPPDEFINES='HAVE_PTHREAD') + conf.env.Append(CPPDEFINES=['HAVE_PTHREAD']) env = conf.Finish() Modified: adchpp/trunk/adchpp/AdcCommand.cpp =================================================================== --- adchpp/trunk/adchpp/AdcCommand.cpp 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/AdcCommand.cpp 2007-11-18 19:03:32 UTC (rev 92) @@ -21,7 +21,9 @@ #include "AdcCommand.h" namespace adchpp { - + +using namespace std; + AdcCommand::AdcCommand() : cmdInt(0), str(0), from(0), type(0) { } AdcCommand::AdcCommand(Severity sev, Error err, const string& desc, char aType /* = TYPE_INFO */) : cmdInt(CMD_STA), str(&tmp), from(HUB_SID), type(aType) { Modified: adchpp/trunk/adchpp/AdcCommand.h =================================================================== --- adchpp/trunk/adchpp/AdcCommand.h 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/AdcCommand.h 2007-11-18 19:03:32 UTC (rev 92) @@ -105,38 +105,38 @@ uint32_t toCMD(uint8_t a, uint8_t b, uint8_t c) { return (((uint32_t)a) | (((uint32_t)b)<<8) | (((uint32_t)c)<<16)); } ADCHPP_DLL AdcCommand(); - ADCHPP_DLL explicit AdcCommand(Severity sev, Error err, const string& desc, char aType = TYPE_INFO); + ADCHPP_DLL explicit AdcCommand(Severity sev, Error err, const std::string& desc, char aType = TYPE_INFO); explicit AdcCommand(uint32_t cmd, char aType = TYPE_INFO, uint32_t aFrom = HUB_SID) : cmdInt(cmd), str(&tmp), from(aFrom), type(aType) { } - explicit AdcCommand(const string& aLine) throw(ParseException) : cmdInt(0), str(&aLine), type(0) { parse(aLine); } + explicit AdcCommand(const std::string& aLine) throw(ParseException) : cmdInt(0), str(&aLine), type(0) { parse(aLine); } AdcCommand(const AdcCommand& rhs) : parameters(rhs.parameters), cmdInt(rhs.cmdInt), str(&tmp), from(rhs.from), to(rhs.to), type(rhs.type) { } - ADCHPP_DLL void parse(const string& aLine) throw(ParseException); + ADCHPP_DLL void parse(const std::string& aLine) throw(ParseException); uint32_t getCommand() const { return cmdInt; } char getType() const { return type; } StringList& getParameters() { return parameters; } const StringList& getParameters() const { return parameters; } - ADCHPP_DLL const string& toString() const; + ADCHPP_DLL const std::string& toString() const; void resetString() { tmp.clear(); str = &tmp; } - AdcCommand& addParam(const string& name, const string& value) { + AdcCommand& addParam(const std::string& name, const std::string& value) { parameters.push_back(name); parameters.back() += value; return *this; } - AdcCommand& addParam(const string& param) { + AdcCommand& addParam(const std::string& param) { parameters.push_back(param); return *this; } - const string& getParam(size_t n) const { + const std::string& getParam(size_t n) const { return getParameters().size() > n ? getParameters()[n] : Util::emptyString; } - const string& getFeatures() const { return features; } + const std::string& getFeatures() const { return features; } /** Return a named parameter where the name is a two-letter code */ - ADCHPP_DLL bool getParam(const char* name, size_t start, string& ret) const; + ADCHPP_DLL bool getParam(const char* name, size_t start, std::string& ret) const; ADCHPP_DLL bool delParam(const char* name, size_t start); ADCHPP_DLL bool hasFlag(const char* name, size_t start) const; @@ -144,28 +144,28 @@ bool operator==(uint32_t aCmd) const { return cmdInt == aCmd; } - ADCHPP_DLL static void escape(const string& s, string& out); + ADCHPP_DLL static void escape(const std::string& s, std::string& out); uint32_t getTo() const { return to; } void setTo(uint32_t aTo) { to = aTo; } uint32_t getFrom() const { return from; } void setFrom(uint32_t aFrom) { from = aFrom; } - static uint32_t toSID(const string& aSID) { return *reinterpret_cast<const uint32_t*>(aSID.data()); } - static string fromSID(const uint32_t aSID) { return string(reinterpret_cast<const char*>(&aSID), sizeof(aSID)); } - static void appendSID(string& str, uint32_t aSID) { str.append(reinterpret_cast<const char*>(&aSID), sizeof(aSID)); } + static uint32_t toSID(const std::string& aSID) { return *reinterpret_cast<const uint32_t*>(aSID.data()); } + static std::string fromSID(const uint32_t aSID) { return std::string(reinterpret_cast<const char*>(&aSID), sizeof(aSID)); } + static void appendSID(std::string& str, uint32_t aSID) { str.append(reinterpret_cast<const char*>(&aSID), sizeof(aSID)); } private: AdcCommand& operator=(const AdcCommand&); StringList parameters; - string features; + std::string features; union { char cmdChar[4]; uint8_t cmd[4]; uint32_t cmdInt; }; - const string* str; - mutable string tmp; + const std::string* str; + mutable std::string tmp; uint32_t from; uint32_t to; Modified: adchpp/trunk/adchpp/CID.h =================================================================== --- adchpp/trunk/adchpp/CID.h 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/CID.h 2007-11-18 19:03:32 UTC (rev 92) @@ -38,18 +38,18 @@ }; CID() { memset(cid, 0, sizeof(cid)); } explicit CID(const uint8_t* data) { memcpy(cid, data, sizeof(cid)); } - explicit CID(const string& base32) { Encoder::fromBase32(base32.c_str(), cid, sizeof(cid)); } + explicit CID(const std::string& base32) { Encoder::fromBase32(base32.c_str(), cid, sizeof(cid)); } bool operator==(const CID& rhs) const { return memcmp(cid, rhs.cid, sizeof(cid)) == 0; } bool operator<(const CID& rhs) const { return memcmp(cid, rhs.cid, sizeof(cid)) < 0; } - string toBase32() const { return Encoder::toBase32(cid, sizeof(cid)); } - string& toBase32(string& tmp) const { return Encoder::toBase32(cid, sizeof(cid), tmp); } + std::string toBase32() const { return Encoder::toBase32(cid, sizeof(cid)); } + std::string& toBase32(std::string& tmp) const { return Encoder::toBase32(cid, sizeof(cid), tmp); } size_t toHash() const { return *reinterpret_cast<const size_t*>(cid); } const uint8_t* data() const { return cid; } - bool isZero() const { return find_if(cid, cid+SIZE, bind2nd(not_equal_to<uint8_t>(), 0)) == (cid+SIZE); } + bool isZero() const { return std::find_if(cid, cid+SIZE, std::bind2nd(std::not_equal_to<uint8_t>(), 0)) == (cid+SIZE); } static CID generate() { uint8_t data[CID::SIZE]; Modified: adchpp/trunk/adchpp/Client.cpp =================================================================== --- adchpp/trunk/adchpp/Client.cpp 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/Client.cpp 2007-11-18 19:03:32 UTC (rev 92) @@ -26,6 +26,7 @@ namespace adchpp { +using namespace std; using namespace std::tr1::placeholders; Client* Client::create(const ManagedSocketPtr& ms) throw() { Modified: adchpp/trunk/adchpp/Client.h =================================================================== --- adchpp/trunk/adchpp/Client.h 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/Client.h 2007-11-18 19:03:32 UTC (rev 92) @@ -65,17 +65,17 @@ static Client* create(const ManagedSocketPtr& ms_) throw(); const StringList& getSupportList() const throw() { return supportList; } - bool supports(const string& feat) const throw() { return find(supportList.begin(), supportList.end(), feat) != supportList.end(); } + bool supports(const std::string& feat) const throw() { return find(supportList.begin(), supportList.end(), feat) != supportList.end(); } void send(const char* command, size_t len) throw() { dcassert(socket != NULL); socket->write(command, len); } void send(const AdcCommand& cmd) throw() { send(cmd.toString()); } - void send(const string& command) throw() { send(command.c_str(), command.length()); } + void send(const std::string& command) throw() { send(command.c_str(), command.length()); } void send(const char* command) throw() { socket->write(command, strlen(command)); } - void fastSend(const string& command, bool lowPrio = false) throw() { + void fastSend(const std::string& command, bool lowPrio = false) throw() { socket->fastWrite(command.c_str(), command.length(), lowPrio); } size_t getQueuedBytes() throw() { return socket->getQueuedBytes(); } @@ -84,7 +84,7 @@ ADCHPP_DLL void disconnect(Util::Reason reason) throw(); const ManagedSocketPtr& getSocket() throw() { return socket; } const ManagedSocketPtr& getSocket() const throw() { return socket; } - const string& getIp() const throw() { dcassert(socket != NULL); return getSocket()->getIp(); } + const std::string& getIp() const throw() { dcassert(socket != NULL); return getSocket()->getIp(); } /** * Set data mode for aBytes bytes. @@ -96,12 +96,12 @@ /** Add any flags that have been updated to the AdcCommand (type etc is not set) */ ADCHPP_DLL bool getChangedFields(AdcCommand& cmd) const throw(); ADCHPP_DLL bool getAllFields(AdcCommand& cmd) const throw(); - ADCHPP_DLL const string& getINF() const throw(); + ADCHPP_DLL const std::string& getINF() const throw(); void resetChanged() { changed.clear(); } - const string& getField(const char* name) const throw() { InfMap::const_iterator i = info.find(AdcCommand::toCode(name)); return i == info.end() ? Util::emptyString : i->second; } - ADCHPP_DLL void setField(const char* name, const string& value) throw(); + const std::string& getField(const char* name) const throw() { InfMap::const_iterator i = info.find(AdcCommand::toCode(name)); return i == info.end() ? Util::emptyString : i->second; } + ADCHPP_DLL void setField(const char* name, const std::string& value) throw(); ADCHPP_DLL void updateFields(const AdcCommand& cmd) throw(); ADCHPP_DLL void updateSupports(const AdcCommand& cmd) throw(); @@ -150,11 +150,11 @@ StringList filters; /** H-C SUP */ StringList supportList; - typedef pair<int, void*> PSDPair; - typedef vector<PSDPair> PSDList; + typedef std::pair<int, void*> PSDPair; + typedef std::vector<PSDPair> PSDList; typedef PSDList::iterator PSDIter; - typedef std::tr1::unordered_map<uint16_t, string> InfMap; + typedef std::tr1::unordered_map<uint16_t, std::string> InfMap; typedef InfMap::iterator InfIter; InfMap info; @@ -168,14 +168,14 @@ bool disconnecting; PSDList psd; - string line; + std::string line; ManagedSocketPtr socket; int64_t dataBytes; time_t floodTimer; /** Latest INF cached */ - mutable string INF; + mutable std::string INF; DataFunction dataHandler; void setSocket(const ManagedSocketPtr& aSocket) throw(); Modified: adchpp/trunk/adchpp/ClientManager.cpp =================================================================== --- adchpp/trunk/adchpp/ClientManager.cpp 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/ClientManager.cpp 2007-11-18 19:03:32 UTC (rev 92) @@ -31,7 +31,9 @@ #include "SettingsManager.h" namespace adchpp { - + +using namespace std; + ClientManager* ClientManager::instance = 0; const string ClientManager::className = "ClientManager"; Modified: adchpp/trunk/adchpp/ClientManager.h =================================================================== --- adchpp/trunk/adchpp/ClientManager.h 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/ClientManager.h 2007-11-18 19:03:32 UTC (rev 92) @@ -45,14 +45,14 @@ typedef ClientMap::iterator ClientIter; /** Adds a string to SUP, propagating the change to all connected clients */ - ADCHPP_DLL void addSupports(const string& str) throw(); + ADCHPP_DLL void addSupports(const std::string& str) throw(); /** Removes a string from SUP, propagating the change to all connected clients */ - ADCHPP_DLL void removeSupports(const string& str) throw(); + ADCHPP_DLL void removeSupports(const std::string& str) throw(); ADCHPP_DLL void updateCache() throw(); /** @return SID of client or 0 if not found */ - ADCHPP_DLL uint32_t getSID(const string& nick) const throw(); + ADCHPP_DLL uint32_t getSID(const std::string& nick) const throw(); /** @return SID of client or 0 if not found */ ADCHPP_DLL uint32_t getSID(const CID& cid) const throw(); @@ -71,7 +71,7 @@ ADCHPP_DLL void send(const AdcCommand& cmd, bool lowPrio = false) throw(); /** Send command to all regardless of type */ void sendToAll(const AdcCommand& cmd) throw() { sendToAll(cmd.toString()); } - ADCHPP_DLL void sendToAll(const string& cmd) throw(); + ADCHPP_DLL void sendToAll(const std::string& cmd) throw(); /** Send command to a single client regardless of type */ ADCHPP_DLL void sendTo(const AdcCommand& cmd, const uint32_t& to) throw(); @@ -97,7 +97,7 @@ * @param sendData Send GPA. * @return The random data that was sent to the client (if sendData was true, undefined otherwise). */ - ADCHPP_DLL vector<uint8_t> enterVerify(Client& c, bool sendData) throw(); + ADCHPP_DLL ByteVector enterVerify(Client& c, bool sendData) throw(); /** * Enter NORMAL state. Call this if you stop an INF of a password-less @@ -129,7 +129,7 @@ /** * Verify password */ - ADCHPP_DLL bool verifyPassword(Client& c, const string& password, const vector<uint8_t>& salt, const string& suppliedHash); + ADCHPP_DLL bool verifyPassword(Client& c, const std::string& password, const ByteVector& salt, const std::string& suppliedHash); /** * Verify that IP is correct and replace any zero addresses. @@ -157,7 +157,7 @@ typedef SignalTraits<void (Client&)> SignalConnected; typedef SignalTraits<void (Client&, AdcCommand&, int&)> SignalReceive; - typedef SignalTraits<void (Client&, const string&)> SignalBadLine; + typedef SignalTraits<void (Client&, const std::string&)> SignalBadLine; typedef SignalTraits<void (Client&, AdcCommand&, int&)> SignalSend; typedef SignalTraits<void (Client&, int)> SignalState; typedef SignalTraits<void (Client&)> SignalDisconnected; @@ -177,10 +177,10 @@ */ StringList supports; - deque<pair<Client*, time_t> > logins; + std::deque<std::pair<Client*, time_t> > logins; ClientMap clients; - typedef std::tr1::unordered_map<string, uint32_t> NickMap; + typedef std::tr1::unordered_map<std::string, uint32_t> NickMap; NickMap nicks; typedef std::tr1::unordered_map<CID, uint32_t, CID::Hash> CIDMap; CIDMap cids; @@ -188,14 +188,14 @@ SIDSet sids; // Temporary string to use whenever a temporary string is needed (to avoid (de)allocating memory all the time...) - string strtmp; + std::string strtmp; - static const string className; + static const std::string className; // Strings used in various places along the pipeline...rebuilt in updateCache()... struct Strings { - string sup; - string inf; + std::string sup; + std::string inf; } strings; friend class Singleton<ClientManager>; @@ -216,7 +216,7 @@ void onConnected(Client&) throw(); void onReceive(Client&, AdcCommand&) throw(); - void onBadLine(Client&, const string&) throw(); + void onBadLine(Client&, const std::string&) throw(); void onFailed(Client&) throw(); void badState(Client& c, const AdcCommand& cmd) throw(); Modified: adchpp/trunk/adchpp/Encoder.cpp =================================================================== --- adchpp/trunk/adchpp/Encoder.cpp 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/Encoder.cpp 2007-11-18 19:03:32 UTC (rev 92) @@ -22,7 +22,9 @@ #include "common.h" namespace adchpp { - + +using namespace std; + const int8_t Encoder::base32Table[256] = { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, Modified: adchpp/trunk/adchpp/Encoder.h =================================================================== --- adchpp/trunk/adchpp/Encoder.h 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/Encoder.h 2007-11-18 19:03:32 UTC (rev 92) @@ -24,9 +24,9 @@ class Encoder { public: - ADCHPP_DLL static string& toBase32(const uint8_t* src, size_t len, string& tgt); - static string toBase32(const uint8_t* src, size_t len) { - string tmp; + ADCHPP_DLL static std::string& toBase32(const uint8_t* src, size_t len, std::string& tgt); + static std::string toBase32(const uint8_t* src, size_t len) { + std::string tmp; return toBase32(src, len, tmp); } ADCHPP_DLL static void fromBase32(const char* src, uint8_t* dst, size_t len); Modified: adchpp/trunk/adchpp/Exception.h =================================================================== --- adchpp/trunk/adchpp/Exception.h 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/Exception.h 2007-11-18 19:03:32 UTC (rev 92) @@ -23,17 +23,17 @@ namespace adchpp { -class ADCHPP_VISIBLE Exception : public exception +class ADCHPP_VISIBLE Exception : public std::exception { public: Exception() { } - Exception(const string& aError) throw() : error(aError) { dcdebug("Thrown: %s\n", error.c_str()); } + Exception(const std::string& aError) throw() : error(aError) { dcdebug("Thrown: %s\n", error.c_str()); } virtual ~Exception() throw() { } - const string& getError() const throw() { return error; } + const std::string& getError() const throw() { return error; } virtual const char* what() { return error.c_str(); } protected: - string error; + std::string error; }; #ifndef NDEBUG @@ -41,7 +41,7 @@ #define STANDARD_EXCEPTION(name) class ADCHPP_VISIBLE name : public Exception { \ public:\ name() throw() : Exception(#name) { } \ - name(const string& aError) throw() : Exception(#name ": " + aError) { } \ + name(const std::string& aError) throw() : Exception(#name ": " + aError) { } \ virtual ~name() throw() { } \ } Modified: adchpp/trunk/adchpp/File.cpp =================================================================== --- adchpp/trunk/adchpp/File.cpp 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/File.cpp 2007-11-18 19:03:32 UTC (rev 92) @@ -21,7 +21,9 @@ #include "File.h" namespace adchpp { - + +using namespace std; + string File::read(uint32_t len) throw(FileException) { string tmp; tmp.resize(len); Modified: adchpp/trunk/adchpp/File.h =================================================================== --- adchpp/trunk/adchpp/File.h 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/File.h 2007-11-18 19:03:32 UTC (rev 92) @@ -46,24 +46,24 @@ TRUNCATE = 0x04 }; - ADCHPP_DLL File(const string& aFileName, int access, int mode = OPEN) throw(FileException); + ADCHPP_DLL File(const std::string& aFileName, int access, int mode = OPEN) throw(FileException); ADCHPP_DLL int64_t getSize(); - ADCHPP_DLL static int64_t getSize(const string& aFileName); + ADCHPP_DLL static int64_t getSize(const std::string& aFileName); - ADCHPP_DLL string read(uint32_t len) throw(FileException); + ADCHPP_DLL std::string read(uint32_t len) throw(FileException); /** Returns the directory part of the full path */ - ADCHPP_DLL static string getFilePath(const string& name) throw(); + ADCHPP_DLL static std::string getFilePath(const std::string& name) throw(); /** Returns the filename part of the full path */ - ADCHPP_DLL static string getFileName(const string& name) throw(); - ADCHPP_DLL static bool isAbsolutePath(const string& name) throw(); + ADCHPP_DLL static std::string getFileName(const std::string& name) throw(); + ADCHPP_DLL static bool isAbsolutePath(const std::string& name) throw(); - static string makeAbsolutePath(string const& path, string const& filename) { + static std::string makeAbsolutePath(const std::string& path, const std::string& filename) { return isAbsolutePath(filename) ? filename : path + filename; } - ADCHPP_DLL static void ensureDirectory(const string& aFile) throw(); + ADCHPP_DLL static void ensureDirectory(const std::string& aFile) throw(); #ifdef _WIN32 void close() { @@ -159,8 +159,8 @@ void setEOF() throw(FileException) { } - static void deleteFile(const string& aFileName) { ::unlink(aFileName.c_str()); }; - static void renameFile(const string& source, const string& target) { ::rename(source.c_str(), target.c_str()); }; + static void deleteFile(const std::string& aFileName) { ::unlink(aFileName.c_str()); }; + static void renameFile(const std::string& source, const std::string& target) { ::rename(source.c_str(), target.c_str()); }; #endif // WIN32 @@ -168,12 +168,12 @@ close(); } - string read() throw(FileException) { + std::string read() throw(FileException) { setPos(0); return read((uint32_t)getSize()); } - void write(const string& aString) throw(FileException) { + void write(const std::string& aString) throw(FileException) { write((void*)aString.data(), aString.size()); } Modified: adchpp/trunk/adchpp/LogManager.cpp =================================================================== --- adchpp/trunk/adchpp/LogManager.cpp 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/LogManager.cpp 2007-11-18 19:03:32 UTC (rev 92) @@ -25,6 +25,8 @@ namespace adchpp { +using namespace std; + LogManager* LogManager::instance = 0; void LogManager::logDateTime(const string& area, const string& msg) throw() Modified: adchpp/trunk/adchpp/LogManager.h =================================================================== --- adchpp/trunk/adchpp/LogManager.h 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/LogManager.h 2007-11-18 19:03:32 UTC (rev 92) @@ -35,8 +35,8 @@ * @param area Name of the module that generated the error. * @param msg Message to log. */ - void log(const string& area, const string& msg) throw() { - string tmp(area); + void log(const std::string& area, const std::string& msg) throw() { + std::string tmp(area); tmp += ": "; tmp += msg; dolog(tmp); @@ -46,7 +46,7 @@ * Same as log, but prepends the current date and time. * @see log */ - ADCHPP_DLL void logDateTime(const string& area, const string& msg) throw(); + ADCHPP_DLL void logDateTime(const std::string& area, const std::string& msg) throw(); private: friend class Singleton<LogManager>; ADCHPP_DLL static LogManager* instance; @@ -55,7 +55,7 @@ LogManager() throw() { } virtual ~LogManager() throw() { } - ADCHPP_DLL void dolog(const string& msg) throw(); + ADCHPP_DLL void dolog(const std::string& msg) throw(); }; #define LOG(area, msg) LogManager::getInstance()->log(area, msg) Modified: adchpp/trunk/adchpp/ManagedSocket.cpp =================================================================== --- adchpp/trunk/adchpp/ManagedSocket.cpp 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/ManagedSocket.cpp 2007-11-18 19:03:32 UTC (rev 92) @@ -27,6 +27,8 @@ namespace adchpp { +using namespace std; + FastMutex ManagedSocket::writeMutex; ManagedSocket::ManagedSocket() throw() : outBuf(0), overFlow(0), disc(0) Modified: adchpp/trunk/adchpp/ManagedSocket.h =================================================================== --- adchpp/trunk/adchpp/ManagedSocket.h 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/ManagedSocket.h 2007-11-18 19:03:32 UTC (rev 92) @@ -52,8 +52,8 @@ /** Asynchronous disconnect. Pending data will be written, but no more data will be read. */ ADCHPP_DLL void disconnect(Util::Reason reason) throw(); - const string& getIp() const { return ip; } - void setIp(const string& ip_) { ip = ip_; } + const std::string& getIp() const { return ip; } + void setIp(const std::string& ip_) { ip = ip_; } typedef std::tr1::function<void()> ConnectedHandler; void setConnectedHandler(const ConnectedHandler& handler) { connectedHandler = handler; } @@ -98,7 +98,7 @@ /** Disconnection scheduled for this socket */ uint32_t disc; - string ip; + std::string ip; #ifdef _WIN32 /** Data currently being sent by WSASend, 0 if not sending */ ByteVector* writeBuf; Modified: adchpp/trunk/adchpp/PluginManager.cpp =================================================================== --- adchpp/trunk/adchpp/PluginManager.cpp 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/PluginManager.cpp 2007-11-18 19:03:32 UTC (rev 92) @@ -27,8 +27,6 @@ #include "version.h" #include "File.h" -using namespace std::tr1::placeholders; - #ifdef _WIN32 #define PLUGIN_EXT _T(".dll") @@ -53,6 +51,9 @@ namespace adchpp { +using namespace std; +using namespace std::tr1::placeholders; + PluginManager* PluginManager::instance = 0; const string PluginManager::className = "PluginManager"; Modified: adchpp/trunk/adchpp/PluginManager.h =================================================================== --- adchpp/trunk/adchpp/PluginManager.h 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/PluginManager.h 2007-11-18 19:03:32 UTC (rev 92) @@ -143,7 +143,7 @@ class PluginManager : public Singleton<PluginManager> { public: - typedef std::tr1::unordered_map<string, Plugin*> Registry; + typedef std::tr1::unordered_map<std::string, Plugin*> Registry; typedef Registry::iterator RegistryIter; /** @@ -156,7 +156,7 @@ /** * Get the plugin path as set in adchpp.xml */ - const string& getPluginPath() const { + const std::string& getPluginPath() const { return pluginPath; } @@ -173,19 +173,19 @@ * Register a plugin interface under a name. * @return false if name was already registered and call fails */ - bool registerPlugin(const string& name, Plugin* ptr) { - return registry.insert(make_pair(name, ptr)).second; + bool registerPlugin(const std::string& name, Plugin* ptr) { + return registry.insert(std::make_pair(name, ptr)).second; } /** @return True if the plugin existed and was thus unregistered */ - bool unregisterPlugin(const string& name) { + bool unregisterPlugin(const std::string& name) { return registry.erase(name) > 0; } /** * @return Plugin interface, or NULL if not found */ - Plugin* getPlugin(const string& name) { + Plugin* getPlugin(const std::string& name) { RegistryIter i = registry.find(name); return i == registry.end() ? NULL : i->second; } @@ -224,22 +224,22 @@ friend class Singleton<PluginManager>; ADCHPP_DLL static PluginManager* instance; - typedef vector<PluginInfo> PluginList; + typedef std::vector<PluginInfo> PluginList; typedef PluginList::iterator PluginIter; PluginList active; Registry registry; StringList plugins; - string pluginPath; + std::string pluginPath; int pluginIds; - static const string className; + static const std::string className; PluginManager() throw(); - bool loadPlugin(const string& file); + bool loadPlugin(const std::string& file); void onLoad(const SimpleXML& xml) throw(); }; Modified: adchpp/trunk/adchpp/Pool.h =================================================================== --- adchpp/trunk/adchpp/Pool.h 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/Pool.h 2007-11-18 19:03:32 UTC (rev 92) @@ -64,7 +64,7 @@ private: size_t busy; - vector<T*> free; + std::vector<T*> free; }; Modified: adchpp/trunk/adchpp/ResourceManager.cpp =================================================================== --- adchpp/trunk/adchpp/ResourceManager.cpp 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/ResourceManager.cpp 2007-11-18 19:03:32 UTC (rev 92) @@ -26,6 +26,9 @@ namespace adchpp { +using namespace std; +using namespace std::tr1; + ResourceManager* ResourceManager::instance = 0; const string ResourceManager::className = "ResourceManager"; @@ -35,7 +38,7 @@ SimpleXML xml; xml.fromXML(f.read()); - std::tr1::unordered_map<string, int> h; + unordered_map<string, int> h; for(int i = 0; i < LAST; ++i) { h[names[i]] = i; @@ -47,7 +50,7 @@ xml.stepIn(); while(xml.findChild("String")) { - std::tr1::unordered_map<string, int>::iterator j = h.find(xml.getChildAttrib("Name")); + unordered_map<string, int>::iterator j = h.find(xml.getChildAttrib("Name")); if(j != h.end()) { strings[j->second] = xml.getChildData(); Modified: adchpp/trunk/adchpp/ResourceManager.h =================================================================== --- adchpp/trunk/adchpp/ResourceManager.h 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/ResourceManager.h 2007-11-18 19:03:32 UTC (rev 92) @@ -31,8 +31,8 @@ #include "StringDefs.h" - void loadLanguage(const string& aFile); - const string& getString(Strings x) const { return strings[x]; } + void loadLanguage(const std::string& aFile); + const std::string& getString(Strings x) const { return strings[x]; } private: @@ -43,10 +43,10 @@ ResourceManager() throw() { } virtual ~ResourceManager() throw() { } - ADCHPP_DLL static string strings[LAST]; - static string names[LAST]; + ADCHPP_DLL static std::string strings[LAST]; + static std::string names[LAST]; - static const string className; + static const std::string className; }; #define STRING(x) ResourceManager::getInstance()->getString(ResourceManager::x) Modified: adchpp/trunk/adchpp/SettingsManager.cpp =================================================================== --- adchpp/trunk/adchpp/SettingsManager.cpp 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/SettingsManager.cpp 2007-11-18 19:03:32 UTC (rev 92) @@ -27,6 +27,8 @@ namespace adchpp { +using namespace std; + SettingsManager* SettingsManager::instance = 0; const string SettingsManager::className = "SettingsManager"; Modified: adchpp/trunk/adchpp/SettingsManager.h =================================================================== --- adchpp/trunk/adchpp/SettingsManager.h 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/SettingsManager.h 2007-11-18 19:03:32 UTC (rev 92) @@ -63,9 +63,9 @@ * Get the XML name of a setting * @param n Setting identifier */ - const string& getName(int n) { dcassert(n < SETTINGS_LAST); return settingTags[n]; } + const std::string& getName(int n) { dcassert(n < SETTINGS_LAST); return settingTags[n]; } - const string& get(StrSetting key) const { + const std::string& get(StrSetting key) const { return strSettings[key - STR_FIRST]; } @@ -80,7 +80,7 @@ return (get(key) > 0); } - void set(StrSetting key, string const& value) { + void set(StrSetting key, const std::string& value) { strSettings[key - STR_FIRST] = value; } @@ -109,7 +109,7 @@ load(Util::getCfgPath() + _T("adchpp.xml")); } - void load(const string& aFileName); + void load(const std::string& aFileName); typedef SignalTraits<void (const SimpleXML&)> SignalLoad; SignalLoad::Signal& signalLoad() { return signalLoad_; } @@ -120,12 +120,12 @@ SettingsManager() throw(); virtual ~SettingsManager() throw() { } - ADCHPP_DLL static const string settingTags[SETTINGS_LAST+1]; + ADCHPP_DLL static const std::string settingTags[SETTINGS_LAST+1]; - static const string className; + static const std::string className; - string strSettings[STR_LAST - STR_FIRST]; - int intSettings[INT_LAST - INT_FIRST]; + std::string strSettings[STR_LAST - STR_FIRST]; + int intSettings[INT_LAST - INT_FIRST]; int64_t int64Settings[/*INT64_LAST - INT64_FIRST*/1]; SignalLoad::Signal signalLoad_; Modified: adchpp/trunk/adchpp/Signal.h =================================================================== --- adchpp/trunk/adchpp/Signal.h 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/Signal.h 2007-11-18 19:03:32 UTC (rev 92) @@ -26,7 +26,7 @@ template<typename F> struct Signal { typedef std::tr1::function<F> Slot; - typedef list<Slot> SlotList; + typedef std::list<Slot> SlotList; typedef typename SlotList::iterator Connection; typedef F FunctionType; Modified: adchpp/trunk/adchpp/SimpleXML.cpp =================================================================== --- adchpp/trunk/adchpp/SimpleXML.cpp 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/SimpleXML.cpp 2007-11-18 19:03:32 UTC (rev 92) @@ -22,6 +22,8 @@ namespace adchpp { +using namespace std; + SimpleXML::SimpleXML(int numAttribs) : attribs(numAttribs), found(false) { root = current = new Tag("BOGUSROOT", Util::emptyString, NULL); } Modified: adchpp/trunk/adchpp/SimpleXML.h =================================================================== --- adchpp/trunk/adchpp/SimpleXML.h 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/SimpleXML.h 2007-11-18 19:03:32 UTC (rev 92) @@ -36,34 +36,28 @@ ADCHPP_DLL SimpleXML(int numAttribs = 0); ADCHPP_DLL ~SimpleXML(); - ADCHPP_DLL void addTag(const string& aName, const string& aData = Util::emptyString) throw(SimpleXMLException); - void addTag(const string& aName, int aData) throw(SimpleXMLException) { + ADCHPP_DLL void addTag(const std::string& aName, const std::string& aData = Util::emptyString) throw(SimpleXMLException); + void addTag(const std::string& aName, int aData) throw(SimpleXMLException) { addTag(aName, Util::toString(aData)); } - void addTag(const string& aName, int64_t aData) throw(SimpleXMLException) { + void addTag(const std::string& aName, int64_t aData) throw(SimpleXMLException) { addTag(aName, Util::toString(aData)); } template<typename T> - void addAttrib(const string& aName, const T& aData) throw(SimpleXMLException) { + void addAttrib(const std::string& aName, const T& aData) throw(SimpleXMLException) { addAttrib(aName, Util::toString(aData)); } - ADCHPP_DLL void addAttrib(const string& aName, const string& aData) throw(SimpleXMLException); - void addAttrib(const string& aName, bool aData) throw(SimpleXMLException) { - addAttrib(aName, string(aData ? "1" : "0")); - } + ADCHPP_DLL void addAttrib(const std::string& aName, const std::string& aData) throw(SimpleXMLException); template <typename T> - void addChildAttrib(const string& aName, const T& aData) throw(SimpleXMLException) { + void addChildAttrib(const std::string& aName, const T& aData) throw(SimpleXMLException) { addChildAttrib(aName, Util::toString(aData)); } - ADCHPP_DLL void addChildAttrib(const string& aName, const string& aData) throw(SimpleXMLException); - void addChildAttrib(const string& aName, bool aData) throw(SimpleXMLException) { - addChildAttrib(aName, string(aData ? "1" : "0")); - } + ADCHPP_DLL void addChildAttrib(const std::string& aName, const std::string& aData) throw(SimpleXMLException); - const string& getData() const { + const std::string& getData() const { dcassert(current != NULL); return current->data; } @@ -77,53 +71,53 @@ currentChild = current->children.begin(); } - ADCHPP_DLL bool findChild(const string& aName) const throw(); + ADCHPP_DLL bool findChild(const std::string& aName) const throw(); - const string& getChildData() const throw(SimpleXMLException) { + const std::string& getChildData() const throw(SimpleXMLException) { checkChildSelected(); return (*currentChild)->data; } - const string& getChildAttrib(const string& aName, const string& aDefault = Util::emptyString) const throw(SimpleXMLException) { + const std::string& getChildAttrib(const std::string& aName, const std::string& aDefault = Util::emptyString) const throw(SimpleXMLException) { checkChildSelected(); return (*currentChild)->getAttrib(aName, aDefault); } - int getIntChildAttrib(const string& aName) throw(SimpleXMLException) { + int getIntChildAttrib(const std::string& aName) throw(SimpleXMLException) { checkChildSelected(); return Util::toInt(getChildAttrib(aName)); } - int64_t getLongLongChildAttrib(const string& aName) throw(SimpleXMLException) { + int64_t getLongLongChildAttrib(const std::string& aName) throw(SimpleXMLException) { checkChildSelected(); return Util::toInt64(getChildAttrib(aName)); } - bool getBoolChildAttrib(const string& aName) throw(SimpleXMLException) { + bool getBoolChildAttrib(const std::string& aName) throw(SimpleXMLException) { checkChildSelected(); - const string& tmp = getChildAttrib(aName); + const std::string& tmp = getChildAttrib(aName); return (tmp.size() > 0) && tmp[0] == '1'; } - ADCHPP_DLL void fromXML(const string& aXML) throw(SimpleXMLException); - string toXML() { return (!root->children.empty()) ? root->children[0]->toXML(0) : Util::emptyString; } + ADCHPP_DLL void fromXML(const std::string& aXML) throw(SimpleXMLException); + std::string toXML() { return (!root->children.empty()) ? root->children[0]->toXML(0) : Util::emptyString; } - ADCHPP_DLL static void escape(string& aString, bool aAttrib, bool aLoading = false); + ADCHPP_DLL static void escape(std::string& aString, bool aAttrib, bool aLoading = false); /** * This is a heurestic for whether escape needs to be called or not. The results are * only guaranteed for false, i e sometimes true might be returned even though escape * was not needed... */ - static bool needsEscape(const string& aString, bool aAttrib, bool aLoading = false) { - return ((aLoading) ? aString.find('&') : aString.find_first_of(aAttrib ? "<&>'\"" : "<&>")) != string::npos; + static bool needsEscape(const std::string& aString, bool aAttrib, bool aLoading = false) { + return ((aLoading) ? aString.find('&') : aString.find_first_of(aAttrib ? "<&>'\"" : "<&>")) != std::string::npos; } private: class Tag { public: typedef Tag* Ptr; - typedef vector<Ptr> List; + typedef std::vector<Ptr> List; typedef List::iterator Iter; - typedef pair<string,string> StringPair; - typedef vector<StringPair> AttribMap; + typedef std::pair<std::string, std::string> StringPair; + typedef std::vector<StringPair> AttribMap; typedef AttribMap::iterator AttribIter; /** @@ -139,29 +133,29 @@ AttribMap attribs; /** Tag name */ - string name; + std::string name; /** Tag data, may be empty. */ - string data; + std::string data; /** Parent tag, for easy traversal */ Ptr parent; - Tag(const string& aName, const string& aData, Ptr aParent, int numAttribs = 0) : name(aName), data(aData), parent(aParent) { + Tag(const std::string& aName, const std::string& aData, Ptr aParent, int numAttribs = 0) : name(aName), data(aData), parent(aParent) { if(numAttribs > 0) attribs.reserve(numAttribs); } - const string& getAttrib(const string& aName, const string& aDefault = Util::emptyString) { - AttribIter i = find_if(attribs.begin(), attribs.end(), CompareFirst<string,string>(aName)); + const std::string& getAttrib(const std::string& aName, const std::string& aDefault = Util::emptyString) { + AttribIter i = find_if(attribs.begin(), attribs.end(), CompareFirst<std::string, std::string>(aName)); return (i == attribs.end()) ? aDefault : i->second; } - ADCHPP_DLL string toXML(int indent); + ADCHPP_DLL std::string toXML(int indent); - string::size_type fromXML(const string& tmp, string::size_type start, int aa, bool isRoot = false) throw(SimpleXMLException); - string::size_type loadAttribs(const string& tmp, string::size_type start) throw(SimpleXMLException); + std::string::size_type fromXML(const std::string& tmp, std::string::size_type start, int aa, bool isRoot = false) throw(SimpleXMLException); + std::string::size_type loadAttribs(const std::string& tmp, std::string::size_type start) throw(SimpleXMLException); - void appendAttribString(string& tmp); + void appendAttribString(std::string& tmp); /** Delete all children! */ ~Tag() { for(Iter i = children.begin(); i != children.end(); ++i) { Modified: adchpp/trunk/adchpp/Socket.cpp =================================================================== --- adchpp/trunk/adchpp/Socket.cpp 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/Socket.cpp 2007-11-18 19:03:32 UTC (rev 92) @@ -21,7 +21,9 @@ #include "Socket.h" namespace adchpp { - + +using namespace std; + string SocketException::errorToString(int aError) throw() { return Util::translateError(aError); } Modified: adchpp/trunk/adchpp/Socket.h =================================================================== --- adchpp/trunk/adchpp/Socket.h 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/Socket.h 2007-11-18 19:03:32 UTC (rev 92) @@ -80,7 +80,7 @@ virtual ~SocketException() throw() { } private: int err; - static string errorToString(int aError) throw(); + static std::string errorToString(int aError) throw(); }; class Socket @@ -99,21 +99,21 @@ }; Socket() throw(SocketException) : sock(INVALID_SOCKET) { } - Socket(const string& aIp, const string& aPort) throw(SocketException) : sock(INVALID_SOCKET) { connect(aIp, aPort); } - Socket(const string& aIp, short aPort) throw(SocketException) : sock(INVALID_SOCKET) { connect(aIp, aPort); } + Socket(const std::string& aIp, const std::string& aPort) throw(SocketException) : sock(INVALID_SOCKET) { connect(aIp, aPort); } + Socket(const std::string& aIp, short aPort) throw(SocketException) : sock(INVALID_SOCKET) { connect(aIp, aPort); } virtual ~Socket() throw() { disconnect(); } virtual void create(int aType = TYPE_TCP) throw(SocketException); virtual void bind(short aPort) throw(SocketException); - virtual void connect(const string& aIp, short aPort) throw(SocketException); - void connect(const string& aIp, const string& aPort) throw(SocketException) { connect(aIp, (short)Util::toInt(aPort)); } - virtual string accept(const Socket& aSocket) throw(SocketException); + virtual void connect(const std::string& aIp, short aPort) throw(SocketException); + void connect(const std::string& aIp, const std::string& aPort) throw(SocketException) { connect(aIp, (short)Util::toInt(aPort)); } + virtual std::string accept(const Socket& aSocket) throw(SocketException); virtual void write(const char* aBuffer, size_t aLen) throw(SocketException); - void write(const string& aData) throw(SocketException) { write(aData.data(), aData.length()); } + void write(const std::string& aData) throw(SocketException) { write(aData.data(), aData.length()); } virtual int writeNB(const char* aBuffer, size_t aLen) throw(SocketException); - int writeNB(const string& aData) throw(SocketException) { return writeNB(aData.data(), aData.length()); } - virtual void writeTo(const string& aIp, short aPort, const char* aBuffer, size_t aLen) throw(SocketException); - void writeTo(const string& aIp, short aPort, const string& aData) throw(SocketException) { writeTo(aIp, aPort, aData.data(), aData.length()); } + int writeNB(const std::string& aData) throw(SocketException) { return writeNB(aData.data(), aData.length()); } + virtual void writeTo(const std::string& aIp, short aPort, const char* aBuffer, size_t aLen) throw(SocketException); + void writeTo(const std::string& aIp, short aPort, const std::string& aData) throw(SocketException) { writeTo(aIp, aPort, aData.data(), aData.length()); } virtual void disconnect() throw(); void listen(short aPort) throw(SocketException); @@ -123,7 +123,7 @@ int read(void* aBuffer, size_t aBufLen) throw(SocketException); int wait(uint32_t millis, int waitFor) throw(SocketException); - static string resolve(const string& aDns); + static std::string resolve(const std::string& aDns); int getAvailable() { u_long i = 0; @@ -143,7 +143,7 @@ } #endif - string getLocalIp() throw(); + std::string getLocalIp() throw(); int getLocalPort() throw(); socket_t getSocket() { return sock; } Modified: adchpp/trunk/adchpp/SocketManager.cpp =================================================================== --- adchpp/trunk/adchpp/SocketManager.cpp 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/SocketManager.cpp 2007-11-18 19:03:32 UTC (rev 92) @@ -37,6 +37,9 @@ #endif namespace adchpp { + +using namespace std; + static uint32_t WRITE_TIMEOUT = 100; #ifdef _WIN32 Modified: adchpp/trunk/adchpp/SocketManager.h =================================================================== --- adchpp/trunk/adchpp/SocketManager.h 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/SocketManager.h 2007-11-18 19:03:32 UTC (rev 92) @@ -49,7 +49,7 @@ virtual int run(); - typedef vector<Callback> ProcessQueue; + typedef std::vector<Callback> ProcessQueue; FastMutex processCS; @@ -58,9 +58,9 @@ Semaphore processSem; - auto_ptr<Writer> writer; + std::auto_ptr<Writer> writer; - static const string className; + static const std::string className; friend class Singleton<SocketManager>; ADCHPP_DLL static SocketManager* instance; Modified: adchpp/trunk/adchpp/StringDefs.cpp =================================================================== --- adchpp/trunk/adchpp/StringDefs.cpp 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/StringDefs.cpp 2007-11-18 19:03:32 UTC (rev 92) @@ -1,6 +1,7 @@ #include "adchpp.h" #include "ResourceManager.h" namespace adchpp { +using namespace std; string ResourceManager::strings[] = { "B", "CID taken", Modified: adchpp/trunk/adchpp/StringDefs.h =================================================================== --- adchpp/trunk/adchpp/StringDefs.h 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/StringDefs.h 2007-11-18 19:03:32 UTC (rev 92) @@ -1,6 +1,7 @@ // @Prolog: #include "adchpp.h" // @Prolog: #include "ResourceManager.h" // @Prolog: namespace adchpp { +// @Prolog: using namespace std; // @Strings: string ResourceManager::strings[] // @Names: string ResourceManager::names[] Modified: adchpp/trunk/adchpp/TigerHash.cpp =================================================================== --- adchpp/trunk/adchpp/TigerHash.cpp 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/TigerHash.cpp 2007-11-18 19:03:32 UTC (rev 92) @@ -23,6 +23,7 @@ namespace adchpp { +using namespace std; #define PASSES 3 Modified: adchpp/trunk/adchpp/Util.cpp =================================================================== --- adchpp/trunk/adchpp/Util.cpp 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/Util.cpp 2007-11-18 19:03:32 UTC (rev 92) @@ -35,6 +35,8 @@ namespace adchpp { +using namespace std; + intrusive_ptr_base::~intrusive_ptr_base() { } Modified: adchpp/trunk/adchpp/Util.h =================================================================== --- adchpp/trunk/adchpp/Util.h 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/Util.h 2007-11-18 19:03:32 UTC (rev 92) @@ -56,22 +56,22 @@ } /** Evaluates op(pair<T1, T2>.first, compareTo) */ -template<class T1, class T2, class op = equal_to<T1> > +template<class T1, class T2, class op = std::equal_to<T1> > class CompareFirst { public: CompareFirst(const T1& compareTo) : a(compareTo) { } - bool operator()(const pair<T1, T2>& p) { return op()(p.first, a); } + bool operator()(const std::pair<T1, T2>& p) { return op()(p.first, a); } private: CompareFirst& operator=(const CompareFirst&); const T1& a; }; /** Evaluates op(pair<T1, T2>.second, compareTo) */ -template<class T1, class T2, class op = equal_to<T2> > +template<class T1, class T2, class op = std::equal_to<T2> > class CompareSecond { public: CompareSecond(const T2& compareTo) : a(compareTo) { } - bool operator()(const pair<T1, T2>& p) { return op()(p.second, a); } + bool operator()(const std::pair<T1, T2>& p) { return op()(p.second, a); } private: CompareSecond& operator=(const CompareSecond&); const T2& a; @@ -179,56 +179,56 @@ ADCHPP_DLL static size_t reasons[REASON_LAST]; - ADCHPP_DLL static string emptyString; + ADCHPP_DLL static std::string emptyString; - ADCHPP_DLL static void initialize(const string& configPath); - ADCHPP_DLL static string getOsVersion(); - ADCHPP_DLL static void decodeUrl(const string& aUrl, string& aServer, short& aPort, string& aFile); - ADCHPP_DLL static string formatTime(const string& msg, time_t t = time(NULL)); + ADCHPP_DLL static void initialize(const std::string& configPath); + ADCHPP_DLL static std::string getOsVersion(); + ADCHPP_DLL static void decodeUrl(const std::string& aUrl, std::string& aServer, short& aPort, std::string& aFile); + ADCHPP_DLL static std::string formatTime(const std::string& msg, time_t t = time(NULL)); - static const string& getCfgPath() { return cfgPath; } - static void setCfgPath(const string& path) { cfgPath = path; } + static const std::string& getCfgPath() { return cfgPath; } + static void setCfgPath(const std::string& path) { cfgPath = path; } - ADCHPP_DLL static string getAppPath(); - ADCHPP_DLL static string getAppName(); + ADCHPP_DLL static std::string getAppPath(); + ADCHPP_DLL static std::string getAppName(); #ifndef _WIN32 - ADCHPP_DLL static void setApp(const string& app); - static string appPath; - static string appName; + ADCHPP_DLL static void setApp(const std::string& app); + static std::string appPath; + static std::string appName; #endif - ADCHPP_DLL static string translateError(int aError); + ADCHPP_DLL static std::string translateError(int aError); - ADCHPP_DLL static string toAcp(const wstring& wString); - static const string& toAcp(const string& wString) { return wString; } - static string& toAcp(string& wString) { return wString; } + ADCHPP_DLL static std::string toAcp(const std::wstring& wString); + static const std::string& toAcp(const std::string& wString) { return wString; } + static std::string& toAcp(std::string& wString) { return wString; } - ADCHPP_DLL static wstring toUnicode(const string& aString); - static const wstring& toUnicode(const wstring& aString) { return aString; } - static wstring& toUnicode(wstring& aString) { return aString; } + ADCHPP_DLL static std::wstring toUnicode(const std::string& aString); + static const std::wstring& toUnicode(const std::wstring& aString) { return aString; } + static std::wstring& toUnicode(std::wstring& aString) { return aString; } - static string formatBytes(const string& aString) { return formatBytes(toInt64(aString)); } + static std::string formatBytes(const std::string& aString) { return formatBytes(toInt64(aString)); } - ADCHPP_DLL static string getShortTimeString(); - ADCHPP_DLL static string getTimeString(); + ADCHPP_DLL static std::string getShortTimeString(); + ADCHPP_DLL static std::string getTimeString(); - ADCHPP_DLL static string formatBytes(int64_t aBytes); + ADCHPP_DLL static std::string formatBytes(int64_t aBytes); - ADCHPP_DLL static void tokenize(StringList& lst, const string& str, char sep, string::size_type j = 0); + ADCHPP_DLL static void tokenize(StringList& lst, const std::string& str, char sep, std::string::size_type j = 0); - static string formatSeconds(int64_t aSec) { + static std::string formatSeconds(int64_t aSec) { char buf[64]; sprintf(buf, "%01d:%02d:%02d:%02d", (int)(aSec / (24*60*60)), (int)((aSec / (60*60)) % 24), (int)((aSec / 60) % 60), (int)(aSec % 60)); return buf; } - static bool toBool(const string& aString) { return toBool(aString.c_str()); } - static int toInt(const string& aString) { return toInt(aString.c_str()); } - static double toDouble(const string& aString) { return toDouble(aString.c_str()); } - static float toFloat(const string& aString) { return toFloat(aString.c_str()); } - static int64_t toInt64(const string& aString) { return toInt64(aString.c_str()); } + static bool toBool(const std::string& aString) { return toBool(aString.c_str()); } + static int toInt(const std::string& aString) { return toInt(aString.c_str()); } + static double toDouble(const std::string& aString) { return toDouble(aString.c_str()); } + static float toFloat(const std::string& aString) { return toFloat(aString.c_str()); } + static int64_t toInt64(const std::string& aString) { return toInt64(aString.c_str()); } static bool toBool(const char* aString) { return toInt(aString) > 0; } static int toInt(const char* aString) { return ::atoi(aString); } @@ -242,37 +242,41 @@ #endif } - static string toString(short val) { + static std::string toString(bool val) { + return val ? "1" : "0"; + } + + static std::string toString(short val) { char buf[8]; sprintf(buf, "%d", (int)val); return buf; } - static string toString(unsigned short val) { + static std::string toString(unsigned short val) { char buf[8]; sprintf(buf, "%u", (unsigned int)val); return buf; } - static string toString(int val) { + static std::string toString(int val) { char buf[16]; sprintf(buf, "%d", val); return buf; } - static string toString(unsigned int val) { + static std::string toString(unsigned int val) { char buf[16]; sprintf(buf, "%u", val); return buf; } - static string toString(long val) { + static std::string toString(long val) { char buf[32]; sprintf(buf, "%ld", val); return buf; } - static string toString(unsigned long val) { + static std::string toString(unsigned long val) { char buf[32]; sprintf(buf, "%lu", val); return buf; } - static string toString(long long val) { + static std::string toString(long long val) { char buf[32]; #ifdef _MSC_VER sprintf(buf, "%I64d", val); @@ -281,7 +285,7 @@ #endif return buf; } - static string toString(unsigned long long val) { + static std::string toString(unsigned long long val) { char buf[32]; #ifdef _MSC_VER sprintf(buf, "%I64u", val); @@ -291,18 +295,18 @@ return buf; } - static string toString(double val, int maxDec = 2) { + static std::string toString(double val, int maxDec = 2) { char buf[32]; sprintf(buf, "%.*f", maxDec, val); return buf; } - static const string& toString(const string& aString) { + static const std::string& toString(const std::string& aString) { return aString; } /** Avoid this! Use the one of a connected socket instead... */ - ADCHPP_DLL static string getLocalIp(); + ADCHPP_DLL static std::string getLocalIp(); struct Clear { void operator()(ByteVector& x); @@ -316,7 +320,7 @@ static double randd() { return ((double)rand()) / ((double)0xffffffff); } private: - ADCHPP_DLL static string cfgPath; + ADCHPP_DLL static std::string cfgPath; }; } Modified: adchpp/trunk/adchpp/adchpp.cpp =================================================================== --- adchpp/trunk/adchpp/adchpp.cpp 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/adchpp.cpp 2007-11-18 19:03:32 UTC (rev 92) @@ -27,7 +27,9 @@ #include "SettingsManager.h" namespace adchpp { - + +using namespace std; + const char compileTime[] = __DATE__ " " __TIME__; static bool initialized = false; Modified: adchpp/trunk/adchpp/adchpp.h =================================================================== --- adchpp/trunk/adchpp/adchpp.h 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/adchpp.h 2007-11-18 19:03:32 UTC (rev 92) @@ -111,8 +111,9 @@ #endif -#include <cerrno> -#include <cstdarg> +#include <errno.h> +#include <stdarg.h> +#include <stddef.h> #include <string> #include <vector> @@ -140,12 +141,6 @@ #include <boost/intrusive_ptr.hpp> #include <boost/noncopyable.hpp> -namespace adchpp { - -using namespace std; - -} - #ifdef _UNICODE # ifndef _T # define _T(s) L##s Modified: adchpp/trunk/adchpp/common.h =================================================================== --- adchpp/trunk/adchpp/common.h 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/common.h 2007-11-18 19:03:32 UTC (rev 92) @@ -102,7 +102,7 @@ /** * Initialize configuration. */ -ADCHPP_DLL void initialize(const string& path); +ADCHPP_DLL void initialize(const std::string& path); /** * Load plugins and start listening for incoming connections Modified: adchpp/trunk/adchpp/version.cpp =================================================================== --- adchpp/trunk/adchpp/version.cpp 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/version.cpp 2007-11-18 19:03:32 UTC (rev 92) @@ -21,9 +21,11 @@ #define FULLVERSIONSTRING APPNAME " v" VERSIONSTRING "-" BUILDSTRING namespace adchpp { + +using namespace std; + +string appName = APPNAME; +string versionString = FULLVERSIONSTRING; +float versionFloat = VERSIONFLOAT; - string appName = APPNAME; - string versionString = FULLVERSIONSTRING; - float versionFloat = VERSIONFLOAT; - } Modified: adchpp/trunk/adchpp/version.h =================================================================== --- adchpp/trunk/adchpp/version.h 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/adchpp/version.h 2007-11-18 19:03:32 UTC (rev 92) @@ -20,8 +20,8 @@ #define ADCHPP_VERSION_H namespace adchpp { - ADCHPP_DLL extern string appName; - ADCHPP_DLL extern string versionString; + ADCHPP_DLL extern std::string appName; + ADCHPP_DLL extern std::string versionString; ADCHPP_DLL extern float versionFloat; } Modified: adchpp/trunk/plugins/Script/src/Engine.h =================================================================== --- adchpp/trunk/plugins/Script/src/Engine.h 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/plugins/Script/src/Engine.h 2007-11-18 19:03:32 UTC (rev 92) @@ -27,10 +27,10 @@ public: virtual ~Engine() { } - virtual Script* loadScript(const string& path, const string& filename, const ParameterMap& parameters) = 0; + virtual Script* loadScript(const std::string& path, const std::string& filename, const ParameterMap& parameters) = 0; virtual void unloadScript(Script* script) = 0; - virtual void getStats(string& str) const = 0; + virtual void getStats(std::string& str) const = 0; private: }; Modified: adchpp/trunk/plugins/Script/src/LuaEngine.cpp =================================================================== --- adchpp/trunk/plugins/Script/src/LuaEngine.cpp 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/plugins/Script/src/LuaEngine.cpp 2007-11-18 19:03:32 UTC (rev 92) @@ -22,8 +22,13 @@ #include "LuaScript.h" #include <adchpp/Util.h> + +extern "C" { #include <lua.h> +} +using namespace std; + LuaEngine::LuaEngine() { } Modified: adchpp/trunk/plugins/Script/src/LuaEngine.h =================================================================== --- adchpp/trunk/plugins/Script/src/LuaEngine.h 2007-11-18 17:13:18 UTC (rev 91) +++ adchpp/trunk/plugins/Script/src/LuaEngine.h 2007-11-18 19:03:32 UTC (rev 92) @@ -28,11 +28,11 @@ LuaEngine(); virtual ~LuaEngine(); - virtual Script* loadScript(const string& path, const string& filename, const ParameterMap& parameters); + virtual Script* loadScript(const std::string& path, const std::string& filename, const ParameterMap& parameters); virtual void unloadScri... [truncated message content] |