r8427 - software/gofind
Miriam Ruiz
miriam at alioth.debian.org
Tue Nov 18 00:23:32 UTC 2008
Author: miriam
Date: 2008-11-18 00:23:32 +0000 (Tue, 18 Nov 2008)
New Revision: 8427
Added:
software/gofind/gui_cli.cpp
Modified:
software/gofind/gofind.cpp
software/gofind/guiplugin.h
Log:
Connection to plugin
Modified: software/gofind/gofind.cpp
===================================================================
--- software/gofind/gofind.cpp 2008-11-17 22:03:17 UTC (rev 8426)
+++ software/gofind/gofind.cpp 2008-11-18 00:23:32 UTC (rev 8427)
@@ -22,6 +22,7 @@
#include "common.h"
#include "filter.h"
#include "slre.h"
+#include "guiplugin.h"
#include "Environment.h"
#include "GamesOptions.h"
@@ -329,8 +330,17 @@
bindtextdomain ("gofind", NULL);
#endif
+ DLLFactory<GUIPlugInFactory> gui_factory( "./gui_cli.so" );
+ if( ! gui_factory.factory )
+ {
+ std::cout << _("Could not load GUI plugin") << std::endl;
+ return -1;
+ }
+
+ GUIPlugIn *gui=gui_factory.factory->CreatePlugIn();
+
std::ostream &out = std::cout;
- out << "#" _("Starting system") << std::endl;
+ gui->Comment(_("Starting system"));
wibble::commandline::GamesOptions opts;
@@ -438,7 +448,7 @@
bool run = true;
- out << "#" _("System running") << std::endl;
+ gui->Comment(_("System running"));
struct slre_pattern pattern[5];
const char *pattern_text[5];
@@ -616,7 +626,8 @@
}
}
- out << "#" _("Stopping system") << std::endl;
+ gui->Comment(_("Stopping system"));
+ delete gui;
return 0;
} catch (wibble::exception::BadOption& e) {
cerr << e.desc() << endl;
Added: software/gofind/gui_cli.cpp
===================================================================
--- software/gofind/gui_cli.cpp (rev 0)
+++ software/gofind/gui_cli.cpp 2008-11-18 00:23:32 UTC (rev 8427)
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 1995 Jeff Koftinoff <jeffk at jdkoftinoff.com>
+ * Copyright (C) 2008 Miriam Ruiz <little_miry at yahoo.es>
+ *
+ * http://www.jdkoftinoff.com/main/Articles/Linux_Articles/ELF_Plugins/
+ *
+ * This program is free software; 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 program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * 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 Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "guiplugin.h"
+
+#include <typeinfo>
+#include <iostream>
+#include <string>
+
+class GUIPlugInCLI : public GUIPlugIn
+{
+ public:
+ GUIPlugInCLI()
+ {
+ std::cout << "GUIPlugInCLI() Created" << std::endl;
+ }
+
+ virtual ~GUIPlugInCLI()
+ {
+ std::cout << "GUIPlugInCLI() destroyed" << std::endl;
+ }
+
+ virtual void Comment(const char *msg)
+ {
+ std::cout << "##" << msg << std::endl;
+ }
+};
+
+class GUIPlugInCLIFactory : public GUIPlugInFactory
+{
+ public:
+ GUIPlugInCLIFactory()
+ {
+ }
+
+ ~GUIPlugInCLIFactory()
+ {
+ }
+
+ virtual GUIPlugIn * CreatePlugIn()
+ {
+ return new GUIPlugInCLI;
+ }
+};
+
+
+//
+// The "C" linkage factory0() function creates the PlugIn Factory
+// class for this library
+//
+
+extern "C" void * factory0( void )
+{
+ return new GUIPlugInCLIFactory;
+}
Modified: software/gofind/guiplugin.h
===================================================================
--- software/gofind/guiplugin.h 2008-11-17 22:03:17 UTC (rev 8426)
+++ software/gofind/guiplugin.h 2008-11-18 00:23:32 UTC (rev 8427)
@@ -41,7 +41,7 @@
virtual ~GUIPlugIn();
- virtual void Show() = 0;
+ virtual void Comment(const char *msg) = 0;
};
More information about the Pkg-games-commits
mailing list