NREB::IO::Folder Class Reference

Represent a folder entry. More...

#include <NREB_Folder.hpp>

Inheritance diagram for NREB::IO::Folder:
NREB::IO::Entry

Public Member Functions

 Folder (std::string const &n, Entry *p=nullptr)
 
 ~Folder ()
 
void analyse ()
 
void createMakefile (FileList &files, FolderList &folders, std::string const &src="src") const
 
void createProjectMakefile (FileList &files, FolderList &folders, std::string const &src="src") const
 
void createArchiverScript (FileList &files) const
 
bool hasFileChild () const
 
bool hasFolderChild () const
 
bool hasDeepSources () const
 
bool isFile () const override
 
bool isFolder () const override
 
bool notOnlyHeaders () const
 
FileList getSourceChild () const
 
FileList getHeaderChild () const
 
FolderList getFolderChild () const
 
std::string getBackwardPath () const
 
std::string getObjectPath () const
 
std::string getUpperName () const
 
bool hasCppSource () const
 
bool hasCppHeader () const
 
bool hasCSource () const
 
bool hasCHeader () const
 
void insertFileChilds (std::ofstream &file, FileList &files) const
 
void insertFolderChilds (std::ofstream &file, FolderList &folders) const
 
void insertTarget (std::ofstream &file, bool hasFolder, bool hasFile) const
 
void insertFolderCalls (std::ofstream &file) const
 
void insertFileCall (std::ofstream &file) const
 
bool isExcluded (std::string const &path)
 
- Public Member Functions inherited from NREB::IO::Entry
 Entry (std::string const &n, Entry *p=nullptr)
 
virtual ~Entry ()=default
 
std::string getPath () const
 
std::string const & getName () const
 
const EntrygetParent () const
 

Additional Inherited Members

- Static Public Attributes inherited from NREB::IO::Entry
static const std::string MARKER_HEADER = ".hpp"
 
static const std::string MARKER_COMPILER = "CXX"
 
static const std::string MARKER_LINKER = "LD"
 
static const std::string MARKER_CFLAGS = "CFLAGS"
 
static const std::string MARKER_LDFLAGS = "LDFLAGS"
 
static const std::string MARKER_INC = "INC"
 
static const std::string MARKER_BIN = "BIN"
 
static const std::string MARKER_LIB = "LIB"
 
static const std::string MARKER_LIBDIR = "LIBDIR"
 
static const std::string MARKER_CHILDS = "childs"
 
static const std::string MARKER_OUT = "out"
 
static const std::string MARKER_TARGET = "all"
 
static const std::string MARKER_OBJ = "OBJ"
 
static const std::string MARKER_SOURCE = ".cpp"
 
static const std::string MARKER_SOURCE_C = ".c"
 
static const std::string MARKER_HEADER_C = ".h"
 
static const std::string MARKER_O = ".o"
 
static const std::string MARKER_OBJDIR = "OBJDIR"
 
static const std::string START_CALL = "$("
 
static const std::string END_CALL = ")"
 
static const std::string CALL_COMPILER = START_CALL + MARKER_COMPILER + END_CALL
 
static const std::string CALL_CFLAGS = START_CALL + MARKER_CFLAGS + END_CALL
 
static const std::string CALL_INC = START_CALL + MARKER_INC + END_CALL
 
static const std::string CALL_OBJDIR = START_CALL + MARKER_OBJDIR + END_CALL
 
static const std::string CALL_OBJ = START_CALL + MARKER_OBJ + END_CALL
 
static const std::string MAKEFILE = "Makefile"
 
static const std::string ARCHIVER = "archive.sh"
 

Detailed Description

Represent a folder entry.

Constructor & Destructor Documentation

NREB::IO::Folder::Folder ( std::string const &  n,
Entry p = nullptr 
)

Construct an entry

Parameters
nthe entry's name
pthe entry's parent
NREB::IO::Folder::~Folder ( )

Entry deconstructor

Member Function Documentation

void NREB::IO::Folder::analyse ( )

Analyse the folder

void NREB::IO::Folder::createArchiverScript ( FileList &  files) const

Create a bash script to create object archive

Parameters
fileslist containing all explorated files
void NREB::IO::Folder::createMakefile ( FileList &  files,
FolderList &  folders,
std::string const &  src = "src" 
) const

Create the entry corresponding makefile

Parameters
fileslist containing all explorated files
folderslist containing all explorated folders
srcthe source directory
void NREB::IO::Folder::createProjectMakefile ( FileList &  files,
FolderList &  folders,
std::string const &  src = "src" 
) const

Create the project main makefile

Parameters
fileslist containing all explorated files
folderslist containing all explorated folders
srcthe source directory
std::string NREB::IO::Folder::getBackwardPath ( ) const
Returns
the path to return to src
FolderList NREB::IO::Folder::getFolderChild ( ) const

Get all folder child in a vector

Returns
the child's vector
FileList NREB::IO::Folder::getHeaderChild ( ) const

Get all header file child in a vector

Returns
the child's vector
std::string NREB::IO::Folder::getObjectPath ( ) const
Returns
the object path
FileList NREB::IO::Folder::getSourceChild ( ) const

Get all source file child in a vector

Returns
the child's vector
std::string NREB::IO::Folder::getUpperName ( ) const
Returns
the entry name in upper case
bool NREB::IO::Folder::hasCHeader ( ) const
Returns
if the folder contains c header
bool NREB::IO::Folder::hasCppHeader ( ) const
Returns
if the folder contains cpp header
bool NREB::IO::Folder::hasCppSource ( ) const
Returns
if the folder contains cpp sources
bool NREB::IO::Folder::hasCSource ( ) const
Returns
if the folder contains c sources
bool NREB::IO::Folder::hasDeepSources ( ) const
Returns
if the entry has deep sources
bool NREB::IO::Folder::hasFileChild ( ) const
Returns
if the entry has file childs
bool NREB::IO::Folder::hasFolderChild ( ) const
Returns
if the entry has folder childs
void NREB::IO::Folder::insertFileCall ( std::ofstream &  file) const

Insert file compilation call

Parameters
filethe file output
void NREB::IO::Folder::insertFileChilds ( std::ofstream &  file,
FileList &  files 
) const

Insert header to declare file compilation

Parameters
filethe file output
fileslist containing all explorated files
void NREB::IO::Folder::insertFolderCalls ( std::ofstream &  file) const

Insert folder compilation call

Parameters
filethe file output
void NREB::IO::Folder::insertFolderChilds ( std::ofstream &  file,
FolderList &  folders 
) const

Insert folder declaration

Parameters
filethe file output
folderslist containing all explorated file
void NREB::IO::Folder::insertTarget ( std::ofstream &  file,
bool  hasFolder,
bool  hasFile 
) const

Insert compilation target

Parameters
filethe file output
hasFoldertell if the entry has folder childs
hasFiletell if the entry has file childs
bool NREB::IO::Folder::isExcluded ( std::string const &  path)

Check if a path is excluded

Parameters
paththe path to check
Returns
the test result
bool NREB::IO::Folder::isFile ( ) const
overridevirtual
Returns
if the entry is a file

Implements NREB::IO::Entry.

bool NREB::IO::Folder::isFolder ( ) const
overridevirtual
Returns
if the folder is a folder

Implements NREB::IO::Entry.

bool NREB::IO::Folder::notOnlyHeaders ( ) const
Returns
if the folder is not only composed of headers

The documentation for this class was generated from the following files:
  • /mnt/c/Users/abell/Documents/GitHub/NRE-Builder/src/IO/Folder/NREB_Folder.hpp
  • /mnt/c/Users/abell/Documents/GitHub/NRE-Builder/src/IO/Folder/NREB_Folder.cpp