|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r57708 - trunk/libs/spirit/example/qi
From: hartmut.kaiser_at_[hidden]
Date: 2009-11-16 12:29:33
Author: hkaiser
Date: 2009-11-16 12:29:32 EST (Mon, 16 Nov 2009)
New Revision: 57708
URL: http://svn.boost.org/trac/boost/changeset/57708
Log:
Spirit: added more comments to new examples
Text files modified:
trunk/libs/spirit/example/qi/key_value_sequence.cpp | 7 +++++++
trunk/libs/spirit/example/qi/key_value_sequence_empty_value.cpp | 11 +++++++++++
trunk/libs/spirit/example/qi/key_value_sequence_ordered.cpp | 7 +++++++
3 files changed, 25 insertions(+), 0 deletions(-)
Modified: trunk/libs/spirit/example/qi/key_value_sequence.cpp
==============================================================================
--- trunk/libs/spirit/example/qi/key_value_sequence.cpp (original)
+++ trunk/libs/spirit/example/qi/key_value_sequence.cpp 2009-11-16 12:29:32 EST (Mon, 16 Nov 2009)
@@ -3,6 +3,13 @@
// 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)
+// The purpose of this example is to show how to parse arbitrary key/value
+// pairs delimited by some separator into a std::map. Parsing the URL query
+// format is the example we use to demonstrate how this can be done
+// (i.e. things like: key1=value1;key2=value2;
;keyN=valueN).
+//
+// For a more elaborate explanation see here: http://spirit.sourceforge.net/home/?p=270
+
#include <boost/spirit/include/qi.hpp>
#include <boost/fusion/include/std_pair.hpp>
Modified: trunk/libs/spirit/example/qi/key_value_sequence_empty_value.cpp
==============================================================================
--- trunk/libs/spirit/example/qi/key_value_sequence_empty_value.cpp (original)
+++ trunk/libs/spirit/example/qi/key_value_sequence_empty_value.cpp 2009-11-16 12:29:32 EST (Mon, 16 Nov 2009)
@@ -3,6 +3,17 @@
// 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)
+// The purpose of this example is to show how to parse arbitrary key/value
+// pairs delimited by some separator into a std::vector. The difference to
+// the example 'key_value_sequence.cpp' is that we preserve the order of the
+// elements in the parsed sequence as well as possibly existing duplicates.
+// In addition to the example 'key_value_sequence_ordered.cpp' we allow for
+// empty values, i.e. the grammar allows to distinguish between 'key=;' and
+// 'key;", where the first stores an empty string as the value, while the
+// second does not initialize the optional holding the value.
+//
+// For a more elaborate explanation see here: http://spirit.sourceforge.net/home/?p=270
+
#include <boost/spirit/include/qi.hpp>
#include <boost/fusion/include/std_pair.hpp>
Modified: trunk/libs/spirit/example/qi/key_value_sequence_ordered.cpp
==============================================================================
--- trunk/libs/spirit/example/qi/key_value_sequence_ordered.cpp (original)
+++ trunk/libs/spirit/example/qi/key_value_sequence_ordered.cpp 2009-11-16 12:29:32 EST (Mon, 16 Nov 2009)
@@ -3,6 +3,13 @@
// 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)
+// The purpose of this example is to show how to parse arbitrary key/value
+// pairs delimited by some separator into a std::vector. The difference to
+// the example 'key_value_sequence.cpp' is that we preserve the order of the
+// elements in the parsed seqeunce as well as possibly existing duplicates.
+//
+// For a more elaborate explanation see here: http://spirit.sourceforge.net/home/?p=270
+
#include <boost/spirit/include/qi.hpp>
#include <boost/fusion/include/std_pair.hpp>
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