NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
includer.hpp
Go to the documentation of this file.
1/*****************************************************************************
2 NumeRe: Framework fuer Numerische Rechnungen
3 Copyright (C) 2022 Erik Haenel et al.
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17******************************************************************************/
18
19#ifndef INCLUDER_HPP
20#define INCLUDER_HPP
21
22#include <string>
23#include "../io/filesystem.hpp"
24#include "../io/styledtextfile.hpp"
25
31class Includer : public FileSystem
32{
33 public:
35 {
39 INCLUDE_GLOBALS = 0x4
40 };
41
42 private:
45 int m_type;
46
47 void openIncludedFile(const std::string& sIncludingString);
48
49 public:
50 Includer(const std::string& sIncludingString, const std::string& sSearchPath);
51 ~Includer();
52
53 int getCurrentLine() const
54 {
55 return nIncludeLine;
56 }
57
58 int getIncludedType() const
59 {
60 return m_type;
61 }
62
63 std::string getNextLine();
64 bool is_open() const;
65 std::string getIncludedFileName() const;
66 static bool is_including_syntax(const std::string& sLine);
67};
68
69#endif // INCLUDER_HPP
70
71
This class implements the basic input/ output file system and provides functionalities to work with f...
Definition: filesystem.hpp:92
This class represents a file, which can be included into other files using the @ syntax.
Definition: includer.hpp:32
int m_type
Definition: includer.hpp:45
std::string getIncludedFileName() const
Returns the embedded file name.
Definition: includer.cpp:300
int nIncludeLine
Definition: includer.hpp:44
Includer(const std::string &sIncludingString, const std::string &sSearchPath)
Includer class constructor. Opens the included file defined by the passed including string.
Definition: includer.cpp:137
void openIncludedFile(const std::string &sIncludingString)
Opens the included file and determines the including type.
Definition: includer.cpp:33
~Includer()
Includer class destructor. Frees up internal memory if needed.
Definition: includer.cpp:154
@ INCLUDE_ALL
Definition: includer.hpp:36
@ INCLUDE_GLOBALS
Definition: includer.hpp:39
@ INCLUDE_DECLARATIONS
Definition: includer.hpp:38
@ INCLUDE_DEFINES
Definition: includer.hpp:37
int getIncludedType() const
Definition: includer.hpp:58
bool is_open() const
Determine, if the internal included file is open and valid.
Definition: includer.cpp:285
StyledTextFile * m_include
Definition: includer.hpp:43
static bool is_including_syntax(const std::string &sLine)
Static member function which determines, whether the passed line is actually a including syntax.
Definition: includer.cpp:318
int getCurrentLine() const
Definition: includer.hpp:53
std::string getNextLine()
Return the next line of the included string.
Definition: includer.cpp:168
This class represents a text file in memory (e.g. a code file). This class will try to lex the loaded...