a Code for the Combination of Indirect and Direct Constraints on High Energy Physics Models Logo
LinesAsStrings.hpp
Go to the documentation of this file.
1/*
2 * LinesAsStrings.hpp
3 *
4 * Created on: Mar 12, 2012
5 * Author: Ben O'Leary (benjamin.oleary@gmail.com)
6 * Copyright 2012 Ben O'Leary
7 *
8 * This file is part of LesHouchesParserClasses, released under the
9 * GNU General Public License. Please see the accompanying
10 * README.LHPC_CPP.txt file for a full list of files, brief documentation
11 * on how to use these classes, and further details on the license.
12 */
13
14#ifndef LINESASSTRINGS_HPP_
15#define LINESASSTRINGS_HPP_
16
17#include <string>
19
20namespace LHPC
21{
22 namespace SLHA
23 {
24 namespace InterpreterClass
25 {
26 // this class interprets SLHA blocks as just a set of full lines as
27 // std::strings.
28 class LinesAsStrings : public InterpreterTemplate< std::string >
29 {
30 public:
32 virtual
34
35 std::string
36 operator()( int const whichLine ) const;
37 // this just returns the equivalent line from currentStringBlock.
38 std::string
39 operator[]( int const whichLine ) const
40 { return (*this)( whichLine ); }
41 virtual std::string const&
43 // see base version's description.
44 virtual void
46 // derived classes should clear their interpreted values.
47
48
49 protected:
50 virtual void
52 };
53
54
55
56
57
58 inline std::string
59 LinesAsStrings::operator()( int const whichLine ) const
60 // this just returns the equivalent line from currentStringBlock.
61 {
62 std::string returnString( "" );
63 if( NULL != this->currentStringBlock )
64 {
65 returnString.append(
66 (*(this->currentStringBlock))[ whichLine ].first );
67 returnString.append(
68 (*(this->currentStringBlock))[ whichLine ].second );
69 }
70 return returnString;
71 }
72
73 inline std::string const&
75 // see base version's description.
76 {
77 this->stringInterpretation.clear();
78 int numberOfLinesToPrint( 0 );
79 if( NULL != this->currentStringBlock )
80 {
81 numberOfLinesToPrint
83 }
84 for( int whichLine( 1 );
85 numberOfLinesToPrint >= whichLine;
86 ++whichLine )
87 {
88 this->stringInterpretation.append(
89 (*(this->currentStringBlock))[ whichLine ].first );
90 this->stringInterpretation.append(
91 (*(this->currentStringBlock))[ whichLine ].second );
92 this->stringInterpretation.append( "\n" );
93 }
94 return this->stringInterpretation;
95 }
96
97 inline void
99 // this ensures that the entry at soughtIndex exists, filling out with
100 // copies of defaultUnsetValue, & returns it.
101 {
102 // does nothing.
103 }
104
105 inline void
107 {
108 // does nothing.
109 }
110
111 }
112
113 }
114
115}
116
117
118#endif /* LINESASSTRINGS_HPP_ */
BlockClass::BaseStringBlock const * currentStringBlock
std::string operator()(int const whichLine) const
virtual std::string const & getAsString()
std::string operator[](int const whichLine) const