diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-02 00:43:25 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-02 00:43:25 +0000 |
commit | 219993bc9018d9f0d9568330d7a972b68b785d27 (patch) | |
tree | 9d827a0e1a2ad343ebff21fb7f692b1fd2835650 /include | |
parent | 2630a87bb13b089e6d0fdcff4bcd0f3a9612e52f (diff) |
Replace std::deque with std::vector in spanningtree and related modules
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11593 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r-- | include/command_parse.h | 2 | ||||
-rw-r--r-- | include/hashcomp.h | 13 | ||||
-rw-r--r-- | include/mode.h | 8 | ||||
-rw-r--r-- | include/modules.h | 4 | ||||
-rw-r--r-- | include/protocol.h | 6 | ||||
-rw-r--r-- | include/u_listmode.h | 16 |
6 files changed, 29 insertions, 20 deletions
diff --git a/include/command_parse.h b/include/command_parse.h index f1d9d1b1c..62f47bd2d 100644 --- a/include/command_parse.h +++ b/include/command_parse.h @@ -203,7 +203,7 @@ class CoreExport CommandParser : public classbase */ int TranslateUIDs(TranslateType to, const std::string &source, std::string &dest); - int TranslateUIDs(const std::deque<TranslateType> to, const std::deque<std::string> &source, std::string &dest); + int TranslateUIDs(const std::vector<TranslateType> to, const std::vector<std::string> &source, std::string &dest); }; /** Command handler class for the RELOAD command. diff --git a/include/hashcomp.h b/include/hashcomp.h index 536c42937..c5d849529 100644 --- a/include/hashcomp.h +++ b/include/hashcomp.h @@ -304,7 +304,7 @@ namespace irc * characters. As specified below, this function * should be called in a loop until it returns zero, * indicating there are no more modes to return. - * @param result The deque to populate. This will + * @param result The vector to populate. This will not * be cleared before it is used. * @param max_line_size The maximum size of the line * to build, in characters, seperate to MAXMODES. @@ -313,7 +313,16 @@ namespace irc * returns 0, in case there are multiple lines of * mode changes to be obtained. */ - int GetStackedLine(std::deque<std::string> &result, int max_line_size = 360); + int GetStackedLine(std::vector<std::string> &result, int max_line_size = 360); + + /** deprecated compatability interface - TODO remove */ + int GetStackedLine(std::deque<std::string> &result, int max_line_size = 360) { + std::vector<std::string> r; + int n = GetStackedLine(r, max_line_size); + result.clear(); + result.insert(result.end(), r.begin(), r.end()); + return n; + } }; /** irc::tokenstream reads a string formatted as per RFC1459 and RFC2812. diff --git a/include/mode.h b/include/mode.h index 280284bfa..e80455acc 100644 --- a/include/mode.h +++ b/include/mode.h @@ -445,8 +445,8 @@ class CoreExport ModeParser : public classbase * Use GetLastParse() to get this value, to be used for display purposes. */ std::string LastParse; - std::deque<std::string> LastParseParams; - std::deque<TranslateType> LastParseTranslate; + std::vector<std::string> LastParseParams; + std::vector<TranslateType> LastParseTranslate; unsigned int sent[256]; @@ -488,8 +488,8 @@ class CoreExport ModeParser : public classbase * @return Last parsed string, as seen by users. */ const std::string& GetLastParse(); - const std::deque<std::string>& GetLastParseParams() { return LastParseParams; } - const std::deque<TranslateType>& GetLastParseTranslate() { return LastParseTranslate; } + const std::vector<std::string>& GetLastParseParams() { return LastParseParams; } + const std::vector<TranslateType>& GetLastParseTranslate() { return LastParseTranslate; } /** Add a mode to the mode parser. * @return True if the mode was successfully added. */ diff --git a/include/modules.h b/include/modules.h index f6678e931..21e476089 100644 --- a/include/modules.h +++ b/include/modules.h @@ -776,7 +776,7 @@ class CoreExport Module : public Extensible * @param text The actual modes and their parameters if any * @param translate The translation types of the mode parameters */ - virtual void OnMode(User* user, void* dest, int target_type, const std::deque<std::string> &text, const std::deque<TranslateType> &translate); + virtual void OnMode(User* user, void* dest, int target_type, const std::vector<std::string> &text, const std::vector<TranslateType> &translate); /** Allows modules to alter or create server descriptions * Whenever a module requires a server description, for example for display in @@ -885,7 +885,7 @@ class CoreExport Module : public Extensible * @param modeline The modes and parameters to be sent * @param translate The translation types of the mode parameters */ - virtual void ProtoSendMode(void* opaque, TargetTypeFlags target_type, void* target, const std::deque<std::string> &modeline, const std::deque<TranslateType> &translate); + virtual void ProtoSendMode(void* opaque, TargetTypeFlags target_type, void* target, const std::vector<std::string> &modeline, const std::vector<TranslateType> &translate); /** Implemented by modules which provide the ability to link servers. * These modules will implement this method, which allows metadata (extra data added to diff --git a/include/protocol.h b/include/protocol.h index 60fcf4df2..49288fd3b 100644 --- a/include/protocol.h +++ b/include/protocol.h @@ -19,7 +19,7 @@ class InspIRCd; class User; -typedef std::deque<std::string> parameterlist; +typedef std::vector<std::string> parameterlist; class ProtoServer { @@ -68,7 +68,7 @@ class ProtocolInterface : public Extensible * @param target The channel name or user to send mode changes for. * @param The mode changes to send. */ - virtual void SendMode(const std::string &target, const parameterlist &modedata, const std::deque<TranslateType> &translate) { } + virtual void SendMode(const std::string &target, const parameterlist &modedata, const std::vector<TranslateType> &translate) { } /** Convenience function, string wrapper around the above. */ @@ -76,7 +76,7 @@ class ProtocolInterface : public Extensible { irc::spacesepstream x(modeline); parameterlist n; - std::deque<TranslateType> types; + std::vector<TranslateType> types; std::string v; while (x.GetToken(v)) { diff --git a/include/u_listmode.h b/include/u_listmode.h index eb3cf18b7..0a2c25710 100644 --- a/include/u_listmode.h +++ b/include/u_listmode.h @@ -200,9 +200,6 @@ class ListModeBase : public ModeHandler if (el) { irc::modestacker modestack(ServerInstance, false); - std::deque<std::string> stackresult; - std::vector<std::string> mode_junk; - mode_junk.push_back(channel->name); for (modelist::iterator it = el->begin(); it != el->end(); it++) { @@ -215,11 +212,13 @@ class ListModeBase : public ModeHandler if (stack) return; + std::vector<std::string> stackresult; + stackresult.push_back(channel->name); while (modestack.GetStackedLine(stackresult)) { - mode_junk.insert(mode_junk.end(), stackresult.begin(), stackresult.end()); - ServerInstance->SendMode(mode_junk, ServerInstance->FakeClient); - mode_junk.erase(mode_junk.begin() + 1, mode_junk.end()); + ServerInstance->SendMode(stackresult, ServerInstance->FakeClient); + stackresult.clear(); + stackresult.push_back(channel->name); } } } @@ -419,8 +418,8 @@ class ListModeBase : public ModeHandler modelist* mlist; chan->GetExt(infokey, mlist); irc::modestacker modestack(ServerInstance, true); - std::deque<std::string> stackresult; - std::deque<TranslateType> types; + std::vector<std::string> stackresult; + std::vector<TranslateType> types; types.push_back(TR_TEXT); if (mlist) { @@ -433,6 +432,7 @@ class ListModeBase : public ModeHandler { types.assign(stackresult.size(), this->GetTranslateType()); proto->ProtoSendMode(opaque, TYPE_CHANNEL, chan, stackresult, types); + stackresult.clear(); } } |