OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
String.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: String.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.1.1.1 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Class: String
10 // A class used to parse string attributes.
11 //
12 // ------------------------------------------------------------------------
13 //
14 // $Date: 2000/03/27 09:33:36 $
15 // $Author: Andreas Adelmann $
16 //
17 // ------------------------------------------------------------------------
18 
19 #include "Attributes/String.h"
21 #include "Expressions/SValue.h"
23 #include "Utilities/ParseError.h"
24 
25 using namespace Expressions;
26 
27 
28 // Class String
29 // ------------------------------------------------------------------------
30 
31 namespace Attributes {
32 
33  String::String(const std::string &name, const std::string &help):
34  AttributeHandler(name, help, 0)
35  {}
36 
37 
39  {}
40 
41 
42  const std::string &String::getType() const {
43  static const std::string type("string");
44  return type;
45  }
46 
47 
48  void String::parse(Attribute &attr, Statement &stat, bool) const {
49 
50  std::string result = parseStringValue(stat, "String value expected.");
51  attr.set(new SValue<std::string>(result));
52  }
53 
54 };
const std::string name
Representation objects and parsers for attribute expressions.
Definition: Expressions.h:64
std::string parseStringValue(Statement &, const char msg[])
A collection of routines to construct object Attributes and retrieve.
Definition: Attributes.cpp:85
boost::function< boost::tuple< double, bool >arguments_t)> type
Definition: function.hpp:21
A representation of an Object attribute.
Definition: Attribute.h:52
void set(AttributeBase *newBase)
Define new value.
Definition: Attribute.cpp:139
Abstract base class for attribute parsers.
virtual const std::string & getType() const
Return attribute type string `‘string’'.
Definition: String.cpp:42
virtual void parse(Attribute &, Statement &, bool) const
Parse the attribute.
Definition: String.cpp:48
virtual ~String()
Definition: String.cpp:38
Interface for statements.
Definition: Statement.h:38
Object attribute with a constant scalar value.
Definition: SValue.h:34