OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
PredefinedString.h
Go to the documentation of this file.
1 //
2 // Class PredefinedString
3 // This class is used to parse attributes of type string that should
4 // be contained in set of predefined strings.
5 //
6 // Copyright (c) 2021, 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 #ifndef OPAL_PredefinedString_HH
20 #define OPAL_PredefinedString_HH
21 
24 
25 #include <set>
26 
27 namespace Attributes {
28 
31 
32  public:
33 
35  // Assign attribute name and help string.
36  PredefinedString(const std::string& name,
37  const std::string& help,
38  const std::initializer_list<std::string>& predefinedStrings,
39  const std::string& defaultValue = "_HAS_NO_DEFAULT_");
40 
41  virtual ~PredefinedString();
42 
44  virtual const std::string &getType() const;
45 
47  virtual void parse(Attribute &, Statement &, bool) const;
48 
49  private:
50 
51  // Not implemented.
54  void operator=(const PredefinedString &);
55 
56  std::set<std::string> predefinedStrings_m;
57  };
58 
59 };
60 
61 #endif
const std::string name
A collection of routines to construct object Attributes and retrieve.
Definition: Attributes.cpp:85
A representation of an Object attribute.
Definition: Attribute.h:52
Abstract base class for attribute parsers.
Parser for an attribute of type string.
PredefinedString(const PredefinedString &)
virtual void parse(Attribute &, Statement &, bool) const
Parse the attribute.
virtual const std::string & getType() const
Return attribute type string `‘string’'.
std::set< std::string > predefinedStrings_m
void operator=(const PredefinedString &)
Interface for statements.
Definition: Statement.h:38