NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
procedureelement.hpp
Go to the documentation of this file.
1/*****************************************************************************
2 NumeRe: Framework fuer Numerische Rechnungen
3 Copyright (C) 2017 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#include <string>
20#include <map>
21#include <vector>
23#include "../io/styledtextfile.hpp"
24
25#ifndef PROCEDUREELEMENT_HPP
26#define PROCEDUREELEMENT_HPP
27
28// Forward declaration of the dependencies class
29class Dependencies;
30
31
37{
38 private:
39 std::vector<std::pair<int, ProcedureCommandLine>> mProcedureContents;
40 std::map<std::string, int> mProcedureList;
41 std::string sFileName;
43
44 void cleanCurrentLine(std::string& sProcCommandLine, const std::string& sCurrentCommand, const std::string& sFilePath);
45
46 public:
47 ProcedureElement(const StyledTextFile& procedureContents, const std::string& sFolderPath);
49
50 std::pair<int, ProcedureCommandLine> getFirstLine();
51 std::pair<int, ProcedureCommandLine> getCurrentLine(int currentLine);
52 std::pair<int, ProcedureCommandLine> getNextLine(int currentline);
53 int gotoProcedure(const std::string& sProcedureName);
54 std::string getFileName() const
55 {
56 return sFileName;
57 }
58
59 bool isLastLine(int currentline);
60 void setByteCode(int _nByteCode, int nCurrentLine);
62};
63
64#endif // PROCEDUREELEMENT_HPP
65
This class handles the dependencies of the current procedure file (passed as pointer to a ProcedureEl...
Definition: dependency.hpp:81
This class contains the pre-parsed contents of a single procedure file.
std::string getFileName() const
Dependencies * m_dependencies
ProcedureElement(const StyledTextFile &procedureContents, const std::string &sFolderPath)
Procedure element constructor. This class is always heap allocated.
~ProcedureElement()
Destructor. Cleares the dependency list.
std::pair< int, ProcedureCommandLine > getCurrentLine(int currentLine)
This function returns the selected line of the stored file. This member function will be used in comb...
std::map< std::string, int > mProcedureList
void cleanCurrentLine(std::string &sProcCommandLine, const std::string &sCurrentCommand, const std::string &sFilePath)
This member function does the hard work on cleaning the current procedure command line....
bool isLastLine(int currentline)
This member function determines, whether the current line is the last line of the stored procedure fi...
void setByteCode(int _nByteCode, int nCurrentLine)
This member function can be used to store the created byte code in the current procedure command line...
Dependencies * getDependencies()
This member function returns the first-level dependencies of the current procedure file....
int gotoProcedure(const std::string &sProcedureName)
This member function returns the line of the stored file, where the desired procedure may be found or...
std::pair< int, ProcedureCommandLine > getFirstLine()
This function returns the first line of the stored file.
std::pair< int, ProcedureCommandLine > getNextLine(int currentline)
This member function returns the line after the current selected line. This is probably not the same ...
std::vector< std::pair< int, ProcedureCommandLine > > mProcedureContents
This class represents a text file in memory (e.g. a code file). This class will try to lex the loaded...