OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
UpperCaseString.cpp
Go to the documentation of this file.
1 //
2 // Class UpperCaseString
3 // This class is used to parse attributes of type string that should
4 // be upper case, i.e. it returns upper case strings.
5 //
6 // Copyright (c) 2020, Christof Metzger-Kraus, Open Sourcerer
7 // All rights reserved
8 //
9 // This file is part of OPAL.
10 //
11 // OPAL is free software: you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation, either version 3 of the License, or
14 // (at your option) any later version.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with OPAL. If not, see <https://www.gnu.org/licenses/>.
18 //
19 #include "Attributes/Attributes.h"
22 #include "Expressions/SValue.h"
24 #include "Utilities/ParseError.h"
25 #include "Utilities/Util.h"
26 
27 using namespace Expressions;
28 
29 
30 namespace Attributes {
31 
32  UpperCaseString::UpperCaseString(const std::string &name, const std::string &help):
33  AttributeHandler(name, help, 0)
34  {}
35 
36 
38  {}
39 
40 
41  const std::string &UpperCaseString::getType() const {
42  static const std::string type("upper case string");
43  return type;
44  }
45 
46  void UpperCaseString::parse(Attribute &attr, Statement &stat, bool) const {
47  Attributes::setUpperCaseString(attr, parseStringValue(stat, "String value expected."));
48  }
49 
50 };
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
void setUpperCaseString(Attribute &attr, const std::string &val)
Set uppercase string value.
Definition: Attributes.cpp:456
boost::function< boost::tuple< double, bool >arguments_t)> type
Definition: function.hpp:21
A representation of an Object attribute.
Definition: Attribute.h:52
Abstract base class for attribute parsers.
virtual const std::string & getType() const
Return attribute type string `‘string’'.
virtual void parse(Attribute &, Statement &, bool) const
Parse the attribute.
Interface for statements.
Definition: Statement.h:38