blob: 6393e7eeb92bdcfd2e608e583afe4017aca28d18 [file] [log] [blame]
Alexander Afanasyev8b379052011-08-21 16:58:20 -07001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
2/*
3 * Copyright (c) 2011 University of California, Los Angeles
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
19 */
20
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070021#include "no-argu-depth-first-visitor.h"
Alexander Afanasyev8b379052011-08-21 16:58:20 -070022
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070023#include "../syntax-tree/blob.h"
24#include "../syntax-tree/udata.h"
25#include "../syntax-tree/tag.h"
26#include "../syntax-tree/dtag.h"
27#include "../syntax-tree/attr.h"
28#include "../syntax-tree/dattr.h"
29#include "../syntax-tree/ext.h"
Alexander Afanasyev8b379052011-08-21 16:58:20 -070030
31#include <boost/foreach.hpp>
32
Alexander Afanasyev1043c702013-07-15 16:21:09 -070033NDN_NAMESPACE_BEGIN
34
35namespace wire {
Alexander Afanasyev8b379052011-08-21 16:58:20 -070036namespace CcnbParser {
37
38boost::any
39NoArguDepthFirstVisitor::visit (Blob &n)
40{
41 // Buffer n.m_blob;
42 return n.m_blob;
43}
44
45boost::any
46NoArguDepthFirstVisitor::visit (Udata &n)
47{
48 // std::string n.m_udata;
49 return n.m_udata;
50}
51
52boost::any
53NoArguDepthFirstVisitor::visit (Tag &n)
54{
55 // uint32_t n.m_dtag;
56 // std::list<Ptr<Block> > n.m_attrs;
57 // std::list<Ptr<Block> > n.m_nestedBlocks;
58 BOOST_FOREACH (Ptr<Block> block, n.m_attrs)
59 {
60 block->accept (*this);
61 }
Alexander Afanasyeve709f3d2011-08-21 17:55:45 -070062 BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
Alexander Afanasyev8b379052011-08-21 16:58:20 -070063 {
64 block->accept (*this);
65 }
66 return boost::any ();
67}
68
69boost::any
70NoArguDepthFirstVisitor::visit (Dtag &n)
71{
72 // uint32_t n.m_dtag;
73 // std::list<Ptr<Block> > n.m_attrs;
74 // std::list<Ptr<Block> > n.m_nestedBlocks;
75 BOOST_FOREACH (Ptr<Block> block, n.m_attrs)
76 {
77 block->accept (*this);
78 }
Alexander Afanasyeve709f3d2011-08-21 17:55:45 -070079 BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
Alexander Afanasyev8b379052011-08-21 16:58:20 -070080 {
81 block->accept (*this);
82 }
83 return boost::any();
84}
85
86boost::any
87NoArguDepthFirstVisitor::visit (Attr &n)
88{
89 // std::string n.m_attr;
90 // Ptr<Udata> n.m_value;
91 return boost::any ();
92}
93
94boost::any
95NoArguDepthFirstVisitor::visit (Dattr &n)
96{
97 // uint32_t n.m_dattr;
98 // Ptr<Udata> n.m_value;
99 return boost::any ();
100}
101
102boost::any
103NoArguDepthFirstVisitor::visit (Ext &n)
104{
105 // uint64_t n.m_extSubtype;
106 return n.m_extSubtype;
107}
108
Alexander Afanasyev1043c702013-07-15 16:21:09 -0700109} // CcnbParser
110} // wire
111
112NDN_NAMESPACE_END