ParserStringItem.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 PARSERSTRINGITEM_HPP
22 #define PARSERSTRINGITEM_HPP
23 
24 #include <memory>
25 
26 #include <opm/json/JsonObject.hpp>
27 
30 
31 namespace Opm {
32 
33  class ParserStringItem : public ParserItem {
34  public:
35  ParserStringItem(const std::string& itemName);
36  ParserStringItem(const std::string& itemName, ParserItemSizeEnum sizeType);
37  ParserStringItem(const std::string& itemName, ParserItemSizeEnum sizeType, const std::string& defaultValue);
38  ParserStringItem(const std::string& itemName, const std::string& defaultValue);
39  explicit ParserStringItem( const Json::JsonObject& jsonConfig);
40 
41  bool equal(const ParserItem& other) const;
42  DeckItemPtr scan(RawRecordPtr rawRecord) const;
43 
44  std::string createCode() const;
45  void inlineClass(std::ostream& os, const std::string& indent) const;
46  std::string inlineClassInit(const std::string& parentClass) const;
47  void setDefault(const std::string& defaultValue);
48  std::string getDefault() const;
49  bool hasDefault() const;
50 
51  private:
52  std::string m_default;
53  };
54 
55  typedef std::shared_ptr<const ParserStringItem> ParserStringItemConstPtr;
56  typedef std::shared_ptr<ParserStringItem> ParserStringItemPtr;
57 }
58 
59 #endif /* PARSERSTRINGITEM_HPP */
60 
void inlineClass(std::ostream &os, const std::string &indent) const
std::shared_ptr< const ParserStringItem > ParserStringItemConstPtr
Definition: ParserStringItem.hpp:55
std::string getDefault() const
std::shared_ptr< DeckItem > DeckItemPtr
Definition: DeckItem.hpp:126
Definition: Deck.hpp:29
std::shared_ptr< ParserStringItem > ParserStringItemPtr
Definition: ParserStringItem.hpp:56
bool hasDefault() const
std::string createCode() const
Definition: JsonObject.hpp:31
ParserItemSizeEnum
Definition: ParserEnums.hpp:37
bool equal(const ParserItem &other) const
Definition: ParserItem.hpp:39
std::string inlineClassInit(const std::string &parentClass) const
ParserItemSizeEnum sizeType() const
ParserStringItem(const std::string &itemName)
Definition: ParserStringItem.hpp:33
DeckItemPtr scan(RawRecordPtr rawRecord) const
std::shared_ptr< RawRecord > RawRecordPtr
Definition: RawRecord.hpp:64
void setDefault(const std::string &defaultValue)