RawKeyword.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#ifndef RAWKEYWORD_HPP
21#define RAWKEYWORD_HPP
22
23#include <memory>
24#include <string>
25#include <vector>
26#include <cstddef>
27
29
30#include "RawEnums.hpp"
31#include "RawConsts.hpp"
32
33namespace Opm {
34
35 class RawRecord;
36 class string_view;
37
38 class RawKeyword {
39 public:
40 RawKeyword(const std::string& name, const std::string& filename, std::size_t lineNR, bool raw_string, Raw::KeywordSizeEnum sizeType);
41 RawKeyword(const std::string& name, const std::string& filename, std::size_t lineNR, bool raw_string, Raw::KeywordSizeEnum sizeType, std::size_t size_arg);
43 bool addRecord(RawRecord record);
44
47
48 // Special case method only for inspecting INCLUDE keywords;
49 // the general getRecords functionality should use the
50 // iterator interface.
51 const RawRecord& getFirstRecord( ) const;
52
53 bool isFinished() const;
54 bool unKnownSize() const;
55 bool rawStringKeyword() const;
56 const Location& location() const;
57
58 using const_iterator = std::vector< RawRecord >::const_iterator;
59 using iterator = std::vector< RawRecord >::iterator;
60
65 std::size_t size() const;
66 private:
67 std::string m_name;
68 Location m_location;
69 bool raw_string_keyword;
70 Raw::KeywordSizeEnum m_sizeType;
71
72 size_t m_fixedSize = 0;
73 size_t m_numTables = 0;
74 size_t m_currentNumTables = 0;
75 bool m_isTempFinished = false;
76 bool m_isFinished = false;
77
78 std::vector< RawRecord > m_records;
79 };
80}
81#endif /* RAWKEYWORD_HPP */
82
const char *const name
Definition: cJSON.h:258
const char *const string
Definition: cJSON.h:170
Definition: Location.hpp:25
Definition: RawKeyword.hpp:38
std::size_t size() const
const_iterator end() const
Raw::KeywordSizeEnum getSizeType() const
bool rawStringKeyword() const
iterator end()
const RawRecord & getFirstRecord() const
bool terminateKeyword()
bool addRecord(RawRecord record)
RawKeyword(const std::string &name, const std::string &filename, std::size_t lineNR, bool raw_string, Raw::KeywordSizeEnum sizeType, std::size_t size_arg)
bool unKnownSize() const
iterator begin()
RawKeyword(const std::string &name, const std::string &filename, std::size_t lineNR, bool raw_string, Raw::KeywordSizeEnum sizeType)
std::vector< RawRecord >::iterator iterator
Definition: RawKeyword.hpp:59
const Location & location() const
bool isFinished() const
const_iterator begin() const
std::vector< RawRecord >::const_iterator const_iterator
Definition: RawKeyword.hpp:58
const std::string & getKeywordName() const
Definition: RawRecord.hpp:36
KeywordSizeEnum
Definition: RawEnums.hpp:27
Definition: A.hpp:4