[Cppcms-users] Question about template - recursive function
Brought to you by:
artyom-beilis
From: Joffrey R. <jof...@im...> - 2011-08-26 04:15:24
|
Hello Everybody, My English is approximate, I apologize for this inconvenience. A few words to tell you that "CPPCMS" is a really good framework. In my project, I use a "template" with recursive function for generating XML. > <% c++ #include "project_views/sequences_tree.hpp" %> > <% c++ namespace c= project_views; %> > <% skin%> > <% view sequences_tree uses project_views::sequences_tree %> > <% template render() %><?xml version="1.0" encoding="UTF-8"?> > <folder id="<%= parent_id %>"> > <% foreach obj in currentChildren%> > > <% item%> > > <% if ( static_cast<char>(obj.type_flags & c::treeviewChild::FLAG_FOLDER) == c::treeviewChild::FLAG_FOLDER ) %> > <folder pos="<%= obj.position %>" id="<%= obj.object_id %>" name="<%= obj.object_name %>"><% include sequences_tree::recursive_render(obj) %></folder> > <% elif( static_cast<char>(obj.type_flags & c::treeviewChild::FLAG_SEQUENCE) == c::treeviewChild::FLAG_SEQUENCE ) %> > <sequence pos="<%= obj.position %>" guid="<%= obj.object_guid %>" id="<%= obj.object_id %>" name="<%= obj.object_name %>" /> > <% end%> > > <% end%> > > <% end%> > </folder> > <% end template%> > * > <% template recursive_render( c::treeviewChild o) %>* > <% foreach obj in o.subChildren %> > > <% item%> > > <% if ( static_cast<char>(obj.type_flags & c::treeviewChild::FLAG_FOLDER) == c::treeviewChild::FLAG_FOLDER ) %> > <folder pos="<%= obj.position %>" id="<%= obj.object_id %>" name="<%= obj.object_name %>"><% include sequences_tree::recursive_render(obj) %></folder> > <% elif( static_cast<char>(obj.type_flags & c::treeviewChild::FLAG_SEQUENCE) == c::treeviewChild::FLAG_SEQUENCE ) %> > <sequence pos="<%= obj.position %>" guid="<%= obj.object_guid %>" id="<%= obj.object_id %>" name="<%= obj.object_name %>" /> > <% end%> > > <% end%> > > <% end%> > <% end template%> > > <% end view%> > <% end skin%> That's work, but I wonder why there is an error when I replace *"c::treeviewChild **o**"* by *"**const c::treeviewChild& o**"* Thank you very much in advance for your answer. Joffrey |