Skip to content

Commit d728fe7

Browse files
committed
merged
2 parents 76c7bb5 + 0fcf737 commit d728fe7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+6104
-475
lines changed

exFOO/.brew_install.sh

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
2+
#########.
3+
########",#:
4+
#########',##".
5+
##'##'## .##',##.
6+
## ## ## # ##",#.
7+
## ## ## ## ##'
8+
## ## ## :##
9+
## ## ##."
10+
11+
# Delete and reinstall Homebrew from Github repo
12+
rm -rf $HOME/.brew
13+
git clone --depth=1 https://github.com/Homebrew/brew $HOME/.brew
14+
echo ""
15+
echo "This next step may take a while, please be patient..."
16+
echo ""
17+
18+
# Create .brewconfig script in home directory
19+
cat > $HOME/.brewconfig.zsh <<EOL
20+
# HOMEBREW CONFIG
21+
22+
# Add brew to path
23+
export PATH=\$HOME/.brew/bin:\$PATH
24+
25+
# Set Homebrew temporary folders
26+
export HOMEBREW_CACHE=/tmp/\$USER/Homebrew/Caches
27+
export HOMEBREW_TEMP=/tmp/\$USER/Homebrew/Temp
28+
29+
mkdir -p \$HOMEBREW_CACHE
30+
mkdir -p \$HOMEBREW_TEMP
31+
32+
# If NFS session
33+
# Symlink Locks folder in /tmp
34+
if df -T autofs,nfs \$HOME 1>/dev/null
35+
then
36+
HOMEBREW_LOCKS_TARGET=/tmp/\$USER/Homebrew/Locks
37+
HOMEBREW_LOCKS_FOLDER=\$HOME/.brew/var/homebrew
38+
39+
mkdir -p \$HOMEBREW_LOCKS_TARGET
40+
mkdir -p \$HOMEBREW_LOCKS_FOLDER
41+
42+
# Symlink to Locks target folders
43+
# If not already a symlink
44+
if ! [[ -L \$HOMEBREW_LOCKS_FOLDER && -d \$HOMEBREW_LOCKS_FOLDER ]]
45+
then
46+
echo "Creating symlink for Locks folder"
47+
rm -rf \$HOMEBREW_LOCKS_FOLDER
48+
ln -s \$HOMEBREW_LOCKS_TARGET \$HOMEBREW_LOCKS_FOLDER
49+
fi
50+
fi
51+
EOL
52+
53+
# Add .brewconfig sourcing in your .zshrc if not already present
54+
if ! grep -q "# Load Homebrew config script" $HOME/.zshrc
55+
then
56+
cat >> $HOME/.zshrc <<EOL
57+
58+
# Load Homebrew config script
59+
source \$HOME/.brewconfig.zsh
60+
EOL
61+
fi
62+
63+
# Sources the .zshrc
64+
source $HOME/.zshrc > /dev/null 2>&1
65+
66+
hash -r
67+
brew update

exFOO/Colours.mk

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#------------------------------------------------------------------------------#
2+
# COLOURS #
3+
#------------------------------------------------------------------------------#
4+
5+
# Dark colours (Becomes light if bold)
6+
DMAGENTA =\033[0;35m
7+
DRED =\033[0;31m
8+
DYELLOW =\033[0;33m
9+
DGREEN =\033[0;32m
10+
DCYAN =\033[0;36m
11+
DBLUE =\033[0;34m
12+
13+
# Light and bold colours
14+
MAGENTA =\033[1;95m
15+
RED =\033[1;91m
16+
YELLOW =\033[1;93m
17+
GREEN =\033[1;92m
18+
CYAN =\033[1;96m
19+
BLUE =\033[1;94m
20+
21+
# Grayscale colours
22+
DEFCOL =\033[0m
23+
BLACK =\033[1;30m
24+
GRAY =\033[1;90m
25+
LGRAY =\033[1;37m
26+
WHITE =\033[1;97m
27+
28+
# RED : Deletion done (major)
29+
# MAGENTA : Deletion done (minor)
30+
31+
# YELLOW : Task started
32+
# GREEN : Task done
33+
34+
# CYAN : Creation done
35+
# BLUE : Installation done

exFOO/Foo.cpp

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#include "Foo.hpp"
2+
3+
4+
// Constructors - Destructor
5+
6+
Foo::Foo()
7+
{
8+
std::cout << "[ Called def. constr. for a FOO instance ]\n";
9+
this->name = "UNINITIALIZED";
10+
}
11+
Foo::Foo( const std::string _name )
12+
{
13+
std::cout << "[ Called param. constr. for a FOO instance ]\n";
14+
this->name = _name;
15+
}
16+
Foo::Foo( const Foo &other )
17+
{
18+
std::cout << "[ Called copy constr. for a FOO instance ]\n";
19+
this->name = other.getName();
20+
}
21+
Foo::~Foo() { std::cout << "[ Destroying a FOO instance ]\n"; }
22+
23+
// Operators
24+
25+
Foo &Foo::operator= ( const Foo &other )
26+
{
27+
std::cout << "[ Called assign. op. for a FOO instance ]\n";
28+
this->name = other.getName();
29+
30+
return *this;
31+
}
32+
33+
// Checkers
34+
35+
void Foo::checkName( const std::string _name ) const
36+
{
37+
if ( _name.empty() )
38+
throw BadName();
39+
}
40+
41+
42+
// Setters - Getters
43+
44+
void Foo::setName( const std::string _name )
45+
{
46+
checkName( _name );
47+
this->name = _name;
48+
}
49+
const std::string Foo::getName( void ) const
50+
{
51+
return ( this->name );
52+
}
53+
54+
55+
// Others
56+
57+
void Foo::printName( void ) const
58+
{
59+
std::cout << this->getName();
60+
}
61+
62+
std::ostream &operator<< (std::ostream &out, const Foo &rhs)
63+
{
64+
out << rhs.getName();
65+
return ( out );
66+
}

exFOO/Foo.hpp

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#ifndef FOO_HPP
2+
# define FOO_HPP
3+
4+
# define XCPT public: const char *what() const throw()
5+
6+
// basic libs
7+
# include <exception>
8+
# include <iostream>
9+
# include <iomanip>
10+
# include <sstream>
11+
# include <string>
12+
13+
14+
// CLASS FOO ( implemented in .cpp file )
15+
class Foo
16+
{
17+
private:
18+
// Attributes
19+
std::string name;
20+
21+
protected:
22+
// Checkers
23+
void checkName( const std::string _name ) const;
24+
25+
// Nested Classes
26+
class BadName : public std::exception { XCPT { return "Foo error : invalid name, idiot!"; } };
27+
28+
public:
29+
// Constructors - Destructor
30+
Foo();
31+
Foo( const std::string _name );
32+
Foo( const Foo &other );
33+
~Foo();
34+
35+
// Operators
36+
Foo &operator= ( const Foo &other );
37+
38+
// Setters - Getters
39+
void setName( const std::string _name );
40+
const std::string getName( void ) const;
41+
42+
// Others
43+
void printName( void ) const;
44+
45+
};
46+
47+
std::ostream &operator<< (std::ostream &out, const Foo &rhs);
48+
49+
50+
// TEMPLATE CLASS FOO_T ( implemented in .tpp file )
51+
template <class T>
52+
class Foo_T
53+
{
54+
private:
55+
// Attributes
56+
T value;
57+
58+
protected:
59+
// Checkers
60+
void checkValue( const T _value ) const;
61+
62+
// Nested Classes
63+
class BadValue : public std::exception { XCPT { return "Foo_T error : invalid value, dumbass!"; } };
64+
65+
public:
66+
// Constructors - Destructor
67+
Foo_T();
68+
Foo_T( const T _value );
69+
Foo_T( const Foo_T<T> &other );
70+
~Foo_T();
71+
72+
// Operators
73+
Foo_T<T> &operator= ( const Foo_T<T> &other );
74+
75+
// Setters - Getters
76+
void setValue( const T _value );
77+
const T getValue( void ) const;
78+
79+
// Others
80+
void printValue( void ) const;
81+
82+
};
83+
template < typename T >
84+
std::ostream &operator<< (std::ostream &out, const Foo_T<T> &rhs);
85+
86+
# include "Foo.tpp"
87+
88+
#endif // FOO_HPP

exFOO/Foo.tpp

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#include "Foo.hpp"
2+
3+
4+
// Constructors - Destructor
5+
6+
template < typename T >
7+
Foo_T<T>::Foo_T()
8+
{
9+
std::cout << "[ Called def. constr. for a FOO_T instance ]\n";
10+
this->value = 0;
11+
}
12+
template < typename T >
13+
Foo_T<T>::Foo_T( const T _value )
14+
{
15+
std::cout << "[ Called param. constr. for a FOO_T instance ]\n";
16+
this->value = _value;
17+
}
18+
template < typename T >
19+
Foo_T<T>::Foo_T( const Foo_T &other )
20+
{
21+
std::cout << "[ Called copy constr. for a FOO_T instance ]\n";
22+
this->value = other.getValue();
23+
}
24+
template < typename T >
25+
Foo_T<T>::~Foo_T() { std::cout << "[ Destroying a FOO_T instance ]\n"; }
26+
27+
// Operators
28+
29+
template < typename T >
30+
Foo_T<T> &Foo_T<T>::operator= ( const Foo_T &other )
31+
{
32+
std::cout << "[ Called assign. op. for a FOO_T instance ]\n";
33+
this->value = other.getValue();
34+
35+
return *this;
36+
}
37+
38+
// Checkers
39+
40+
template < typename T >
41+
void Foo_T<T>::checkValue( const T _value ) const
42+
{
43+
if ( _value < 0 )
44+
throw BadValue();
45+
}
46+
47+
48+
// Setters - Getters
49+
50+
template < typename T >
51+
void Foo_T<T>::setValue( const T _value )
52+
{
53+
checkValue( _value );
54+
this->value = _value;
55+
}
56+
57+
template < typename T >
58+
const T Foo_T<T>::getValue( void ) const
59+
{
60+
return ( this->value );
61+
}
62+
63+
64+
// Others
65+
66+
template < typename T >
67+
void Foo_T<T>::printValue( void ) const
68+
{
69+
std::cout << this->getValue();
70+
}
71+
72+
template < typename T >
73+
std::ostream &operator<< (std::ostream &out, const Foo_T<T> &rhs)
74+
{
75+
out << rhs.getValue();
76+
return ( out );
77+
}

0 commit comments

Comments
 (0)