Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r72645 - sandbox/SOC/2011/checks/libs/checks/example
From: pbristow_at_[hidden]
Date: 2011-06-17 10:32:39


Author: pbristow
Date: 2011-06-17 10:32:38 EDT (Fri, 17 Jun 2011)
New Revision: 72645
URL: http://svn.boost.org/trac/boost/changeset/72645

Log:
examples jamfile and .cpp added. Log file should go later, of course.
Added:
   sandbox/SOC/2011/checks/libs/checks/example/Checks_examples14-Jun-2011_1200.log (contents, props changed)
   sandbox/SOC/2011/checks/libs/checks/example/Checksexamples.bat (contents, props changed)
   sandbox/SOC/2011/checks/libs/checks/example/isbn_example.cpp (contents, props changed)
   sandbox/SOC/2011/checks/libs/checks/example/jamfile.v2 (contents, props changed)

Added: sandbox/SOC/2011/checks/libs/checks/example/Checks_examples14-Jun-2011_1200.log
==============================================================================
--- (empty file)
+++ sandbox/SOC/2011/checks/libs/checks/example/Checks_examples14-Jun-2011_1200.log 2011-06-17 10:32:38 EDT (Fri, 17 Jun 2011)
@@ -0,0 +1,17 @@
+
+...found 28 targets...
+...updating 11 targets...
+common.mkdir ..\..\..\bin.v2\libs\checks\example
+common.mkdir ..\..\..\bin.v2\libs\checks\example\isbn_example.test
+common.mkdir ..\..\..\bin.v2\libs\checks\example\isbn_example.test\msvc-10.0
+common.mkdir ..\..\..\bin.v2\libs\checks\example\isbn_example.test\msvc-10.0\debug
+common.mkdir ..\..\..\bin.v2\libs\checks\example\isbn_example.test\msvc-10.0\debug\asynch-exceptions-on
+common.mkdir ..\..\..\bin.v2\libs\checks\example\isbn_example.test\msvc-10.0\debug\asynch-exceptions-on\threading-multi
+compile-c-c++ ..\..\..\bin.v2\libs\checks\example\isbn_example.test\msvc-10.0\debug\asynch-exceptions-on\threading-multi\isbn_example.obj
+isbn_example.cpp
+msvc.link ..\..\..\bin.v2\libs\checks\example\isbn_example.test\msvc-10.0\debug\asynch-exceptions-on\threading-multi\isbn_example.exe
+msvc.manifest ..\..\..\bin.v2\libs\checks\example\isbn_example.test\msvc-10.0\debug\asynch-exceptions-on\threading-multi\isbn_example.exe
+testing.capture-output ..\..\..\bin.v2\libs\checks\example\isbn_example.test\msvc-10.0\debug\asynch-exceptions-on\threading-multi\isbn_example.run
+ 1 file(s) copied.
+**passed** ..\..\..\bin.v2\libs\checks\example\isbn_example.test\msvc-10.0\debug\asynch-exceptions-on\threading-multi\isbn_example.test
+...updated 11 targets...

Added: sandbox/SOC/2011/checks/libs/checks/example/Checksexamples.bat
==============================================================================
--- (empty file)
+++ sandbox/SOC/2011/checks/libs/checks/example/Checksexamples.bat 2011-06-17 10:32:38 EDT (Fri, 17 Jun 2011)
@@ -0,0 +1,16 @@
+echo off
+rem Runs bjam jamfile.v2 and pipes the output to named log file,
+rem including the date and time, so that each log file has a unique name,
+rem for example: checks_23-Mar-2010_1751_html.log
+rem The DOS time format is assumed 12:34 and the : separator is not used.
+set t=%time% /T
+set tim=%t:~0,2%%t:~3,2%
+rem pick just hours and minutes.
+rem time may include leading space, like " 915", so remove space.
+set tim=%tim: =%
+i:
+cd \boost-sandbox\SOC\2011\checks\libs\checks\example
+echo on
+bjam > Checks_examples%date%_%tim%.log
+if not ERRORLEVEL 0 (echo Errorlevel is %ERRORLEVEL%) else (echo OK)
+pause
\ No newline at end of file

Added: sandbox/SOC/2011/checks/libs/checks/example/isbn_example.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2011/checks/libs/checks/example/isbn_example.cpp 2011-06-17 10:32:38 EDT (Fri, 17 Jun 2011)
@@ -0,0 +1,74 @@
+//! \file
+//! \warning This example is entirely contrived to show how to embed into Quickbook.
+//! \brief A very simple example of checking an ISBN that is provided as a std::string.
+
+// Copyright Paul A. Bristow 2011.
+
+// Use, modification and distribution are subject to 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)
+
+// This file is written to be included from a Quickbook .qbk document.
+// It can be compiled by the C++ compiler, and run. Any output can
+// also be added here as comment or included or pasted in elsewhere.
+// Caution: this file contains Quickbook markup as well as code
+// and comments: don't change any of the special comment markups!
+
+#include <iostream>
+using std::cout;
+using std::cin;
+using std::endl;
+using std::dec;
+using std::hex;
+using std::boolalpha;
+
+#include <iomanip>
+using std::setprecision;
+using std::setw;
+#include <string>
+using std::string;
+#include <cassert>
+
+#include <boost/checks/checks_fwd.hpp> // Forward declarations.
+
+//[checks_isbn_example_1
+#include <boost/checks/ISBN_PAB.hpp> // ISBN for books (Old PAB version using just string parameter).
+//] [/checks_isbn_example_1]
+
+// This is a really, really trivial example, but shows how to imbed into Quickbook tutorial section.
+
+// You need to [import isbn_example.cpp]
+// [include checks_isbn_example_1] where you want the include info - probably wrong now!
+// and then [include checks_isbn_example_2] where you want the program line
+// and then [include checks_isbn_output_1] when you want the output
+
+int main()
+{
+
+//[checks_isbn_example_2
+ string s1 = "0201700735";
+
+ cout << "ISBN " << s1 << (ISBNcheck(s1) ? " is OK" : " is Wrong!") << endl;
+
+ string s2 = "020170073";
+
+ cout << "Check digit of " << s2 << " is " << ISBNcompute("020170073") << endl;
+
+//] [/checks_isbn_example_2]
+
+} // int main()
+
+/*
+
+Output
+//[checks_isbn_output_1
+
+ ISBN 0201700735 is OK
+ Check digit of 020170073 is 5
+
+//] [/checks_isbn_output_1]
+
+
+*/
+

Added: sandbox/SOC/2011/checks/libs/checks/example/jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/SOC/2011/checks/libs/checks/example/jamfile.v2 2011-06-17 10:32:38 EDT (Fri, 17 Jun 2011)
@@ -0,0 +1,40 @@
+# I:\boost-sandbox\SOC\2011\checks\libs\checks\example\Jamfile.v2
+
+# Runs checks examples
+
+# Copyright 2011 Paul A. Bristow.
+
+# 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)
+
+# bring in the rules for testing
+import testing ;
+
+project
+ : requirements
+ <toolset>gcc:<cxxflags>-Wno-missing-braces
+ <toolset>darwin:<cxxflags>-Wno-missing-braces
+ <toolset>acc:<cxxflags>+W2068,2461,2236,4070
+ <toolset>intel:<cxxflags>-Qwd264,239
+ <toolset>msvc:<warnings>all
+ <toolset>msvc:<asynch-exceptions>on
+ <toolset>msvc:<cxxflags>/wd4800 # forcing value to bool 'true' or 'false'
+ <toolset>msvc:<cxxflags>/wd4996 # Deprecated.
+ <toolset>msvc:<cxxflags>/wd4512 # assignment operator could not be generated.
+ <toolset>msvc:<cxxflags>/wd4610
+ <toolset>msvc:<cxxflags>/wd4510
+ <toolset>msvc:<cxxflags>/wd4127
+ <toolset>msvc:<cxxflags>/wd4701
+ <toolset>msvc:<cxxflags>/wd4127 # expression is constant.
+ <toolset>msvc:<cxxflags>/wd4305
+ <toolset>msvc:<cxxflags>/wd4503 # decorated name length exceeded, name was truncated.
+ <toolset>msvc:<cxxflags>/wd4180 # qualifier applied to function type has no meaning; ignored.
+ <include>../../..
+ <include>$(boost_root)
+ ;
+
+run isbn_example.cpp ; # Trivial example of checking ISBN and also computing check digit.
+
+#run issn_example.cpp ; # Trivial example of checking ISSN and also computing check digit.
+# ...
+


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