ParserIntItem.hpp
Go to the documentation of this file.
1 /*
2  Copyright 2013 Statoil ASA.
3 
4  This file is part of the Open Porous Media project (OPM).
5 
6  OPM is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  OPM is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with OPM. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 
21 #ifndef PARSERINTITEM_HPP
22 #define PARSERINTITEM_HPP
23 
24 #include <memory>
25 
26 #include <opm/json/JsonObject.hpp>
27 
30 
32 
33 
34 namespace Opm {
35 
36  class ParserIntItem : public ParserItem {
37  public:
38  ParserIntItem(const std::string& itemName);
39  ParserIntItem(const std::string& itemName, ParserItemSizeEnum sizeType);
40  ParserIntItem(const std::string& itemName, int defaultValue);
41  ParserIntItem(const std::string& itemName, ParserItemSizeEnum sizeType, int defaultValue);
42  explicit ParserIntItem(const Json::JsonObject& jsonConfig);
43 
44  DeckItemPtr scan(RawRecordPtr rawRecord) const;
45  bool equal(const ParserItem& other) const;
46 
47  std::string createCode() const;
48  void inlineClass(std::ostream& os, const std::string& indent) const;
49  std::string inlineClassInit(const std::string& parentClass) const;
50 
51  int getDefault() const;
52  bool hasDefault() const;
53  void setDefault(int defaultValue);
54  private:
55  int m_default;
56  };
57 
58  typedef std::shared_ptr<const ParserIntItem> ParserIntItemConstPtr;
59  typedef std::shared_ptr<ParserIntItem> ParserIntItemPtr;
60 }
61 
62 #endif /* PARSERINTITEM_HPP */
63 
int getDefault() const
std::shared_ptr< DeckItem > DeckItemPtr
Definition: DeckItem.hpp:126
Definition: Deck.hpp:29
Definition: JsonObject.hpp:31
ParserItemSizeEnum
Definition: ParserEnums.hpp:37
void setDefault(int defaultValue)
Definition: ParserItem.hpp:39
bool hasDefault() const
void inlineClass(std::ostream &os, const std::string &indent) const
ParserItemSizeEnum sizeType() const
ParserIntItem(const std::string &itemName)
std::string inlineClassInit(const std::string &parentClass) const
std::shared_ptr< const ParserIntItem > ParserIntItemConstPtr
Definition: ParserIntItem.hpp:58
DeckItemPtr scan(RawRecordPtr rawRecord) const
std::shared_ptr< RawRecord > RawRecordPtr
Definition: RawRecord.hpp:64
Definition: ParserIntItem.hpp:36
bool equal(const ParserItem &other) const
std::shared_ptr< ParserIntItem > ParserIntItemPtr
Definition: ParserIntItem.hpp:59
std::string createCode() const