Rosetta 3.3
Namespaces | Defines | Functions
src/utility/tag/Tag.cc File Reference

An object for reading/writing a simple xml-like language. More...

#include <utility/tag/Tag.hh>
#include <iostream>
#include <cstdio>
#include <boost/spirit/include/classic_core.hpp>
#include <boost/spirit/include/classic_attribute.hpp>
#include <boost/spirit/include/classic_closure.hpp>
#include <boost/spirit/include/phoenix1_primitives.hpp>
#include <boost/spirit/include/phoenix1_operators.hpp>
#include <boost/spirit/include/phoenix1_functions.hpp>
#include <boost/spirit/include/phoenix1_binders.hpp>
#include <boost/spirit/include/phoenix1_casts.hpp>
#include <utility/exit.hh>
#include <boost/foreach.hpp>
#include <boost/spirit/include/classic_position_iterator.hpp>
#include <boost/spirit/include/classic_functor_parser.hpp>
#include <core/types.hh>

Namespaces

namespace  boost
namespace  utility
 

unresizable vector whose size is known at compile time, which may be allocated on the stack, and which indexes from 1.


namespace  utility::tag

Defines

#define foreach   BOOST_FOREACH

Functions

void boost::throw_exception (std::exception const &)
std::ostream & utility::tag::operator<< (std::ostream &out, Tag const &tag)
std::ostream & utility::tag::operator<< (std::ostream &out, TagPtr const &tag_ptr)

Detailed Description

An object for reading/writing a simple xml-like language.

Detailed:
Reads simple xml-like files, such as:

<loop_design> <params max_cycles="100"> <loop begin="A:10" end="A:15" length="5-6/"> </loop_design>

When read into a tag, the following code would be valid: std::ifstream fin; fin.open("loop_design.tag") TagPtr tag = Tag::create( fin ); runtime_assert( tag->getName() == "loop_design" ); int max_cycles = tag->getTag("params")->getOption<int>("max_cycles");

Files must obey the following grammar:

EBNF for a simple xml-like language: ----------------------------------- tag := leaf_tag | branch_tag leaf_tag := '<' name_and_options '/>' branch_tag := '<' name_and_options '>' tag* '</' name '>' name_and_options := name option* option := name '=' name name := (alnum | '_' | '-' | '.' | '*' | ',' )+ whitespace allowed between all tokens

Less complex than XML, also: no need to quote options, and text outside of tags is ignored. Implemented with the boost spirit library.

Author:
Paul Murphy

Define Documentation

#define foreach   BOOST_FOREACH

Variable Documentation

rule<Scanner,tag_closure::context_t> branch_tag
rule<Scanner,string_closure::context_t> close_tag
functor_parser<error_report_parser> error_report_p
vector< file_position > errors
rule<Scanner,name_and_options_closure::context_t> leaf_tag
rule<Scanner,string_closure::context_t> name
rule<Scanner,name_and_options_closure::context_t> name_and_options
rule<Scanner,string_closure::context_t> name_or_quote
rule<Scanner,name_and_options_closure::context_t> open_tag
rule<Scanner,option_closure::context_t> option
rule<Scanner,options_closure::context_t> options
rule<Scanner,string_closure::context_t> quote
rule<Scanner,tag_closure::context_t> tag
rule<Scanner> top
member1 value

Referenced by UBQ_E2Mover::analyze_and_filter(), AnchorFinderMover::AnchorFinderMover(), APDBCMover::APDBCMover(), UBQ_E2Mover::apply(), FloppyTailMover::apply(), AnchorFinderMover::apply(), APDBCMover::apply(), IAMover::apply(), utility::keys::SmallKeyVector< PathVectorOptionKey, PathVectorOption >::assign(), utility::keys::SmallKeyMap< K, T >::assign(), utility::keys::KeyVector< K, T >::assign(), utility::keys::ClassKeyVector< K, T, C >::assign(), utility::keys::ClassKeyMap< K, T, C >::assign(), ObjexxFCL::ChunkVector< T >::assign(), ObjexxFCL::Chunk< T >::assign(), ObjexxFCL::CArrayP< T >::assign(), ObjexxFCL::CArray< T >::assign(), IAMover::assign_IA_mover(), ObjexxFCL::Chunk< T >::Chunk(), FloppyTailMover::FloppyTailMover(), get_file_vector_option(), get_option(), basic::options::get_option(), UBQ_E2Mover::init_on_new_input(), FloppyTailMover::init_on_new_input(), utility::keys::SmallKeyMap< K, T >::insert(), utility::keys::ClassKeyMap< K, T, C >::insert(), numeric::kdtree::is_legal_greater_than(), numeric::kdtree::is_legal_kdtree_below_node(), numeric::kdtree::is_legal_less_than(), numeric::isnan(), main(), measure_sequence_recovery(), ObjexxFCL::Chunk< T >::non_preserving_resize(), ObjexxFCL::ChunkVector< T >::operator*=(), ObjexxFCL::Chunk< T >::operator*=(), ObjexxFCL::ChunkVector< T >::operator+=(), ObjexxFCL::Chunk< T >::operator+=(), ObjexxFCL::ChunkVector< T >::operator-=(), ObjexxFCL::Chunk< T >::operator-=(), ObjexxFCL::ChunkVector< T >::operator/=(), ObjexxFCL::Chunk< T >::operator/=(), utility::keys::SmallKeyVector< PathVectorOptionKey, PathVectorOption >::operator=(), utility::keys::KeyVector< K, T >::operator=(), utility::keys::ClassKeyVector< K, T, C >::operator=(), ObjexxFCL::ChunkVector< T >::operator=(), ObjexxFCL::Chunk< T >::operator=(), ObjexxFCL::Chunk< T >::push_back(), numeric::interpolation::Histogram< X, Y >::read_from_db(), APDBCMover::read_in_insert_loop_info(), basic::read_metric_value_scalar(), basic::read_metric_value_vector1(), basic::options::realafteroption(), ObjexxFCL::ChunkVector< T >::reshape(), ObjexxFCL::ChunkVector< T >::resize(), ObjexxFCL::Chunk< T >::resize(), set_option(), basic::options::set_option(), numeric::interpolation::Histogram< X, Y >::set_params(), utility::tag::Tag::setOption(), and UBQ_E2Mover::UBQ_E2Mover().

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines