|
Boost-Commit : |
From: mconsoni_at_[hidden]
Date: 2007-06-26 20:37:54
Author: mconsoni
Date: 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
New Revision: 7187
URL: http://svn.boost.org/trac/boost/changeset/7187
Log:
- more style for the examples (file desc, 80 columns, indent, "latest version" notice, license + copyright)
Text files modified:
sandbox/libs/extension/examples/Jamfile.v2 | 10 ++
sandbox/libs/extension/examples/hello_world.cpp | 15 +++-
sandbox/libs/extension/examples/info/im/im_main.cpp | 135 +++++++++++++++++++++-----------------
sandbox/libs/extension/examples/info/im/network_parameters.hpp | 17 +++-
sandbox/libs/extension/examples/info/im/plugins.cpp | 54 +++++++++++----
sandbox/libs/extension/examples/info/im/protocol.hpp | 9 ++
sandbox/libs/extension/examples/info/multilanguage_hello_world.cpp | 45 +++++++-----
sandbox/libs/extension/examples/info/multilanguage_main.cpp | 69 +++++++++++--------
sandbox/libs/extension/examples/info/word_description.hpp | 17 +++-
sandbox/libs/extension/examples/main.cpp | 23 ++++--
sandbox/libs/extension/examples/multiple_inheritance/boat.cpp | 16 ++++
sandbox/libs/extension/examples/multiple_inheritance/boat.hpp | 13 +++
sandbox/libs/extension/examples/multiple_inheritance/car.cpp | 17 ++++
sandbox/libs/extension/examples/multiple_inheritance/car.hpp | 13 +++
sandbox/libs/extension/examples/multiple_inheritance/car_of_the_future.cpp | 17 ++++
sandbox/libs/extension/examples/multiple_inheritance/car_of_the_future.hpp | 13 +++
sandbox/libs/extension/examples/multiple_inheritance/computer.cpp | 19 ++++
sandbox/libs/extension/examples/multiple_inheritance/computer.hpp | 11 +++
sandbox/libs/extension/examples/multiple_inheritance/flying_car.cpp | 26 ++++++-
sandbox/libs/extension/examples/multiple_inheritance/flying_car.hpp | 14 +++
sandbox/libs/extension/examples/multiple_inheritance/main_mi.cpp | 47 ++++++++-----
sandbox/libs/extension/examples/multiple_inheritance/plane.cpp | 16 ++++
sandbox/libs/extension/examples/multiple_inheritance/plane.hpp | 14 +++
sandbox/libs/extension/examples/multiple_inheritance/vehicle.cpp | 16 ++++
sandbox/libs/extension/examples/multiple_inheritance/vehicle.hpp | 11 +++
sandbox/libs/extension/examples/parameters/lots_of_parameters.cpp | 46 +++++++-----
sandbox/libs/extension/examples/parameters/lots_of_parameters_interface.hpp | 18 +++-
sandbox/libs/extension/examples/parameters/main_lp.cpp | 52 +++++++++------
sandbox/libs/extension/examples/registry/registry_example.cpp | 40 +++++++---
sandbox/libs/extension/examples/registry/registry_library.cpp | 18 +++-
sandbox/libs/extension/examples/versioning/hello_world_versions.cpp | 17 +++-
sandbox/libs/extension/examples/versioning/main_versions.cpp | 136 ++++++++++++++++++++++-----------------
sandbox/libs/extension/examples/versioning/salute.cpp | 20 +++--
sandbox/libs/extension/examples/versioning/salute.hpp | 9 ++
sandbox/libs/extension/examples/word.hpp | 9 ++
35 files changed, 694 insertions(+), 328 deletions(-)
Modified: sandbox/libs/extension/examples/Jamfile.v2
==============================================================================
--- sandbox/libs/extension/examples/Jamfile.v2 (original)
+++ sandbox/libs/extension/examples/Jamfile.v2 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,3 +1,13 @@
+# Boost.Extension - examples Jamfile
+#
+# Copyright 2007 Jeremy Pack
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+#
+# See http://www.boost.org/ for latest version.
+#
+
import type : change-generated-target-suffix ;
import type : change-generated-target-prefix ;
type.change-generated-target-suffix SHARED_LIB : : extension ;
Modified: sandbox/libs/extension/examples/hello_world.cpp
==============================================================================
--- sandbox/libs/extension/examples/hello_world.cpp (original)
+++ sandbox/libs/extension/examples/hello_world.cpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,7 +1,12 @@
-/* (C) Copyright Jeremy Pack 2007
- * Distributed under the Boost Software License, Version 1.0. (See
+/*
+ * Boost.Extension / hello world implementations
+ *
+ * (C) Copyright Jeremy Pack 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
* accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
*/
#include "word.hpp"
@@ -17,8 +22,10 @@
public:
virtual const char * get_val(){return "hello";}
};
-extern "C" void BOOST_EXTENSION_EXPORT_DECL extension_export_word(boost::extensions::factory_map & fm)
+extern "C"
+void BOOST_EXTENSION_EXPORT_DECL
+extension_export_word(boost::extensions::factory_map & fm)
{
fm.add<hello, word, int>(1);
fm.add<world, word, int>(2);
-}
\ No newline at end of file
+}
Modified: sandbox/libs/extension/examples/info/im/im_main.cpp
==============================================================================
--- sandbox/libs/extension/examples/info/im/im_main.cpp (original)
+++ sandbox/libs/extension/examples/info/im/im_main.cpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,9 +1,15 @@
-/* (C) Copyright Mariano G. Consoni 2007
- * Distributed under the Boost Software License, Version 1.0. (See
+/*
+ * Boost.Extension / instant messaging main
+ *
+ * (C) Copyright Mariano G. Consoni 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
* accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
*/
+
#include <boost/extension/factory_map.hpp>
#include <boost/extension/shared_library.hpp>
#include <boost/extension/convenience.hpp>
@@ -17,67 +23,74 @@
int main(void)
{
- using namespace boost::extensions;
+ using namespace boost::extensions;
- // create the factory_map object - it will hold all of the available
- // constructors. Multiple factory_maps can be constructed.
- factory_map fm;
-
- // load the shared library with
- load_single_library(fm, "libIMPlugins.extension", "extension_export_plugins");
-
- // get a reference to the list of constructors for protocols
- std::list< factory<protocol, boost::shared_ptr<network_parameters> > > & factory_list =
- fm.get<protocol, boost::shared_ptr<network_parameters> >();
-
- if (factory_list.size() < 2) {
- std::cout << "Error - the classes were not found.";
- return 1;
- }
-
- std::list<factory< protocol, boost::shared_ptr<network_parameters> > >::iterator current_plugin = factory_list.begin();
-
- // MSN plugin
- std::auto_ptr<protocol> MSN_ptr(current_plugin->create());
- boost::shared_ptr<network_parameters> msn_parameters = current_plugin->get_info();
- current_plugin++;
-
- // Jabber plugin
- std::auto_ptr<protocol> Jabber_ptr(current_plugin->create());
- boost::shared_ptr<network_parameters> jabber_parameters = current_plugin->get_info();
-
- // server
- std::cout << "MSN hostname: " << msn_parameters->hostname() << std::endl;
- std::cout << "Jabber hostname: " << jabber_parameters->hostname() << std::endl;
- std::cout << std::endl;
-
- // http_mode: note that one of the implementations doesn't support it, having a base class
- // and different specific concrete network parameters allow us to handle this
- std::cout << "MSN: ";
- msn_parameters->set_http_mode();
- std::cout << "Jabber: ";
- jabber_parameters->set_http_mode();
- std::cout << std::endl;
-
- // login
- MSN_ptr->login("testuser", "testpass");
- Jabber_ptr->login("testuser", "testpass");
- std::cout << std::endl;
+ // create the factory_map object - it will hold all of the available
+ // constructors. Multiple factory_maps can be constructed.
+ factory_map fm;
+
+ // load the shared library with
+ load_single_library(fm, "libIMPlugins.extension",
+ "extension_export_plugins");
+
+ // get a reference to the list of constructors for protocols
+ std::list< factory<protocol, boost::shared_ptr<network_parameters> > > &
+ factory_list = fm.get<protocol, boost::shared_ptr<network_parameters> >();
+
+ if (factory_list.size() < 2) {
+ std::cout << "Error - the classes were not found.";
+ return 1;
+ }
+
+ std::list<factory< protocol,
+ boost::shared_ptr<network_parameters> > >::iterator current_plugin =
+ factory_list.begin();
+
+ // MSN plugin
+ std::auto_ptr<protocol> MSN_ptr(current_plugin->create());
+ boost::shared_ptr<network_parameters> msn_parameters =
+ current_plugin->get_info();
+ current_plugin++;
+
+ // Jabber plugin
+ std::auto_ptr<protocol> Jabber_ptr(current_plugin->create());
+ boost::shared_ptr<network_parameters> jabber_parameters =
+ current_plugin->get_info();
+
+ // server
+ std::cout << "MSN hostname: " << msn_parameters->hostname() << std::endl;
+ std::cout << "Jabber hostname: " << jabber_parameters->hostname()
+ << std::endl;
+ std::cout << std::endl;
+
+ // http_mode: note that one of the implementations doesn't support it,
+ // having a base class
+ // and different specific concrete network parameters allow us to handle this
+ std::cout << "MSN: ";
+ msn_parameters->set_http_mode();
+ std::cout << "Jabber: ";
+ jabber_parameters->set_http_mode();
+ std::cout << std::endl;
+
+ // login
+ MSN_ptr->login("testuser", "testpass");
+ Jabber_ptr->login("testuser", "testpass");
+ std::cout << std::endl;
- // send message
- MSN_ptr->send("hi");
- Jabber_ptr->send("hi");
- std::cout << std::endl;
+ // send message
+ MSN_ptr->send("hi");
+ Jabber_ptr->send("hi");
+ std::cout << std::endl;
- // change status
- MSN_ptr->change_status("away");
- Jabber_ptr->change_status("away");
- std::cout << std::endl;
-
- // wait for message
- std::cout << MSN_ptr->receive() << std::endl;
- std::cout << Jabber_ptr->receive() << std::endl;
- std::cout << std::endl;
+ // change status
+ MSN_ptr->change_status("away");
+ Jabber_ptr->change_status("away");
+ std::cout << std::endl;
+
+ // wait for message
+ std::cout << MSN_ptr->receive() << std::endl;
+ std::cout << Jabber_ptr->receive() << std::endl;
+ std::cout << std::endl;
- return 0;
+ return 0;
}
Modified: sandbox/libs/extension/examples/info/im/network_parameters.hpp
==============================================================================
--- sandbox/libs/extension/examples/info/im/network_parameters.hpp (original)
+++ sandbox/libs/extension/examples/info/im/network_parameters.hpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,7 +1,12 @@
-/* (C) Copyright Mariano G. Consoni 2007
- * Distributed under the Boost Software License, Version 1.0. (See
+/*
+ * Boost.Extension / network parameters (info class)
+ *
+ * (C) Copyright Mariano G. Consoni 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
* accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
*/
#include <string>
@@ -26,7 +31,9 @@
virtual std::string hostname(void) { return "msn.messenger.com"; }
virtual std::string port(void) { return "1863"; }
- virtual void set_http_mode(void) { std::cout << "http mode set" << std::endl; }
+ virtual void set_http_mode(void) {
+ std::cout << "http mode set" << std::endl;
+ }
virtual ~MSN_network_parameters() {}
};
@@ -40,7 +47,9 @@
virtual std::string hostname(void) { return "jabber.org"; }
virtual std::string port(void) { return "7063"; }
- virtual void set_http_mode(void) { std::cout << "http mode not supported" << std::endl; }
+ virtual void set_http_mode(void) {
+ std::cout << "http mode not supported" << std::endl;
+ }
virtual ~Jabber_network_parameters() {}
};
Modified: sandbox/libs/extension/examples/info/im/plugins.cpp
==============================================================================
--- sandbox/libs/extension/examples/info/im/plugins.cpp (original)
+++ sandbox/libs/extension/examples/info/im/plugins.cpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,7 +1,12 @@
-/* (C) Copyright Mariano G. Consoni 2007
- * Distributed under the Boost Software License, Version 1.0. (See
+/*
+ * Boost.Extension / IM plugins
+ *
+ * (C) Copyright Mariano G. Consoni 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
* accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
*/
@@ -17,10 +22,19 @@
class MSN : public protocol
{
public:
- virtual void login(const std::string &user, const std::string &pass) { std::cout << "MSN: Logged In" << std::endl; }
- virtual void send(const std::string &msg) { std::cout << "MSN: message [" << msg << "] sent" << std::endl; }
- virtual std::string receive(void) { return std::string("MSN: hello! msg received"); }
- virtual void change_status(const std::string &new_status) { std::cout << "MSN: Status changed to [" << new_status << "]" << std::endl; }
+ virtual void login(const std::string &user, const std::string &pass) {
+ std::cout << "MSN: Logged In" << std::endl;
+ }
+ virtual void send(const std::string &msg) {
+ std::cout << "MSN: message [" << msg << "] sent" << std::endl;
+ }
+ virtual std::string receive(void) {
+ return std::string("MSN: hello! msg received");
+ }
+ virtual void change_status(const std::string &new_status) {
+ std::cout << "MSN: Status changed to [" << new_status << "]"
+ << std::endl;
+ }
virtual ~MSN(void) {}
};
@@ -29,20 +43,30 @@
class Jabber : public protocol
{
public:
- virtual void login(const std::string &user, const std::string &pass) { std::cout << "Jabber: Logged In" << std::endl; }
- virtual void send(const std::string &msg) { std::cout << "Jabber: message [" << msg << "] sent" << std::endl; }
- virtual std::string receive(void) { return std::string("Jabber: hello! msg received"); }
- virtual void change_status(const std::string &new_status) { std::cout << "Jabber: Status changed to [" << new_status << "]" << std::endl; }
+ virtual void login(const std::string &user, const std::string &pass) {
+ std::cout << "Jabber: Logged In" << std::endl;
+ }
+ virtual void send(const std::string &msg) {
+ std::cout << "Jabber: message [" << msg << "] sent" << std::endl;
+ }
+ virtual std::string receive(void) {
+ return std::string("Jabber: hello! msg received");
+ }
+ virtual void change_status(const std::string &new_status) {
+ std::cout << "Jabber: Status changed to [" << new_status << "]"
+ << std::endl;
+ }
virtual ~Jabber(void) {}
};
-extern "C" void BOOST_EXTENSION_EXPORT_DECL extension_export_plugins(boost::extensions::factory_map & fm)
+extern "C" void BOOST_EXTENSION_EXPORT_DECL
+extension_export_plugins(boost::extensions::factory_map & fm)
{
- fm.add< MSN, protocol, boost::shared_ptr<network_parameters> >
- (boost::shared_ptr<network_parameters>(new MSN_network_parameters));
- fm.add< Jabber, protocol, boost::shared_ptr<network_parameters> >
- (boost::shared_ptr<network_parameters>(new Jabber_network_parameters));
+ fm.add< MSN, protocol, boost::shared_ptr<network_parameters> >
+ (boost::shared_ptr<network_parameters>(new MSN_network_parameters));
+ fm.add< Jabber, protocol, boost::shared_ptr<network_parameters> >
+ (boost::shared_ptr<network_parameters>(new Jabber_network_parameters));
}
Modified: sandbox/libs/extension/examples/info/im/protocol.hpp
==============================================================================
--- sandbox/libs/extension/examples/info/im/protocol.hpp (original)
+++ sandbox/libs/extension/examples/info/im/protocol.hpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,7 +1,12 @@
-/* (C) Copyright Mariano G. Consoni 2007
- * Distributed under the Boost Software License, Version 1.0. (See
+/*
+ * Boost.Extension / protocol interface
+ *
+ * (C) Copyright Mariano G. Consoni 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
* accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
*/
#include <string>
Modified: sandbox/libs/extension/examples/info/multilanguage_hello_world.cpp
==============================================================================
--- sandbox/libs/extension/examples/info/multilanguage_hello_world.cpp (original)
+++ sandbox/libs/extension/examples/info/multilanguage_hello_world.cpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,7 +1,12 @@
-/* (C) Copyright Mariano G. Consoni 2007
- * Distributed under the Boost Software License, Version 1.0. (See
+/*
+ * Boost.Extension / multilanguage hello world implementations
+ *
+ * (C) Copyright Mariano G. Consoni 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
* accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
*/
#include "word_description.hpp"
@@ -11,64 +16,66 @@
class world : public word
{
public:
- virtual const char * get_val(){return "world!";}
+ virtual const char * get_val(){return "world!";}
};
class mundo : public word
{
public:
- virtual const char * get_val(){return "mundo!";}
+ virtual const char * get_val(){return "mundo!";}
};
class monde : public word
{
public:
- virtual const char * get_val(){return "monde!";}
+ virtual const char * get_val(){return "monde!";}
};
class mondo : public word
{
public:
- virtual const char * get_val(){return "mondo!";}
+ virtual const char * get_val(){return "mondo!";}
};
class hello : public word
{
public:
- virtual const char * get_val(){return "hello";}
+ virtual const char * get_val(){return "hello";}
};
class hola : public word
{
public:
- virtual const char * get_val(){return "hola";}
+ virtual const char * get_val(){return "hola";}
};
class bonjour : public word
{
public:
- virtual const char * get_val(){return "bonjour";}
+ virtual const char * get_val(){return "bonjour";}
};
class buonasera : public word
{
public:
- virtual const char * get_val(){return "buonasera";}
+ virtual const char * get_val(){return "buonasera";}
};
-extern "C" void BOOST_EXTENSION_EXPORT_DECL extension_export_multilanguage_word(boost::extensions::factory_map & fm)
+extern "C" void BOOST_EXTENSION_EXPORT_DECL
+extension_export_multilanguage_word(boost::extensions::factory_map & fm)
{
- fm.add<hola, word, word_description>(word_description("spanish", "hello"));
- fm.add<mundo, word, word_description>(word_description("spanish", "world!"));
+ fm.add<hola, word, word_description>(word_description("spanish", "hello"));
+ fm.add<mundo, word, word_description>(word_description("spanish", "world!"));
- fm.add<bonjour, word, word_description>(word_description("french", "hello"));
- fm.add<monde, word, word_description>(word_description("french", "world!"));
+ fm.add<bonjour, word, word_description>(word_description("french", "hello"));
+ fm.add<monde, word, word_description>(word_description("french", "world!"));
- fm.add<buonasera, word, word_description>(word_description("italian", "hello"));
- fm.add<mondo, word, word_description>(word_description("italian", "world!"));
+ fm.add<buonasera, word, word_description>(word_description("italian",
+ "hello"));
+ fm.add<mondo, word, word_description>(word_description("italian", "world!"));
- fm.add<hello, word, word_description>(word_description("english", "hello"));
- fm.add<world, word, word_description>(word_description("english", "world!"));
+ fm.add<hello, word, word_description>(word_description("english", "hello"));
+ fm.add<world, word, word_description>(word_description("english", "world!"));
}
Modified: sandbox/libs/extension/examples/info/multilanguage_main.cpp
==============================================================================
--- sandbox/libs/extension/examples/info/multilanguage_main.cpp (original)
+++ sandbox/libs/extension/examples/info/multilanguage_main.cpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,7 +1,12 @@
-/* (C) Copyright Mariano G. Consoni 2007
- * Distributed under the Boost Software License, Version 1.0. (See
+/*
+ * Boost.Extension / multilanguage hello world main
+ *
+ * (C) Copyright Mariano G. Consoni 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
* accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
*/
#include <boost/extension/factory_map.hpp>
@@ -14,32 +19,38 @@
int main()
{
- using namespace boost::extensions;
- // Create the factory_map object - it will hold all of the available
+ using namespace boost::extensions;
+ // Create the factory_map object - it will hold all of the available
// constructors. Multiple factory_maps can be constructed.
- factory_map fm;
-
- // load the shared library with
- load_single_library(fm, "libMultilanguageHelloWorld.extension", "extension_export_multilanguage_word");
- // Get a reference to the list of constructors for words.
- std::list<factory<word, word_description> > & factory_list = fm.get<word, word_description>();
-
- if (factory_list.size() < 4+4) {
- std::cout << "Error - the classes were not found (" << factory_list.size() << " classes)" << std::endl;
- return 1;
- }
-
- for (std::list<factory<word, word_description> >::iterator current_word = factory_list.begin();
- current_word != factory_list.end(); ++current_word)
- {
- // Using auto_ptr to avoid needing delete. Using smart_ptrs is recommended.
- // Note that this has a zero argument constructor - currently constructors
- // with up to six arguments can be used.
- std::auto_ptr<word> word_ptr(current_word->create());
- std::cout << word_ptr->get_val() << " is " << current_word->get_info().english_translation
- << " in " << current_word->get_info().language << std::endl;
- }
- std::cout << std::endl;
-
- return 0;
+ factory_map fm;
+
+ // load the shared library with
+ load_single_library(fm, "libMultilanguageHelloWorld.extension",
+ "extension_export_multilanguage_word");
+ // Get a reference to the list of constructors for words.
+ std::list<factory<word, word_description> > & factory_list =
+ fm.get<word, word_description>();
+
+ if (factory_list.size() < 4+4) {
+ std::cout << "Error - the classes were not found ("
+ << factory_list.size() << " classes)" << std::endl;
+ return 1;
+ }
+
+ for (std::list<factory<word, word_description> >::iterator current_word =
+ factory_list.begin(); current_word != factory_list.end();
+ ++current_word) {
+ // Using auto_ptr to avoid needing delete. Using smart_ptrs
+ // is recommended.
+ // Note that this has a zero argument constructor - currently
+ // constructors with up to six arguments can be used.
+ std::auto_ptr<word> word_ptr(current_word->create());
+ std::cout << word_ptr->get_val() << " is "
+ << current_word->get_info().english_translation
+ << " in " << current_word->get_info().language
+ << std::endl;
+ }
+ std::cout << std::endl;
+
+ return 0;
}
Modified: sandbox/libs/extension/examples/info/word_description.hpp
==============================================================================
--- sandbox/libs/extension/examples/info/word_description.hpp (original)
+++ sandbox/libs/extension/examples/info/word_description.hpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,7 +1,12 @@
-/* (C) Copyright Mariano G. Consoni 2007
- * Distributed under the Boost Software License, Version 1.0. (See
+/*
+ * Boost.Extension / info class for interface
+ *
+ * (C) Copyright Mariano G. Consoni 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
* accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
*/
#include "../word.hpp"
@@ -10,9 +15,9 @@
// info class for word interface
struct word_description
{
- std::string language;
- std::string english_translation;
+ std::string language;
+ std::string english_translation;
- word_description(std::string language, std::string english_translation)
- : language(language), english_translation(english_translation) {}
+ word_description(std::string language, std::string english_translation)
+ : language(language), english_translation(english_translation) {}
};
Modified: sandbox/libs/extension/examples/main.cpp
==============================================================================
--- sandbox/libs/extension/examples/main.cpp (original)
+++ sandbox/libs/extension/examples/main.cpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,7 +1,12 @@
-/* (C) Copyright Jeremy Pack 2007
- * Distributed under the Boost Software License, Version 1.0. (See
+/*
+ * Boost.Extension / hello world example main
+ *
+ * (C) Copyright Jeremy Pack 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
* accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
*/
#include <boost/extension/factory_map.hpp>
@@ -9,6 +14,7 @@
#include <iostream>
#include <boost/extension/convenience.hpp>
#include "word.hpp"
+
int main()
{
using namespace boost::extensions;
@@ -16,15 +22,18 @@
// constructors. Multiple factory_maps can be constructed.
factory_map fm;
// load the shared library with
- load_single_library(fm, "libHelloWorldLib.extension", "extension_export_word");
+ load_single_library(fm, "libHelloWorldLib.extension",
+ "extension_export_word");
// Get a reference to the list of constructors for words.
std::list<factory<word, int> > & factory_list = fm.get<word, int>();
if (factory_list.size() < 2)
std::cout << "Error - the classes were not found.";
- for (std::list<factory<word, int> >::iterator current_word = factory_list.begin();
- current_word != factory_list.end(); ++current_word)
+ for (std::list<factory<word, int> >::iterator current_word =
+ factory_list.begin(); current_word != factory_list.end();
+ ++current_word)
{
- // Using auto_ptr to avoid needing delete. Using smart_ptrs is recommended.
+ // Using auto_ptr to avoid needing delete. Using smart_ptrs is
+ // recommended.
// Note that this has a zero argument constructor - currently constructors
// with up to six arguments can be used.
std::auto_ptr<word> word_ptr(current_word->create());
@@ -32,4 +41,4 @@
}
std::cout << "\n";
return 0;
-}
\ No newline at end of file
+}
Modified: sandbox/libs/extension/examples/multiple_inheritance/boat.cpp
==============================================================================
--- sandbox/libs/extension/examples/multiple_inheritance/boat.cpp (original)
+++ sandbox/libs/extension/examples/multiple_inheritance/boat.cpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,3 +1,14 @@
+/*
+ * Boost.Extension / multiple inheritance example (boat)
+ *
+ * (C) Copyright Jeremy Pack 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
+ */
+
/* The following lines are only necessary because when
are linking to this dll at compile time with another
@@ -19,8 +30,9 @@
return "\nIt floats on water.";
}
-extern "C" void BOOST_EXTENSION_EXPORT_DECL extension_export(boost::extensions::factory_map & z)
+extern "C" void BOOST_EXTENSION_EXPORT_DECL
+extension_export(boost::extensions::factory_map & z)
{
z.add<boat, vehicle, std::string>("A boat exported as a vehicle");
z.add<boat, boat, std::string>("A boat exported as a boat");
-}
\ No newline at end of file
+}
Modified: sandbox/libs/extension/examples/multiple_inheritance/boat.hpp
==============================================================================
--- sandbox/libs/extension/examples/multiple_inheritance/boat.hpp (original)
+++ sandbox/libs/extension/examples/multiple_inheritance/boat.hpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,3 +1,14 @@
+/*
+ * Boost.Extension / multiple inheritance example (boat)
+ *
+ * (C) Copyright Jeremy Pack 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
+ */
+
#ifndef BOOST_EXTENSION_BOAT_HPP
#define BOOST_EXTENSION_BOAT_HPP
// See the FAQ for info about why the following is necessary
@@ -15,4 +26,4 @@
virtual std::string list_capabilities(void);
};
-#endif
\ No newline at end of file
+#endif
Modified: sandbox/libs/extension/examples/multiple_inheritance/car.cpp
==============================================================================
--- sandbox/libs/extension/examples/multiple_inheritance/car.cpp (original)
+++ sandbox/libs/extension/examples/multiple_inheritance/car.cpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,3 +1,15 @@
+/*
+ * Boost.Extension / multiple inheritance example (car)
+ *
+ * (C) Copyright Jeremy Pack 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
+ */
+
+
/* The following lines are only necessary because when
are linking to this dll at compile time with another
dll on Windows. As such, standard __declspec stuff
@@ -19,8 +31,9 @@
return "\nIt travels on roads.";
}
-extern "C" void BOOST_EXTENSION_EXPORT_DECL extension_export(boost::extensions::factory_map & z)
+extern "C" void BOOST_EXTENSION_EXPORT_DECL
+extension_export(boost::extensions::factory_map & z)
{
z.add<car, vehicle, std::string>("A car exported as a vehicle");
z.add<car, car, std::string>("A car exported as a car");
-}
\ No newline at end of file
+}
Modified: sandbox/libs/extension/examples/multiple_inheritance/car.hpp
==============================================================================
--- sandbox/libs/extension/examples/multiple_inheritance/car.hpp (original)
+++ sandbox/libs/extension/examples/multiple_inheritance/car.hpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,3 +1,14 @@
+/*
+ * Boost.Extension / multiple inheritance example (car)
+ *
+ * (C) Copyright Jeremy Pack 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
+ */
+
#ifndef BOOST_EXTENSION_CAR_HPP
#define BOOST_EXTENSION_CAR_HPP
// See the FAQ for info about why the following is necessary
@@ -14,4 +25,4 @@
virtual std::string list_capabilities(void);
};
-#endif
\ No newline at end of file
+#endif
Modified: sandbox/libs/extension/examples/multiple_inheritance/car_of_the_future.cpp
==============================================================================
--- sandbox/libs/extension/examples/multiple_inheritance/car_of_the_future.cpp (original)
+++ sandbox/libs/extension/examples/multiple_inheritance/car_of_the_future.cpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,3 +1,15 @@
+/*
+ * Boost.Extension / multiple inheritance example (car of the future)
+ *
+ * (C) Copyright Jeremy Pack 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
+ */
+
+
/* The following lines are only necessary because when
are linking to this dll at compile time with another
dll on Windows. As such, standard __declspec stuff
@@ -19,7 +31,8 @@
computer::list_capabilities() + "\nCosts an arm and a leg";
}
-extern "C" void BOOST_EXTENSION_EXPORT_DECL extension_export(boost::extensions::factory_map & z)
+extern "C" void BOOST_EXTENSION_EXPORT_DECL
+extension_export(boost::extensions::factory_map & z)
{
z.add<car_of_the_future, vehicle, std::string>
("A car of the future exported as a vehicle");
@@ -35,4 +48,4 @@
("A car of the future exported as a computer");
z.add<car_of_the_future, car_of_the_future, std::string>
("A car of the future exported as a car of the future");
-}
\ No newline at end of file
+}
Modified: sandbox/libs/extension/examples/multiple_inheritance/car_of_the_future.hpp
==============================================================================
--- sandbox/libs/extension/examples/multiple_inheritance/car_of_the_future.hpp (original)
+++ sandbox/libs/extension/examples/multiple_inheritance/car_of_the_future.hpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,3 +1,14 @@
+/*
+ * Boost.Extension / multiple inheritance example (car of the future)
+ *
+ * (C) Copyright Jeremy Pack 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
+ */
+
#ifndef BOOST_EXTENSION_CAR_OF_THE_FUTURE_HPP
#define BOOST_EXTENSION_CAR_OF_THE_FUTURE_HPP
// See the FAQ for info about why the following is necessary
@@ -19,4 +30,4 @@
virtual std::string list_capabilities(void);
};
-#endif
\ No newline at end of file
+#endif
Modified: sandbox/libs/extension/examples/multiple_inheritance/computer.cpp
==============================================================================
--- sandbox/libs/extension/examples/multiple_inheritance/computer.cpp (original)
+++ sandbox/libs/extension/examples/multiple_inheritance/computer.cpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,3 +1,14 @@
+/*
+ * Boost.Extension / multiple inheritance example (computer)
+ *
+ * (C) Copyright Jeremy Pack 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
+ */
+
/* The following lines are only necessary because when
are linking to this dll at compile time with another
dll on Windows. As such, standard __declspec stuff
@@ -19,7 +30,9 @@
return "\nIt computes.";
}
-extern "C" void BOOST_EXTENSION_EXPORT_DECL extension_export(boost::extensions::factory_map & z)
+extern "C" void BOOST_EXTENSION_EXPORT_DECL
+extension_export(boost::extensions::factory_map & z)
{
- z.add<computer, computer, std::string>("\nA computer exported as a computer");
-}
\ No newline at end of file
+ z.add<computer, computer,
+ std::string>("\nA computer exported as a computer");
+}
Modified: sandbox/libs/extension/examples/multiple_inheritance/computer.hpp
==============================================================================
--- sandbox/libs/extension/examples/multiple_inheritance/computer.hpp (original)
+++ sandbox/libs/extension/examples/multiple_inheritance/computer.hpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,3 +1,14 @@
+/*
+ * Boost.Extension / multiple inheritance example (computer)
+ *
+ * (C) Copyright Jeremy Pack 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
+ */
+
#ifndef BOOST_EXTENSION_COMPUTER_HPP
#define BOOST_EXTENSION_COMPUTER_HPP
#include <boost/extension/extension.hpp>
Modified: sandbox/libs/extension/examples/multiple_inheritance/flying_car.cpp
==============================================================================
--- sandbox/libs/extension/examples/multiple_inheritance/flying_car.cpp (original)
+++ sandbox/libs/extension/examples/multiple_inheritance/flying_car.cpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,3 +1,15 @@
+/*
+ * Boost.Extension / multiple inheritance example (flying car)
+ *
+ * (C) Copyright Jeremy Pack 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
+ */
+
+
/* The following lines are only necessary because when
are linking to this dll at compile time with another
dll on Windows. As such, standard __declspec stuff
@@ -16,13 +28,17 @@
std::string flying_car::list_capabilities()
{
- return car::list_capabilities() + plane::list_capabilities() + "\nIt takes off from your driveway";
+ return car::list_capabilities() + plane::list_capabilities()
+ + "\nIt takes off from your driveway";
}
-extern "C" void BOOST_EXTENSION_EXPORT_DECL extension_export(boost::extensions::factory_map & z)
+extern "C" void BOOST_EXTENSION_EXPORT_DECL
+extension_export(boost::extensions::factory_map & z)
{
- z.add<flying_car, vehicle, std::string>("A flying car exported as a vehicle");
+ z.add<flying_car, vehicle,
+ std::string>("A flying car exported as a vehicle");
z.add<flying_car, plane, std::string>("A flying car exported as a plane");
z.add<flying_car, car, std::string>("A flying car exported as a car");
- z.add<flying_car, flying_car, std::string>("A flying car exported as a flying car");
-}
\ No newline at end of file
+ z.add<flying_car, flying_car,
+ std::string>("A flying car exported as a flying car");
+}
Modified: sandbox/libs/extension/examples/multiple_inheritance/flying_car.hpp
==============================================================================
--- sandbox/libs/extension/examples/multiple_inheritance/flying_car.hpp (original)
+++ sandbox/libs/extension/examples/multiple_inheritance/flying_car.hpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,3 +1,15 @@
+/*
+ * Boost.Extension / multiple inheritance example (flying car)
+ *
+ * (C) Copyright Jeremy Pack 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
+ */
+
+
#ifndef BOOST_EXTENSION_FLYING_CAR_HPP
#define BOOST_EXTENSION_FLYING_CAR_HPP
// See the FAQ for info about why the following is necessary
@@ -16,4 +28,4 @@
virtual std::string list_capabilities(void);
};
-#endif
\ No newline at end of file
+#endif
Modified: sandbox/libs/extension/examples/multiple_inheritance/main_mi.cpp
==============================================================================
--- sandbox/libs/extension/examples/multiple_inheritance/main_mi.cpp (original)
+++ sandbox/libs/extension/examples/multiple_inheritance/main_mi.cpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,8 +1,13 @@
-/* (C) Copyright Jeremy Pack 2007
-* Distributed under the Boost Software License, Version 1.0. (See
-* accompanying file LICENSE_1_0.txt or copy at
-* http://www.boost.org/LICENSE_1_0.txt)
-*/
+/*
+ * Boost.Extension / multiple inheritance example (main)
+ *
+ * (C) Copyright Jeremy Pack 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
+ */
#include <boost/extension/factory_map.hpp>
#include <boost/extension/shared_library.hpp>
@@ -27,21 +32,25 @@
load_single_library(twilight, "libComputer.extension", "extension_export");
load_single_library(twilight, "libBoat.extension", "extension_export");
load_single_library(twilight, "libFlyingCar.extension", "extension_export");
- load_single_library(twilight, "libCarOfTheFuture.extension", "extension_export");
+ load_single_library(twilight, "libCarOfTheFuture.extension",
+ "extension_export");
load_single_library(twilight, "libPlane.extension", "extension_export");
// load_all_libraries(twilight, "./", "extension_export_word");
// Get a reference to the list of constructors.
- // Note that the factories can be copied just fine - meaning that the factory list
- // can be copied from the factory_map object into a different data structure, and the factory_map
- // can be destroyed.
+ // Note that the factories can be copied just fine - meaning that the
+ // factory list
+ // can be copied from the factory_map object into a different data
+ // structure, and the factory_map can be destroyed.
std::cout << "\n>>>>>>>>>>>>\nComputers:\n>>>>>>>>>>>>>>>>>>>";
- std::list<factory<computer, std::string> > & factory_list = twilight.get<computer, std::string>();
+ std::list<factory<computer, std::string> > & factory_list =
+ twilight.get<computer, std::string>();
if (factory_list.size() < 1)
std::cout << "Error - no computers were found.";
- for (std::list<factory<computer, std::string> >::iterator comp = factory_list.begin();
- comp != factory_list.end(); ++comp)
+ for (std::list<factory<computer, std::string> >::iterator comp =
+ factory_list.begin(); comp != factory_list.end(); ++comp)
{
- // Using auto_ptr to avoid needing delete. Using smart_ptrs is recommended.
+ // Using auto_ptr to avoid needing delete. Using smart_ptrs is
+ // recommended.
// Note that this has a zero argument constructor - currently constructors
// with up to six arguments can be used.
std::auto_ptr<computer> computer_ptr(comp->create());
@@ -55,13 +64,15 @@
std::cout << "\n>>>>>>>>>>>>\nVehicles:\n>>>>>>>>>>>>>>>>>>>";
- std::list<factory<vehicle, std::string> > & factory_list2 = twilight.get<vehicle, std::string>();
+ std::list<factory<vehicle, std::string> > & factory_list2 =
+ twilight.get<vehicle, std::string>();
if (factory_list2.size() < 1)
std::cout << "Error - no vehicles were found.";
- for (std::list<factory<vehicle, std::string> >::iterator comp = factory_list2.begin();
- comp != factory_list2.end(); ++comp)
+ for (std::list<factory<vehicle, std::string> >::iterator comp =
+ factory_list2.begin(); comp != factory_list2.end(); ++comp)
{
- // Using auto_ptr to avoid needing delete. Using smart_ptrs is recommended.
+ // Using auto_ptr to avoid needing delete. Using smart_ptrs is
+ // recommended.
// Note that this has a zero argument constructor - currently constructors
// with up to six arguments can be used.
std::auto_ptr<vehicle> computer_ptr(comp->create());
@@ -72,4 +83,4 @@
}
std::cout << "\n\n";
return 0;
-}
\ No newline at end of file
+}
Modified: sandbox/libs/extension/examples/multiple_inheritance/plane.cpp
==============================================================================
--- sandbox/libs/extension/examples/multiple_inheritance/plane.cpp (original)
+++ sandbox/libs/extension/examples/multiple_inheritance/plane.cpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,3 +1,14 @@
+/*
+ * Boost.Extension / multiple inheritance example (plane)
+ *
+ * (C) Copyright Jeremy Pack 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
+ */
+
/* The following lines are only necessary because when
are linking to this dll at compile time with another
dll on Windows. As such, standard __declspec stuff
@@ -19,8 +30,9 @@
return "\nIt flies in the air.";
}
-extern "C" void BOOST_EXTENSION_EXPORT_DECL extension_export(boost::extensions::factory_map & z)
+extern "C" void BOOST_EXTENSION_EXPORT_DECL
+extension_export(boost::extensions::factory_map & z)
{
z.add<plane, vehicle, std::string>("A plane exported as a vehicle");
z.add<plane, plane, std::string>("A plane exported as a plane");
-}
\ No newline at end of file
+}
Modified: sandbox/libs/extension/examples/multiple_inheritance/plane.hpp
==============================================================================
--- sandbox/libs/extension/examples/multiple_inheritance/plane.hpp (original)
+++ sandbox/libs/extension/examples/multiple_inheritance/plane.hpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,3 +1,15 @@
+/*
+ * Boost.Extension / multiple inheritance example (plane)
+ *
+ * (C) Copyright Jeremy Pack 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
+ */
+
+
#ifndef BOOST_EXTENSION_PLANE_HPP
#define BOOST_EXTENSION_PLANE_HPP
// See the FAQ for info about why the following is necessary
@@ -14,4 +26,4 @@
virtual std::string list_capabilities(void);
};
-#endif
\ No newline at end of file
+#endif
Modified: sandbox/libs/extension/examples/multiple_inheritance/vehicle.cpp
==============================================================================
--- sandbox/libs/extension/examples/multiple_inheritance/vehicle.cpp (original)
+++ sandbox/libs/extension/examples/multiple_inheritance/vehicle.cpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,3 +1,14 @@
+/*
+ * Boost.Extension / multiple inheritance example (vehicle)
+ *
+ * (C) Copyright Jeremy Pack 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
+ */
+
/* The following lines are only necessary because when
are linking to this dll at compile time with another
dll on Windows. As such, standard __declspec stuff
@@ -18,7 +29,8 @@
return "\nIt is some sort of vehicle.";
}
-extern "C" void BOOST_EXTENSION_EXPORT_DECL extension_export(boost::extensions::factory_map & z)
+extern "C" void BOOST_EXTENSION_EXPORT_DECL
+extension_export(boost::extensions::factory_map & z)
{
z.add<vehicle, vehicle, std::string>("A vehicle exported as a vehicle");
-}
\ No newline at end of file
+}
Modified: sandbox/libs/extension/examples/multiple_inheritance/vehicle.hpp
==============================================================================
--- sandbox/libs/extension/examples/multiple_inheritance/vehicle.hpp (original)
+++ sandbox/libs/extension/examples/multiple_inheritance/vehicle.hpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,3 +1,14 @@
+/*
+ * Boost.Extension / multiple inheritance example (vehicle)
+ *
+ * (C) Copyright Jeremy Pack 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
+ */
+
#ifndef BOOST_EXTENSION_VEHICLE_HPP
#define BOOST_EXTENSION_VEHICLE_HPP
#include <boost/extension/extension.hpp>
Modified: sandbox/libs/extension/examples/parameters/lots_of_parameters.cpp
==============================================================================
--- sandbox/libs/extension/examples/parameters/lots_of_parameters.cpp (original)
+++ sandbox/libs/extension/examples/parameters/lots_of_parameters.cpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,7 +1,12 @@
-/* (C) Copyright Mariano G. Consoni 2007
- * Distributed under the Boost Software License, Version 1.0. (See
+/*
+ * Boost.Extension / lots of parameters implementation
+ *
+ * (C) Copyright Mariano G. Consoni 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
* accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
*/
#include "lots_of_parameters_interface.hpp"
@@ -12,25 +17,28 @@
class six_parameters : public lots_of_parameters_interface
{
public:
- six_parameters(bool b, unsigned int i, char c, std::string s, A a, boost::shared_ptr<A> ptr_a)
- : lots_of_parameters_interface(b, i, c, s, a, ptr_a)
- {
- std::cout << "Constructor called." << std::endl << std::endl;
- std::cout << "Parameters:" << std::endl;
- std::cout << "\tbool: " << b << std::endl;
- std::cout << "\tunsigned int: " << i << std::endl;
- std::cout << "\tchar: " << c << std::endl;
- std::cout << "\tstring: " << s << std::endl;
- std::cout << "\tA.i: " << a.i << std::endl;
- std::cout << "\tptr_a->i: " << ptr_a->i << std::endl;
- std::cout << std::endl;
- }
-
- virtual ~six_parameters(void) {}
+ six_parameters(bool b, unsigned int i, char c, std::string s, A a,
+ boost::shared_ptr<A> ptr_a)
+ : lots_of_parameters_interface(b, i, c, s, a, ptr_a)
+ {
+ std::cout << "Constructor called." << std::endl << std::endl;
+ std::cout << "Parameters:" << std::endl;
+ std::cout << "\tbool: " << b << std::endl;
+ std::cout << "\tunsigned int: " << i << std::endl;
+ std::cout << "\tchar: " << c << std::endl;
+ std::cout << "\tstring: " << s << std::endl;
+ std::cout << "\tA.i: " << a.i << std::endl;
+ std::cout << "\tptr_a->i: " << ptr_a->i << std::endl;
+ std::cout << std::endl;
+ }
+
+ virtual ~six_parameters(void) {}
};
-extern "C" void BOOST_EXTENSION_EXPORT_DECL extension_export(boost::extensions::factory_map & fm)
+extern "C" void BOOST_EXTENSION_EXPORT_DECL
+extension_export(boost::extensions::factory_map & fm)
{
- fm.add< six_parameters, lots_of_parameters_interface, int, bool, unsigned int, char, std::string, A, boost::shared_ptr<A> >(6);
+ fm.add< six_parameters, lots_of_parameters_interface, int, bool,
+ unsigned int, char, std::string, A, boost::shared_ptr<A> >(6);
}
Modified: sandbox/libs/extension/examples/parameters/lots_of_parameters_interface.hpp
==============================================================================
--- sandbox/libs/extension/examples/parameters/lots_of_parameters_interface.hpp (original)
+++ sandbox/libs/extension/examples/parameters/lots_of_parameters_interface.hpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,7 +1,12 @@
-/* (C) Copyright Mariano G. Consoni 2007
- * Distributed under the Boost Software License, Version 1.0. (See
+/*
+ * Boost.Extension / lots of parameters interface
+ *
+ * (C) Copyright Mariano G. Consoni 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
* accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
*/
#include <boost/shared_ptr.hpp>
@@ -11,15 +16,16 @@
class A
{
public:
- A(unsigned int i) : i(i) {}
- int i;
+ A(unsigned int i) : i(i) {}
+ int i;
};
class lots_of_parameters_interface
{
public:
- lots_of_parameters_interface(bool b, unsigned int i, char c, std::string s, A a, boost::shared_ptr<A> ptr_a) {}
- virtual ~lots_of_parameters_interface(void) {}
+ lots_of_parameters_interface(bool b, unsigned int i, char c, std::string s,
+ A a, boost::shared_ptr<A> ptr_a) {}
+ virtual ~lots_of_parameters_interface(void) {}
};
Modified: sandbox/libs/extension/examples/parameters/main_lp.cpp
==============================================================================
--- sandbox/libs/extension/examples/parameters/main_lp.cpp (original)
+++ sandbox/libs/extension/examples/parameters/main_lp.cpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,7 +1,12 @@
-/* (C) Copyright Mariano G. Consoni 2007
- * Distributed under the Boost Software License, Version 1.0. (See
+/*
+ * Boost.Extension / lots of parameters main
+ *
+ * (C) Copyright Mariano G. Consoni 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
* accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
*/
#include <boost/extension/factory_map.hpp>
@@ -13,25 +18,30 @@
int main(void)
{
- using namespace boost::extensions;
+ using namespace boost::extensions;
- // Create the factory_map object - it will hold all of the available
- // constructors. Multiple factory_maps can be constructed.
- factory_map fm;
+ // Create the factory_map object - it will hold all of the available
+ // constructors. Multiple factory_maps can be constructed.
+ factory_map fm;
+
+ // load the shared library with
+ load_single_library(fm, "libParametersLib.extension", "extension_export");
+
+ std::list<factory<lots_of_parameters_interface, int, bool, unsigned int,
+ char, std::string, A, boost::shared_ptr<A> > > & factory_list =
+ fm.get<lots_of_parameters_interface, int, bool, unsigned int, char,
+ std::string, A, boost::shared_ptr<A> >();
+ if (factory_list.size() != 1) {
+ std::cout << "Error - the class was not found.";
+ return 1;
+ }
+
+ std::list< factory<lots_of_parameters_interface, int, bool, unsigned int,
+ char, std::string, A, boost::shared_ptr<A> > >::iterator par =
+ factory_list.begin();
+ std::auto_ptr< lots_of_parameters_interface >
+ par_ptr(par->create(true, 4, 'c', "test", A(2),
+ boost::shared_ptr<A>(new A(15))));
- // load the shared library with
- load_single_library(fm, "libParametersLib.extension", "extension_export");
-
- std::list<factory<lots_of_parameters_interface, int, bool, unsigned int, char, std::string, A, boost::shared_ptr<A> > > & factory_list =
- fm.get<lots_of_parameters_interface, int, bool, unsigned int, char, std::string, A, boost::shared_ptr<A> >();
- if (factory_list.size() != 1) {
- std::cout << "Error - the class was not found.";
- return 1;
- }
-
- std::list< factory<lots_of_parameters_interface, int, bool, unsigned int, char, std::string, A, boost::shared_ptr<A> > >::iterator par = factory_list.begin();
- std::auto_ptr< lots_of_parameters_interface > par_ptr(par->create(true, 4, 'c', "test", A(2), boost::shared_ptr<A>(new A(15))));
-
-
- return 0;
+ return 0;
}
Modified: sandbox/libs/extension/examples/registry/registry_example.cpp
==============================================================================
--- sandbox/libs/extension/examples/registry/registry_example.cpp (original)
+++ sandbox/libs/extension/examples/registry/registry_example.cpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,8 +1,14 @@
-/* (C) Copyright Jeremy Pack 2007
- * Distributed under the Boost Software License, Version 1.0. (See
+/*
+ * Boost.Extension / registry class use example
+ *
+ * (C) Copyright Jeremy Pack 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
* accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
*/
+
#include "../word.hpp"
#include <boost/extension/registry.hpp>
#include <iostream>
@@ -13,7 +19,8 @@
registry reg;
reg.open("../bin/libRegistryLibrary.extension");
{
- std::list<counted_factory<word, int> > & factory_list = reg.get<word, int>();
+ std::list<counted_factory<word, int> > & factory_list =
+ reg.get<word, int>();
if (factory_list.size() != 1) {
std::cout << "Expected to see one class available - found: "
<< factory_list.size() << std::endl;
@@ -24,24 +31,29 @@
const char * value;
if (strcmp(value = w->get_val(), "First Time") != 0)
{
- std::cout << "The string's value should have been \"First Time\" but was: "
+ std::cout << "The string's value should have been \"First Time\" "
+ << "but was: "
<< value << std::endl;
return -1;
}
if (strcmp(value = w->get_val(), "Second Time") != 0)
{
- std::cout << "The string's value should have been \"Second Time\" but was: "
+ std::cout << "The string's value should have been \"Second Time\" "
+ << "but was: "
<< value << std::endl;
return -1;
}
}
}
- reg.clear(); // This closes libregistry_library.extension, since none of its
- // classes are instantiated any more.
+
+ // This closes libregistry_library.extension, since none of
+ // its classes are instantiated any more.
+ reg.clear();
// Now we can repeat the above - with the same results.
{
reg.open("../bin/libRegistryLibrary.extension");
- std::list<counted_factory<word, int> > & factory_list = reg.get<word, int>();
+ std::list<counted_factory<word, int> > & factory_list =
+ reg.get<word, int>();
if (factory_list.size() != 1)
{
std::cout << "Expected to see one class available - found: "
@@ -53,16 +65,18 @@
const char * value;
if (strcmp(value = w->get_val(), "First Time") != 0)
{
- std::cout << "The string's value should have been \"First Time\" but was: "
- << value << std::endl;
+ std::cout << "The string's value should have been \"First Time\" "
+ << "but was: "
+ << value << std::endl;
return -1;
}
if (strcmp(value = w->get_val(), "Second Time") != 0)
{
- std::cout << "The string's value should have been \"Second Time\" but was: "
- << value << std::endl;
+ std::cout << "The string's value should have been \"Second Time\" "
+ << "but was: "
+ << value << std::endl;
return -1;
}
}
}
-}
\ No newline at end of file
+}
Modified: sandbox/libs/extension/examples/registry/registry_library.cpp
==============================================================================
--- sandbox/libs/extension/examples/registry/registry_library.cpp (original)
+++ sandbox/libs/extension/examples/registry/registry_library.cpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,8 +1,13 @@
-/* (C) Copyright Jeremy Pack 2007
-* Distributed under the Boost Software License, Version 1.0. (See
-* accompanying file LICENSE_1_0.txt or copy at
-* http://www.boost.org/LICENSE_1_0.txt)
-*/
+/*
+ * Boost.Extension / registry class use example (library)
+ *
+ * (C) Copyright Jeremy Pack 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
+ */
#include <boost/extension/counted_factory_map.hpp>
#include <boost/extension/extension.hpp>
@@ -34,7 +39,8 @@
}
};
// Using the default function name for loading registries:
-extern "C" void BOOST_EXTENSION_EXPORT_DECL boost_extension_registry_function(counted_factory_map & fm)
+extern "C" void BOOST_EXTENSION_EXPORT_DECL
+boost_extension_registry_function(counted_factory_map & fm)
{
// 5 is just an identifier - not used in this example.
// Arbitrary information (not just an int) can be stored
Modified: sandbox/libs/extension/examples/versioning/hello_world_versions.cpp
==============================================================================
--- sandbox/libs/extension/examples/versioning/hello_world_versions.cpp (original)
+++ sandbox/libs/extension/examples/versioning/hello_world_versions.cpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,9 +1,15 @@
-/* (C) Copyright Mariano G. Consoni 2007
- * Distributed under the Boost Software License, Version 1.0. (See
+/*
+ * Boost.Extension / hello world versions implementations
+ *
+ * (C) Copyright Mariano G. Consoni 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
* accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
*/
+
#include "../word.hpp"
#include <boost/extension/factory_map.hpp>
@@ -17,8 +23,9 @@
public:
virtual const char * get_val(){return "| v2 hello";}
};
-extern "C" void BOOST_EXTENSION_EXPORT_DECL extension_export_word(boost::extensions::factory_map & fm)
+extern "C" void BOOST_EXTENSION_EXPORT_DECL
+extension_export_word(boost::extensions::factory_map & fm)
{
- fm.add<hello, word, int>(21); // int could be used as version (v2 word 1)
- fm.add<world, word, int>(22); // int could be used as version (v2 word 2)
+ fm.add<hello, word, int>(21); // int could be used as version (v2 word 1)
+ fm.add<world, word, int>(22); // int could be used as version (v2 word 2)
}
Modified: sandbox/libs/extension/examples/versioning/main_versions.cpp
==============================================================================
--- sandbox/libs/extension/examples/versioning/main_versions.cpp (original)
+++ sandbox/libs/extension/examples/versioning/main_versions.cpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,9 +1,15 @@
-/* (C) Copyright Mariano G. Consoni 2007
- * Distributed under the Boost Software License, Version 1.0. (See
+/*
+ * Boost.Extension / hello world versions main
+ *
+ * (C) Copyright Mariano G. Consoni 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
* accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
*/
+
#include <boost/extension/factory_map.hpp>
#include <boost/extension/shared_library.hpp>
#include <boost/extension/convenience.hpp>
@@ -16,63 +22,75 @@
int main(void)
{
- using namespace boost::extensions;
+ using namespace boost::extensions;
- // Create the factory_map object - it will hold all of the available
- // constructors. Multiple factory_maps can be constructed.
- factory_map fm;
-
- // load hello world first version
- load_single_library(fm, "libHelloWorldLib.extension", "extension_export_word");
-
- // load hello world second version
- load_single_library(fm, "libHelloWorldLibv2.extension", "extension_export_word");
-
- // load hello world second version again
- load_single_library(fm, "libHelloWorldLibv2.extension", "extension_export_word");
-
- // load salute library (with hello included)
- load_single_library(fm, "libSaluteLib.extension", "extension_export_salute");
-
- // Get a reference to the list of constructors for words.
- std::list<factory<word, int> > & factory_list = fm.get<word, int>();
-
- if (factory_list.size() < 6) {
- std::cout << "Error - the classes were not found (" << factory_list.size() << " classes)" << std::endl;
- return 1;
- }
-
- std::cout << "words: " << std::endl;
- for (std::list<factory<word, int> >::iterator current_word = factory_list.begin();
- current_word != factory_list.end(); ++current_word)
- {
- // Using auto_ptr to avoid needing delete. Using smart_ptrs is recommended.
- // Note that this has a zero argument constructor - currently constructors
- // with up to six arguments can be used.
- std::auto_ptr<word> word_ptr(current_word->create());
- std::cout << word_ptr->get_val() << " ";
- }
- std::cout << std::endl << std::endl;
-
- // Get a reference to the list of constructors for salutes.
- std::list<factory<salute, int> > & salute_factory_list = fm.get<salute, int>();
-
- if (salute_factory_list.size() < 2) {
- std::cout << "Error - the classes were not found (" << salute_factory_list.size() << " classes)" << std::endl;
- return 1;
- }
-
- std::cout << "salutes: " << std::endl;
- for (std::list<factory<salute, int> >::iterator current_salute = salute_factory_list.begin();
- current_salute != salute_factory_list.end(); ++current_salute)
- {
- // Using auto_ptr to avoid needing delete. Using smart_ptrs is recommended.
- // Note that this has a zero argument constructor - currently constructors
- // with up to six arguments can be used.
- std::auto_ptr<salute> salute_ptr(current_salute->create());
- std::cout << salute_ptr->say() << " ";
- }
- std::cout << std::endl;
+ // Create the factory_map object - it will hold all of the available
+ // constructors. Multiple factory_maps can be constructed.
+ factory_map fm;
+
+ // load hello world first version
+ load_single_library(fm, "libHelloWorldLib.extension",
+ "extension_export_word");
+
+ // load hello world second version
+ load_single_library(fm, "libHelloWorldLibv2.extension",
+ "extension_export_word");
+
+ // load hello world second version again
+ load_single_library(fm, "libHelloWorldLibv2.extension",
+ "extension_export_word");
+
+ // load salute library (with hello included)
+ load_single_library(fm, "libSaluteLib.extension", "extension_export_salute");
+
+ // Get a reference to the list of constructors for words.
+ std::list<factory<word, int> > & factory_list = fm.get<word, int>();
+
+ if (factory_list.size() < 6) {
+ std::cout << "Error - the classes were not found ("
+ << factory_list.size() << " classes)" << std::endl;
+ return 1;
+ }
+
+ std::cout << "words: " << std::endl;
+ for (std::list<factory<word, int> >::iterator current_word =
+ factory_list.begin();
+ current_word != factory_list.end(); ++current_word)
+ {
+ // Using auto_ptr to avoid needing delete. Using smart_ptrs is
+ // recommended.
+ // Note that this has a zero argument constructor - currently
+ // constructors
+ // with up to six arguments can be used.
+ std::auto_ptr<word> word_ptr(current_word->create());
+ std::cout << word_ptr->get_val() << " ";
+ }
+ std::cout << std::endl << std::endl;
+
+ // Get a reference to the list of constructors for salutes.
+ std::list<factory<salute, int> > & salute_factory_list =
+ fm.get<salute, int>();
+
+ if (salute_factory_list.size() < 2) {
+ std::cout << "Error - the classes were not found ("
+ << salute_factory_list.size() << " classes)" << std::endl;
+ return 1;
+ }
+
+ std::cout << "salutes: " << std::endl;
+ for (std::list<factory<salute, int> >::iterator current_salute =
+ salute_factory_list.begin();
+ current_salute != salute_factory_list.end(); ++current_salute)
+ {
+ // Using auto_ptr to avoid needing delete. Using smart_ptrs is
+ // recommended.
+ // Note that this has a zero argument constructor - currently
+ // constructors
+ // with up to six arguments can be used.
+ std::auto_ptr<salute> salute_ptr(current_salute->create());
+ std::cout << salute_ptr->say() << " ";
+ }
+ std::cout << std::endl;
- return 0;
+ return 0;
}
Modified: sandbox/libs/extension/examples/versioning/salute.cpp
==============================================================================
--- sandbox/libs/extension/examples/versioning/salute.cpp (original)
+++ sandbox/libs/extension/examples/versioning/salute.cpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,7 +1,12 @@
-/* (C) Copyright Mariano G. Consoni 2007
- * Distributed under the Boost Software License, Version 1.0. (See
+/*
+ * Boost.Extension / salute implementations
+ *
+ * (C) Copyright Mariano G. Consoni 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
* accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
*/
#include "salute.hpp"
@@ -10,18 +15,19 @@
class hello : public salute
{
public:
- virtual const char *say(void) {return "hello";}
+ virtual const char *say(void) {return "hello";}
};
class bye : public salute
{
public:
- virtual const char *say(void) {return "bye!";}
+ virtual const char *say(void) {return "bye!";}
};
-extern "C" void BOOST_EXTENSION_EXPORT_DECL extension_export_salute(boost::extensions::factory_map & fm)
+extern "C" void BOOST_EXTENSION_EXPORT_DECL
+extension_export_salute(boost::extensions::factory_map & fm)
{
- fm.add<hello, salute, int>(1);
- fm.add<bye, salute, int>(2);
+ fm.add<hello, salute, int>(1);
+ fm.add<bye, salute, int>(2);
}
Modified: sandbox/libs/extension/examples/versioning/salute.hpp
==============================================================================
--- sandbox/libs/extension/examples/versioning/salute.hpp (original)
+++ sandbox/libs/extension/examples/versioning/salute.hpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,7 +1,12 @@
-/* (C) Copyright Mariano G. Consoni 2007
- * Distributed under the Boost Software License, Version 1.0. (See
+/*
+ * Boost.Extension / salute interface
+ *
+ * (C) Copyright Mariano G. Consoni 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
* accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
*/
class salute
Modified: sandbox/libs/extension/examples/word.hpp
==============================================================================
--- sandbox/libs/extension/examples/word.hpp (original)
+++ sandbox/libs/extension/examples/word.hpp 2007-06-26 20:37:51 EDT (Tue, 26 Jun 2007)
@@ -1,7 +1,12 @@
-/* (C) Copyright Jeremy Pack 2007
- * Distributed under the Boost Software License, Version 1.0. (See
+/*
+ * Boost.Extension / word interface
+ *
+ * (C) Copyright Jeremy Pack 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
* accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
*/
class word
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk