Author: bdonlan
Date: 2004-10-11 10:34:05 -0400 (Mon, 11 Oct 2004)
New Revision: 380
Modified:
trunk/clients/wxhaver/wxHaverParser.cpp
trunk/clients/wxhaver/wxHaverParser.h
Log:
Set svn:eol-style on some more files
Modified: trunk/clients/wxhaver/wxHaverParser.cpp
===================================================================
--- trunk/clients/wxhaver/wxHaverParser.cpp 2004-10-11 14:25:06 UTC (rev
379)
+++ trunk/clients/wxhaver/wxHaverParser.cpp 2004-10-11 14:34:05 UTC (rev
380)
@@ -1,105 +1,105 @@
-/* vim: set ft=cpp ts=4 sw=4:
- * wxHaver - A client for the Haver chat system that utilises wxWindows.
- *
- * Copyright (C) 2004 Jeremy Cambell Apthorp.
- *
- * This software is free; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty if
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Puvlic License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "wxHaver.h"
-#include "wxHaverParser.h"
-#include "wx/socket.h"
-#include <vector>
-#include <map>
-#include <string>
-
-using namespace std;
-
-inline void Strip(wxString &line)
-{
- if (line.find('\r') >= 0)
- line.Remove(line.find('\r'), 1);
-}
-
-vector<wxString> Split(wxString line, wxString splitby)
-{
- printf("Splitting \"%s\" by \"%s\"\n", line.c_str(), splitby.c_str());
- size_t tp;
- vector<wxString> tokens;
- while (tp = line.find(splitby)) {
- if (tp == wxString::npos) break;
- tokens.push_back(line.substr(0, tp));
- line.erase(0, tp+1);
- }
- // pick up on that last token
- tokens.push_back(line);
- return tokens;
-}
-
-wxString Splice(vector<wxString> tokens, wxString splicewith)
-{
- wxString spliced;
- for (vector<wxString>::iterator i = tokens.begin();
- i < tokens.end() - 1; i++) {
- spliced += *i + splicewith;
- }
- spliced += *(tokens.end() - 1);
- return spliced;
-}
-
-//------------------------------------------------------------------------
-// wxHaverSockClient
-//------------------------------------------------------------------------
-
-wxHaverSockClient &wxHaverSockClient::operator<<(wxString str)
-{
- if (str != CRLF) str += "\t";
- Write(str.c_str(), str.length());
-}
-
-//------------------------------------------------------------------------
-// wxHaverParser
-//------------------------------------------------------------------------
-
-wxHaverParser::wxHaverParser()
-{
- // TODO: Add default commands?
-}
-
-int wxHaverParser::AddCommand(wxString cmdname, wxHaverFunctor *callback)
-{
- _commands[cmdname] = callback;
-}
-
-int wxHaverParser::DelCommand(wxString cmdname)
-{
- _commands.erase(cmdname);
-}
-
-void wxHaverParser::Parse(wxString line)
-{
- Strip(line);
- printf("Got line \"%s\" to parse\n", line.c_str());
- vector<wxString> cmd = Split(line, "\t");
- if (_commands.find(cmd[0]) == _commands.end()) {
- printf("Command %s doesn't exist\n", cmd[0].c_str());
- return;
- }
- printf("Command exists\n");
- wxString command = cmd[0];
- cmd.erase(cmd.begin());
- (*_commands[command])(cmd);
-}
-
+/* vim: set ft=cpp ts=4 sw=4:
+ * wxHaver - A client for the Haver chat system that utilises wxWindows.
+ *
+ * Copyright (C) 2004 Jeremy Cambell Apthorp.
+ *
+ * This software is free; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty if
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Puvlic License
+ * along with this software; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "wxHaver.h"
+#include "wxHaverParser.h"
+#include "wx/socket.h"
+#include <vector>
+#include <map>
+#include <string>
+
+using namespace std;
+
+inline void Strip(wxString &line)
+{
+ if (line.find('\r') >= 0)
+ line.Remove(line.find('\r'), 1);
+}
+
+vector<wxString> Split(wxString line, wxString splitby)
+{
+ printf("Splitting \"%s\" by \"%s\"\n", line.c_str(), splitby.c_str());
+ size_t tp;
+ vector<wxString> tokens;
+ while (tp = line.find(splitby)) {
+ if (tp == wxString::npos) break;
+ tokens.push_back(line.substr(0, tp));
+ line.erase(0, tp+1);
+ }
+ // pick up on that last token
+ tokens.push_back(line);
+ return tokens;
+}
+
+wxString Splice(vector<wxString> tokens, wxString splicewith)
+{
+ wxString spliced;
+ for (vector<wxString>::iterator i = tokens.begin();
+ i < tokens.end() - 1; i++) {
+ spliced += *i + splicewith;
+ }
+ spliced += *(tokens.end() - 1);
+ return spliced;
+}
+
+//------------------------------------------------------------------------
+// wxHaverSockClient
+//------------------------------------------------------------------------
+
+wxHaverSockClient &wxHaverSockClient::operator<<(wxString str)
+{
+ if (str != CRLF) str += "\t";
+ Write(str.c_str(), str.length());
+}
+
+//------------------------------------------------------------------------
+// wxHaverParser
+//------------------------------------------------------------------------
+
+wxHaverParser::wxHaverParser()
+{
+ // TODO: Add default commands?
+}
+
+int wxHaverParser::AddCommand(wxString cmdname, wxHaverFunctor *callback)
+{
+ _commands[cmdname] = callback;
+}
+
+int wxHaverParser::DelCommand(wxString cmdname)
+{
+ _commands.erase(cmdname);
+}
+
+void wxHaverParser::Parse(wxString line)
+{
+ Strip(line);
+ printf("Got line \"%s\" to parse\n", line.c_str());
+ vector<wxString> cmd = Split(line, "\t");
+ if (_commands.find(cmd[0]) == _commands.end()) {
+ printf("Command %s doesn't exist\n", cmd[0].c_str());
+ return;
+ }
+ printf("Command exists\n");
+ wxString command = cmd[0];
+ cmd.erase(cmd.begin());
+ (*_commands[command])(cmd);
+}
+
Property changes on: trunk/clients/wxhaver/wxHaverParser.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/clients/wxhaver/wxHaverParser.h
===================================================================
--- trunk/clients/wxhaver/wxHaverParser.h 2004-10-11 14:25:06 UTC (rev
379)
+++ trunk/clients/wxhaver/wxHaverParser.h 2004-10-11 14:34:05 UTC (rev
380)
@@ -1,83 +1,83 @@
-/* vim: set ft=cpp ts=4 sw=4:
- * wxHaver - A client for the Haver chat system that utilises wxWindows.
- *
- * Copyright (C) 2004 Jeremy Cambell Apthorp.
- *
- * This software is free; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty if
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Puvlic License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef WH_wxHaverParser_H
-#define WH_wxHaverParser_H
-
-#include "wxHaver.h"
-#include "wx/socket.h"
-#include <vector> // I think wxArray is dumb. :P So unless I (or someone else)
-#include <map> // can be bothered to learn and implement wxArray instead,
- // I'm sticking with std::vector and std::map.
-
-#define CRLF "\r\n"
-
-// A command_func is a pointer to a function that takes a
-// std::vector<wxString> as its argument (this contains the command's
-// arguments) and returns void.
-// TODO: Think about prefixes.
-typedef void(*command_func)(std::vector<wxString>);
-
-// Strips the trailing CRLF off a line.
-inline void Strip(wxString &line);
-
-// Split one wxString by another.
-std::vector<wxString> Split(wxString line, wxString splitby = "\t");
-
-// Splice a bunch of wxStrings together with splicewith.
-wxString Splice(std::vector<wxString> tokens, wxString splicewidth = "\t");
-
-class wxHaverFunctor
-{
- public:
- virtual void operator()(std::vector<wxString>)=0;
- virtual void Call(std::vector<wxString>)=0;
-};
-
-template<class T> class wxHaverCallback : public wxHaverFunctor
-{
- private:
- void (T::*fpt)(std::vector<wxString>);
- T* pt2Obj;
- public:
- wxHaverCallback(T *_pt2Obj,
void(T::*_fpt)(std::vector<wxString>)):
- pt2Obj(_pt2Obj), fpt(_fpt) {}
- void operator()(std::vector<wxString> args) {
(*pt2Obj.*fpt)(args); }
- void Call(std::vector<wxString> args) { (*pt2Obj.*fpt)(args); }
-};
-
-class wxHaverSockClient : public wxSocketClient
-{
- public:
- wxHaverSockClient &operator<<(wxString);
-};
-
-class wxHaverParser
-{
- public:
- wxHaverParser();
- int AddCommand(wxString cmdname, wxHaverFunctor *callback);
- int DelCommand(wxString cmdname);
- void Parse(wxString line);
- private:
- std::map<wxString, wxHaverFunctor*> _commands;
-};
-
-#endif // WH_wxHaverParser_H
+/* vim: set ft=cpp ts=4 sw=4:
+ * wxHaver - A client for the Haver chat system that utilises wxWindows.
+ *
+ * Copyright (C) 2004 Jeremy Cambell Apthorp.
+ *
+ * This software is free; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty if
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Puvlic License
+ * along with this software; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef WH_wxHaverParser_H
+#define WH_wxHaverParser_H
+
+#include "wxHaver.h"
+#include "wx/socket.h"
+#include <vector> // I think wxArray is dumb. :P So unless I (or someone else)
+#include <map> // can be bothered to learn and implement wxArray instead,
+ // I'm sticking with std::vector and std::map.
+
+#define CRLF "\r\n"
+
+// A command_func is a pointer to a function that takes a
+// std::vector<wxString> as its argument (this contains the command's
+// arguments) and returns void.
+// TODO: Think about prefixes.
+typedef void(*command_func)(std::vector<wxString>);
+
+// Strips the trailing CRLF off a line.
+inline void Strip(wxString &line);
+
+// Split one wxString by another.
+std::vector<wxString> Split(wxString line, wxString splitby = "\t");
+
+// Splice a bunch of wxStrings together with splicewith.
+wxString Splice(std::vector<wxString> tokens, wxString splicewidth = "\t");
+
+class wxHaverFunctor
+{
+ public:
+ virtual void operator()(std::vector<wxString>)=0;
+ virtual void Call(std::vector<wxString>)=0;
+};
+
+template<class T> class wxHaverCallback : public wxHaverFunctor
+{
+ private:
+ void (T::*fpt)(std::vector<wxString>);
+ T* pt2Obj;
+ public:
+ wxHaverCallback(T *_pt2Obj,
void(T::*_fpt)(std::vector<wxString>)):
+ pt2Obj(_pt2Obj), fpt(_fpt) {}
+ void operator()(std::vector<wxString> args) {
(*pt2Obj.*fpt)(args); }
+ void Call(std::vector<wxString> args) { (*pt2Obj.*fpt)(args); }
+};
+
+class wxHaverSockClient : public wxSocketClient
+{
+ public:
+ wxHaverSockClient &operator<<(wxString);
+};
+
+class wxHaverParser
+{
+ public:
+ wxHaverParser();
+ int AddCommand(wxString cmdname, wxHaverFunctor *callback);
+ int DelCommand(wxString cmdname);
+ void Parse(wxString line);
+ private:
+ std::map<wxString, wxHaverFunctor*> _commands;
+};
+
+#endif // WH_wxHaverParser_H
Property changes on: trunk/clients/wxhaver/wxHaverParser.h
___________________________________________________________________
Name: svn:eol-style
+ native