NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
docgen.hpp
Go to the documentation of this file.
1/*****************************************************************************
2 NumeRe: Framework fuer Numerische Rechnungen
3 Copyright (C) 2020 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
20#ifndef DOCGEN_HPP
21#define DOCGEN_HPP
22
23#include <string>
24#include <set>
25#include <vector>
26#include <utility>
27
28#include "../io/filesystem.hpp"
29#include "../io/styledtextfile.hpp"
30#include "../../syntax.hpp"
31
41{
42 private:
44
45 void followBranch(const std::string& sFile, std::set<std::string>& fileSet, std::vector<std::string>& vFiles) const;
46
47 std::string convertToLaTeX(const std::string& sFileName) const;
48 std::string getStrippedRange(const StyledTextFile& file, int pos1, int pos2, bool encode = true) const;
49 std::string parseDocumentation(const StyledTextFile& file, const std::string& sMainProc, int pos1, int pos2) const;
50 std::string createParametersTable(const std::vector<std::string>& vParams) const;
51 std::string createReturnsTable(const std::vector<std::string>& vParams) const;
52 size_t findListItem(const std::string& sTextRange, size_t& nLength) const;
53
54 std::string createMainProcedure(std::string sFileName) const;
55 std::string createLaTeXFileName(std::string sFileName) const;
56 std::string prepareFileNameForLaTeX(std::string sFileName) const;
57 std::string constructKeyWords(std::string sKeyWordList) const;
58 void createStyleFile() const;
59 std::string createMainFile(const std::string& sFileName, const std::vector<std::string>& vIncludesList, const std::vector<std::string>& vFiles) const;
60
61 public:
62 DocumentationGenerator(NumeReSyntax* _syntax, const std::string& sRootPath);
63
64 std::string createDocumentation(const std::string& sFileName) const;
65 std::string createFullDocumentation(const std::string& sFileName) const;
66};
67
68
69#endif // DOCGEN_HPP
70
71
This class handles the creation of LaTeX documentation from code files. It will detect documentation ...
Definition: docgen.hpp:41
std::string createReturnsTable(const std::vector< std::string > &vParams) const
This member function creates a table out of the declared return values in the documentation comments.
Definition: docgen.cpp:616
std::string convertToLaTeX(const std::string &sFileName) const
Writes the content of the current code file to a LaTeX file.
Definition: docgen.cpp:95
size_t findListItem(const std::string &sTextRange, size_t &nLength) const
This helper function finds the next list item in the passed documentation string.
Definition: docgen.cpp:651
NumeReSyntax * m_syntax
Definition: docgen.hpp:43
std::string createMainFile(const std::string &sFileName, const std::vector< std::string > &vIncludesList, const std::vector< std::string > &vFiles) const
This member function creates a main LaTeX file including the perviously created LaTeX documentation f...
Definition: docgen.cpp:900
std::string constructKeyWords(std::string sKeyWordList) const
This member function replaces the passed whitespace-separated keyword list with a comma-separated lis...
Definition: docgen.cpp:805
std::string createDocumentation(const std::string &sFileName) const
This member function creates a LaTeX documentation from a single file and stores it....
Definition: docgen.cpp:973
std::string getStrippedRange(const StyledTextFile &file, int pos1, int pos2, bool encode=true) const
Gets the contents of the selected range.
Definition: docgen.cpp:242
std::string createLaTeXFileName(std::string sFileName) const
This method will create a target filename for the TeX files and create the needed folder structure on...
Definition: docgen.cpp:718
std::string createParametersTable(const std::vector< std::string > &vParams) const
This member function creates a table out of the declared parameters in the documentation comments.
Definition: docgen.cpp:565
DocumentationGenerator(NumeReSyntax *_syntax, const std::string &sRootPath)
DocumentationGenerator constructor.
Definition: docgen.cpp:956
std::string createMainProcedure(std::string sFileName) const
This method converts the passed filename into a main procedure for the current file.
Definition: docgen.cpp:678
std::string parseDocumentation(const StyledTextFile &file, const std::string &sMainProc, int pos1, int pos2) const
Converts the documentation into LaTeX code.
Definition: docgen.cpp:322
void createStyleFile() const
This member function writes the LaTeX header file used to highlight the code snippets,...
Definition: docgen.cpp:831
void followBranch(const std::string &sFile, std::set< std::string > &fileSet, std::vector< std::string > &vFiles) const
This member function finds all dependent procedure files. If the current file is not a procedure,...
Definition: docgen.cpp:39
std::string createFullDocumentation(const std::string &sFileName) const
This member function creates a LaTeX documentation from the passed file and all dependent files....
Definition: docgen.cpp:994
std::string prepareFileNameForLaTeX(std::string sFileName) const
This member function removes the path parts of the default paths and masks underscores,...
Definition: docgen.cpp:764
This class implements the basic input/ output file system and provides functionalities to work with f...
Definition: filesystem.hpp:92
This class contains all needed keywords to highlight their occurences correspondingly....
Definition: syntax.hpp:55
This class represents a text file in memory (e.g. a code file). This class will try to lex the loaded...