Boost logo

Boost-Commit :

From: mariano.consoni_at_[hidden]
Date: 2007-08-17 13:42:42


Author: mconsoni
Date: 2007-08-17 13:42:41 EDT (Fri, 17 Aug 2007)
New Revision: 38745
URL: http://svn.boost.org/trac/boost/changeset/38745

Log:
- Made it fit in 80 cols.
- Added comments.
- Replaced TABs.

Text files modified:
   sandbox/libs/reflection/examples/Jamfile.v2 | 2
   sandbox/libs/reflection/examples/car.hpp | 10 +++---
   sandbox/libs/reflection/examples/extension/car_lib.cpp | 16 ++++++------
   sandbox/libs/reflection/examples/extension/extension.cpp | 8 +++---
   sandbox/libs/reflection/examples/interpreter/interpreter.cpp | 53 ++++++++++++++++++++-------------------
   5 files changed, 45 insertions(+), 44 deletions(-)

Modified: sandbox/libs/reflection/examples/Jamfile.v2
==============================================================================
--- sandbox/libs/reflection/examples/Jamfile.v2 (original)
+++ sandbox/libs/reflection/examples/Jamfile.v2 2007-08-17 13:42:41 EDT (Fri, 17 Aug 2007)
@@ -22,7 +22,7 @@
       <include>../../../../src/sandbox/
       <toolset>gcc:<find-static-library>dl
       <toolset>gcc:<find-static-library>readline
- <toolset>gcc:<find-static-library>boost_regex-gcc41-mt
+ <toolset>gcc:<find-static-library>boost_regex-gcc-mt
       <toolset>gcc:<linkflags>"-Wl,-rpath,'$ORIGIN'"
       <toolset>darwin:<define>DYLD_LIBRARY_PATH=./
     :

Modified: sandbox/libs/reflection/examples/car.hpp
==============================================================================
--- sandbox/libs/reflection/examples/car.hpp (original)
+++ sandbox/libs/reflection/examples/car.hpp 2007-08-17 13:42:41 EDT (Fri, 17 Aug 2007)
@@ -1,5 +1,5 @@
 /*
- * Boost.Reflection / prototype example (car int)
+ * Boost.Reflection / basic example (car interface)
  *
  * (C) Copyright Mariano G. Consoni 2007
  * Distributed under the Boost Software License, Version 1.0. (See
@@ -30,11 +30,11 @@
   {
     if(started_) {
       std::cout << "Turning " << name_ << " "<< angle << " degrees."
- << std::endl;
+ << std::endl;
       return true;
     } else {
       std::cout << "Cannot turn before starting the engine of "
- << name_ << "." << std::endl;
+ << name_ << "." << std::endl;
       return false;
     }
   }
@@ -43,10 +43,10 @@
   {
     if(started_) {
       std::cout << "Accelerating " << name_ << " "<< qty << " m/h."
- << std::endl;
+ << std::endl;
     } else {
       std::cout << "Cannot accelerate before starting the engine of "
- << name_ << "." << std::endl;
+ << name_ << "." << std::endl;
     }
   }
 

Modified: sandbox/libs/reflection/examples/extension/car_lib.cpp
==============================================================================
--- sandbox/libs/reflection/examples/extension/car_lib.cpp (original)
+++ sandbox/libs/reflection/examples/extension/car_lib.cpp 2007-08-17 13:42:41 EDT (Fri, 17 Aug 2007)
@@ -1,7 +1,7 @@
 /*
- * Boost.Extension / hello world implementations
+ * Boost.Extension / car library implementations
  *
- * (C) Copyright Jeremy Pack 2007
+ * (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)
@@ -15,17 +15,17 @@
 class suv : public car
 {
 public:
- suv(const std::string name) : car(name) {}
- virtual std::string get_type(void) { return "It's a SUV."; }
- virtual ~suv(void) {}
+ suv(const std::string name) : car(name) {}
+ virtual std::string get_type(void) { return "It's a SUV."; }
+ virtual ~suv(void) {}
 };
 
 class compact : public car
 {
 public:
- compact(const std::string name) : car(name) {}
- virtual std::string get_type(void) { return "It's a compact."; }
- virtual ~compact(void) {}
+ compact(const std::string name) : car(name) {}
+ virtual std::string get_type(void) { return "It's a compact."; }
+ virtual ~compact(void) {}
 };
 
 

Modified: sandbox/libs/reflection/examples/extension/extension.cpp
==============================================================================
--- sandbox/libs/reflection/examples/extension/extension.cpp (original)
+++ sandbox/libs/reflection/examples/extension/extension.cpp 2007-08-17 13:42:41 EDT (Fri, 17 Aug 2007)
@@ -38,20 +38,20 @@
 
   // load the car library
   load_single_library(fm, "libcar_lib.extension",
- "extension_export_car");
+ "extension_export_car");
   std::list<factory<car, std::string, std::string> > & factory_list =
- fm.get<car, std::string, std::string>();
+ fm.get<car, std::string, std::string>();
 
   // check if the factories loaded fine
   if(factory_list.size() < 2) {
     std::cout << "Error - the classes were not found ("
- << factory_list.size() << ").\n";
+ << factory_list.size() << ").\n";
     return -1;
   }
 
   // create some instances and call the method "3" (start)
   for (std::list<factory<car, std::string, std::string> >
- ::iterator current_car = factory_list.begin();
+ ::iterator current_car = factory_list.begin();
        current_car != factory_list.end();
        ++current_car)
   {

Modified: sandbox/libs/reflection/examples/interpreter/interpreter.cpp
==============================================================================
--- sandbox/libs/reflection/examples/interpreter/interpreter.cpp (original)
+++ sandbox/libs/reflection/examples/interpreter/interpreter.cpp 2007-08-17 13:42:41 EDT (Fri, 17 Aug 2007)
@@ -30,7 +30,7 @@
 
 
 typedef std::list<boost::extensions::factory<car, std::string,
- std::string> > factory_list;
+ std::string> > factory_list;
 
 
 /// this map stores the instanced variables
@@ -38,7 +38,8 @@
 
 /// parse and execute a command
 void parse_command(const std::string &line, factory_list &f,
- boost::extension::reflection<car, std::string> &car_reflection)
+ boost::extension::reflection<car,
+ std::string> &car_reflection)
 {
   boost::regex re, call_re;
   boost::cmatch matches, call_matches;
@@ -50,7 +51,7 @@
     re = creation_pattern;
   } catch (boost::regex_error& e) {
     std::cout << creation_pattern << " is not a valid regular expression: \""
- << e.what() << "\"" << std::endl;
+ << e.what() << "\"" << std::endl;
     return;
   }
 
@@ -58,7 +59,7 @@
     call_re = call_pattern;
   } catch (boost::regex_error& e) {
     std::cout << call_pattern << " is not a valid regular expression: \""
- << e.what() << "\"" << std::endl;
+ << e.what() << "\"" << std::endl;
     return;
   }
 
@@ -71,16 +72,16 @@
       std::string parameter1(matches[3].first, matches[3].second);
 
       for (std::list<boost::extensions::factory<car, std::string,
- std::string> >::iterator current_car = f.begin();
- current_car != f.end();
- ++current_car) {
- if(current_car->get_info() == method) {
- // FIXME: free
- car *created_car(current_car->create(parameter1));
- context[instance] = created_car;
-
- std::cout << "Instance [" << instance << "] created." << std::endl;
- }
+ std::string> >::iterator current_car = f.begin();
+ current_car != f.end();
+ ++current_car) {
+ if(current_car->get_info() == method) {
+ // FIXME: free
+ car *created_car(current_car->create(parameter1));
+ context[instance] = created_car;
+
+ std::cout << "Instance [" << instance << "] created." << std::endl;
+ }
       }
     }
     return;
@@ -95,18 +96,18 @@
 
       std::map<std::string, car *>::iterator m = context.find(instance);
       if(m != context.end()) {
- std::cout << " --> "
- << car_reflection.call<std::string, bool>(m->second, method)
- << std::endl;
+ std::cout << " --> "
+ << car_reflection.call<std::string, bool>(m->second, method)
+ << std::endl;
       } else {
- std::cout << "Instance " << instance << " not found." << std::endl;
+ std::cout << "Instance " << instance << " not found." << std::endl;
       }
     }
     return;
   }
 
   std::cout << "The command \"" << line << "\" is invalid."
- << std::endl;
+ << std::endl;
 
 }
 
@@ -117,18 +118,18 @@
 
   factory_map fm;
   load_single_library(fm, "libcar_lib.extension",
- "extension_export_car");
+ "extension_export_car");
   std::list<factory<car, std::string, std::string> > & car_factory_list =
- fm.get<car, std::string, std::string>();
+ fm.get<car, std::string, std::string>();
   if(car_factory_list.size() < 2) {
     std::cout << "Error - the classes were not found ("
- << car_factory_list.size() << ").\n";
+ << car_factory_list.size() << ").\n";
     std::exit(-1);
   }
  
   std::cout << std::endl
- << " Boost.Reflection example - Prototype C++ interpreter."
- << std::endl << std::endl;
+ << " Boost.Reflection example - Prototype C++ interpreter."
+ << std::endl << std::endl;
 
   boost::extension::reflection<car, std::string> car_reflection("A Car!");
   car_reflection.add<std::string, bool>(&car::start, "start");
@@ -141,7 +142,7 @@
     std::cout << "> ";
     std::cin >> line;
 
-#ifdef USE_READLINE
+#ifdef USE_READLINE
     char *line_chrptr = readline("> ");
     std::string line(line_chrptr);
     if(line.length() != 0) {
@@ -151,7 +152,7 @@
 
     parse_command(line, car_factory_list, car_reflection);
 
-#ifdef USE_READLINE
+#ifdef USE_READLINE
     free(line_chrptr);
 #endif
   }


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