~ubuntu-branches/ubuntu/warty/aqsis/warty

« back to all changes in this revision

Viewing changes to boost/boost/spirit/tree/tree_to_xml.hpp

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2004-08-24 07:25:04 UTC
  • Revision ID: james.westby@ubuntu.com-20040824072504-zf993vnevvisdsvb
Tags: upstream-0.9.1
ImportĀ upstreamĀ versionĀ 0.9.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*=============================================================================
 
2
    Spirit v1.6.1
 
3
    Copyright (c) 2001-2003 Daniel Nuffer
 
4
    Copyright (c) 2001-2003 Hartmut Kaiser
 
5
    http://spirit.sourceforge.net/
 
6
 
 
7
    Permission to copy, use, modify, sell and distribute this software is
 
8
    granted provided this copyright notice appears in all copies. This
 
9
    software is provided "as is" without express or implied warranty, and
 
10
    with no claim as to its suitability for any purpose.
 
11
=============================================================================*/
 
12
 
 
13
#if !defined(TREE_TO_XML_HPP)
 
14
#define TREE_TO_XML_HPP
 
15
 
 
16
namespace boost { namespace spirit {
 
17
 
 
18
///////////////////////////////////////////////////////////////////////////////
 
19
//
 
20
//  Dump a parse tree as a xml stream
 
21
//
 
22
//      The functions 'tree_to_xml' can be used to output a parse tree as a xml
 
23
//      stream into the given ostream. The parameters have the following
 
24
//      meaning:
 
25
//
 
26
//  mandatory parameters:
 
27
//      ostrm       The output stream used for streaming the parse tree.
 
28
//      tree        The parse tree to output.
 
29
//
 
30
//  optional parameters:
 
31
//      input_line  The input line from which the parse tree was
 
32
//                  generated (if given, it is used to output a comment
 
33
//                  containing this line).
 
34
//      id_to_name  A map, which is used for converting the rule id's contained
 
35
//                  in the parse tree to readable strings. Here a auxiliary
 
36
//                  associative container can be used, which maps a rule_id to
 
37
//                  a std::string (i.e. a std::map<rule_id, std::string>).
 
38
//      get_token_id
 
39
//                  A function or functor, which takes an instance of a token
 
40
//                  and which should return a token id (i.e. something like
 
41
//                  'int f(char const c)').
 
42
//      get_token_value
 
43
//                  A function or functor, which takes an instance of a token
 
44
//                  and which should return a readable representation of this
 
45
//                  token (i.e. something like 'std::string f(char const c)').
 
46
//
 
47
//  The structure of the generated xml stream conforms to the DTD given in the
 
48
//  file 'parsetree.dtd'. This file is located in the spirit/tree directory.
 
49
//
 
50
///////////////////////////////////////////////////////////////////////////////
 
51
 
 
52
    template <
 
53
        typename TreeNodeT, typename AssocContainerT,
 
54
        typename GetIdT, typename GetValueT
 
55
    >
 
56
    void tree_to_xml (std::ostream &ostrm, TreeNodeT const &tree,
 
57
        std::string const &input_line, AssocContainerT const& id_to_name,
 
58
        GetIdT const &get_token_id, GetValueT const &get_token_value);
 
59
 
 
60
    template <typename TreeNodeT, typename AssocContainerT>
 
61
    void tree_to_xml (std::ostream &ostrm, TreeNodeT const &tree,
 
62
        std::string const &input_line, AssocContainerT const& id_to_name);
 
63
 
 
64
    template <typename TreeNodeT>
 
65
    void tree_to_xml (std::ostream &ostrm, TreeNodeT const &tree,
 
66
        std::string const &input_line = "");
 
67
 
 
68
}} // namespace boost::spirit
 
69
 
 
70
#include "boost/spirit/tree/impl/tree_to_xml.ipp"
 
71
 
 
72
#endif // !defined(TREE_TO_XML_HPP)
 
73