NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
Includer Class Reference

This class represents a file, which can be included into other files using the @ syntax. More...

#include <includer.hpp>

Inheritance diagram for Includer:
Collaboration diagram for Includer:

Public Types

enum  IncludeType { INCLUDE_ALL = 0x0 , INCLUDE_DEFINES = 0x1 , INCLUDE_DECLARATIONS = 0x2 , INCLUDE_GLOBALS = 0x4 }
 

Public Member Functions

 Includer (const std::string &sIncludingString, const std::string &sSearchPath)
 Includer class constructor. Opens the included file defined by the passed including string. More...
 
 ~Includer ()
 Includer class destructor. Frees up internal memory if needed. More...
 
int getCurrentLine () const
 
int getIncludedType () const
 
std::string getNextLine ()
 Return the next line of the included string. More...
 
bool is_open () const
 Determine, if the internal included file is open and valid. More...
 
std::string getIncludedFileName () const
 Returns the embedded file name. More...
 
- Public Member Functions inherited from FileSystem
 FileSystem ()
 Default constructor. More...
 
FileSystemassign (const FileSystem &_fSys)
 Assignment member function to copy the settings from another FileSystem instance. More...
 
std::string ValidFileName (std::string _sFileName, const std::string sExtension=".dat", bool checkExtension=true, bool doCleanPath=true) const
 This member function evaluates, whether the passed filename is a valid filename. One may supply a preferred filename extension. More...
 
std::string ValidFolderName (std::string _sFileName, bool doCleanPath=true, bool appendTrailingSeparator=true) const
 This member function evaluates, whether the passed foldername is a valid foldername. More...
 
std::string ValidizeAndPrepareName (const std::string &_sFileName, const std::string &sExtension=".dat") const
 This member function validizes the passed file name and creates the needed folders on-the-fly. More...
 
int setPath (std::string _sPath, bool bMkDir, std::string _sExePath)
 This member function may be used to set the preferred file path of the current FileSystem instance. More...
 
void createRevisionsFolder ()
 This member function creates the hidden revisions folders for the version control system. More...
 
std::string getPath () const
 Returns the default path of this FileSystem instance. More...
 
std::vector< std::string > getFileParts (const std::string &sFilePath) const
 This member function separates all path parts into single strings: the drive letter, the path, the name and the extension. This function may also handle folder paths and network paths. More...
 
FileInfo getFileInfo (const std::string &sFilePath) const
 Return the file information about the passed file path. More...
 
void setTokens (std::string _sTokens)
 This member function may be used to update the path placeholders of the current FileSystem instance. More...
 
bool isFile (const std::string &_sPath) const
 This function determines, whether a path name indicates a file or a folder. More...
 
void initializeFromKernel ()
 Member function to remote-initialize the class from the kernel. Cannot be used during kernel start-up. More...
 
void setProgramPath (std::string _sExePath)
 
std::string getProgramPath () const
 
void declareFileType (const std::string &sFileType)
 

Static Public Member Functions

static bool is_including_syntax (const std::string &sLine)
 Static member function which determines, whether the passed line is actually a including syntax. More...
 

Private Member Functions

void openIncludedFile (const std::string &sIncludingString)
 Opens the included file and determines the including type. More...
 

Private Attributes

StyledTextFilem_include
 
int nIncludeLine
 
int m_type
 

Additional Inherited Members

- Protected Member Functions inherited from FileSystem
int createFolders (const std::string &_sPath) const
 This member function creates all missing directories in the passed path. More...
 
- Protected Attributes inherited from FileSystem
std::string sPath
 
std::string sExecutablePath
 
std::string sTokens [7][2]
 
std::string sValidExtensions
 

Detailed Description

This class represents a file, which can be included into other files using the @ syntax.

Definition at line 31 of file includer.hpp.

Member Enumeration Documentation

◆ IncludeType

Enumerator
INCLUDE_ALL 
INCLUDE_DEFINES 
INCLUDE_DECLARATIONS 
INCLUDE_GLOBALS 

Definition at line 34 of file includer.hpp.

Constructor & Destructor Documentation

◆ Includer()

Includer::Includer ( const std::string &  sIncludingString,
const std::string &  sSearchPath 
)

Includer class constructor. Opens the included file defined by the passed including string.

Parameters
sIncludingStringconst std::string&
sSearchPathconst std::string&

Definition at line 137 of file includer.cpp.

References NumeReKernel::getInstance(), FileSystem::getPath(), FileSystem::getProgramPath(), FileSystem::initializeFromKernel(), openIncludedFile(), and FileSystem::setPath().

Here is the call graph for this function:

◆ ~Includer()

Includer::~Includer ( )

Includer class destructor. Frees up internal memory if needed.

Definition at line 154 of file includer.cpp.

References m_include.

Member Function Documentation

◆ getCurrentLine()

int Includer::getCurrentLine ( ) const
inline

Definition at line 53 of file includer.hpp.

References nIncludeLine.

◆ getIncludedFileName()

std::string Includer::getIncludedFileName ( ) const

Returns the embedded file name.

Returns
std::string

Definition at line 300 of file includer.cpp.

References StyledTextFile::getFileName(), is_open(), and m_include.

Referenced by resolveIncludes().

Here is the call graph for this function:

◆ getIncludedType()

int Includer::getIncludedType ( ) const
inline

Definition at line 58 of file includer.hpp.

References m_type.

◆ getNextLine()

std::string Includer::getNextLine ( )

Return the next line of the included string.

Returns
std::string

Definition at line 168 of file includer.cpp.

References findCommand(), StyledTextFile::getLinesCount(), StyledTextFile::getStrippedLine(), INCLUDE_DECLARATIONS, INCLUDE_DEFINES, INCLUDE_GLOBALS, is_open(), m_include, m_type, nIncludeLine, Match::sString, StripSpaces(), and SYMDEF_COMMAND.

Referenced by CodeAnalyzer::analyseCommands().

Here is the call graph for this function:

◆ is_including_syntax()

bool Includer::is_including_syntax ( const std::string &  sLine)
static

Static member function which determines, whether the passed line is actually a including syntax.

Parameters
sLineconst std::string&
Returns
bool

Definition at line 318 of file includer.cpp.

References findCommand().

Referenced by Script::handleIncludeSyntax(), parseLayoutScript(), ProcedureElement::ProcedureElement(), and resolveIncludes().

Here is the call graph for this function:

◆ is_open()

bool Includer::is_open ( ) const

Determine, if the internal included file is open and valid.

Returns
bool

Definition at line 285 of file includer.cpp.

References m_include.

Referenced by CodeAnalyzer::analyseCommands(), getIncludedFileName(), and getNextLine().

◆ openIncludedFile()

void Includer::openIncludedFile ( const std::string &  sIncludingString)
private

Opens the included file and determines the including type.

Parameters
sIncludingStringconst std::string&
Returns
void

Definition at line 33 of file includer.cpp.

References _lang, findCommand(), Language::get(), StyledTextFile::getLastPosition(), INCLUDE_DECLARATIONS, INCLUDE_DEFINES, INCLUDE_GLOBALS, SyntaxError::INCLUDE_NOT_EXIST, SyntaxError::invalid_position, NumeReKernel::issueWarning(), m_include, m_type, Match::nPos, Match::sString, StripSpaces(), and FileSystem::ValidFileName().

Referenced by Includer().

Here is the call graph for this function:

Member Data Documentation

◆ m_include

StyledTextFile* Includer::m_include
private

Definition at line 43 of file includer.hpp.

Referenced by getIncludedFileName(), getNextLine(), is_open(), openIncludedFile(), and ~Includer().

◆ m_type

int Includer::m_type
private

Definition at line 45 of file includer.hpp.

Referenced by getIncludedType(), getNextLine(), and openIncludedFile().

◆ nIncludeLine

int Includer::nIncludeLine
private

Definition at line 44 of file includer.hpp.

Referenced by getCurrentLine(), and getNextLine().


The documentation for this class was generated from the following files: