karen pointer sur fonctions en static, sed resolution eof
This commit is contained in:
62
d01/ex04/Makefile.replace
Normal file
62
d01/ex04/Makefile.replace
Normal file
@@ -0,0 +1,62 @@
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
|
||||
# . name = value . name is case sensitive #
|
||||
# VARIABLES . or name = value \ . use VPATH only for .c #
|
||||
# . value . or .cpp #
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
|
||||
|
||||
NAME = sed
|
||||
|
||||
CC = clang++
|
||||
CFLAGS = -Wall -Wextra -Werror $(INCLUDES) -std=c++98 -g3
|
||||
|
||||
VPATH = $(D_SRCS)
|
||||
|
||||
LIBS =
|
||||
|
||||
INCLUDES = -I$(D_HEADERS)
|
||||
|
||||
D_SRCS = .
|
||||
SRCS = main.cpp \
|
||||
Sed.cpp
|
||||
|
||||
D_HEADERS = .
|
||||
HEADERS = Sed.hpp
|
||||
|
||||
D_OBJS = builds
|
||||
OBJS = $(SRCS:%.cpp=$(D_OBJS)/%.o)
|
||||
|
||||
RM_D_OBJS = rm -rf $(D_OBJS)
|
||||
ifeq "$(D_OBJS)" "."
|
||||
RM_D_OBJS =
|
||||
endif
|
||||
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
|
||||
# . target: prerequisites . $@ : target #
|
||||
# RULES . recipe . $< : 1st prerequisite #
|
||||
# . recipe . $^ : all prerequisites #
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
|
||||
|
||||
all: $(NAME)
|
||||
|
||||
$(D_OBJS)/%.o: %.cpp | $(D_OBJS)
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
$(D_OBJS):
|
||||
mkdir $@
|
||||
|
||||
$(OBJS): $(HEADERS:%=$(D_HEADERS)/%)
|
||||
|
||||
$(NAME): $(OBJS)
|
||||
$(CC) $(OBJS) -o $@ $(LIBS)
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS)
|
||||
|
||||
fclean: clean
|
||||
rm -f $(NAME)
|
||||
$(RM_D_OBJS)
|
||||
|
||||
re: fclean all
|
||||
|
||||
.PHONY : all clean fclean re bonus run valgrind
|
||||
@@ -37,8 +37,8 @@ void Sed::replace() {
|
||||
str.erase(str.begin());
|
||||
str.push_back(file.get());
|
||||
}
|
||||
for (int i = 0; str[i + 1]; i++)
|
||||
new_file << str[i];
|
||||
str.erase(str.end() - 1);
|
||||
new_file << str;
|
||||
|
||||
}
|
||||
|
||||
|
||||
BIN
d01/ex04/sed
Executable file
BIN
d01/ex04/sed
Executable file
Binary file not shown.
0
d01/ex04/test.txt.replace
Normal file
0
d01/ex04/test.txt.replace
Normal file
1
d01/ex04/unitests/test_log/test1
Normal file
1
d01/ex04/unitests/test_log/test1
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
1
d01/ex04/unitests/test_log/test1.replace
Normal file
1
d01/ex04/unitests/test_log/test1.replace
Normal file
@@ -0,0 +1 @@
|
||||
hello
|
||||
5
d01/ex04/unitests/test_log/test2
Normal file
5
d01/ex04/unitests/test_log/test2
Normal file
@@ -0,0 +1,5 @@
|
||||
ce fichier
|
||||
contient
|
||||
plusieurs lignes
|
||||
les unes au dessus des autres
|
||||
youhouuu ioieux
|
||||
5
d01/ex04/unitests/test_log/test2.replace
Normal file
5
d01/ex04/unitests/test_log/test2.replace
Normal file
@@ -0,0 +1,5 @@
|
||||
ce fich++r
|
||||
cont++nt
|
||||
plus++urs lignes
|
||||
les unes au dessus des autres
|
||||
youhouuu io++ux
|
||||
1
d01/ex04/unitests/test_log/test3
Normal file
1
d01/ex04/unitests/test_log/test3
Normal file
@@ -0,0 +1 @@
|
||||
....................................................;
|
||||
1
d01/ex04/unitests/test_log/test3.replace
Normal file
1
d01/ex04/unitests/test_log/test3.replace
Normal file
@@ -0,0 +1 @@
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++++++;
|
||||
2
d01/ex04/unitests/test_log/test4
Normal file
2
d01/ex04/unitests/test_log/test4
Normal file
@@ -0,0 +1,2 @@
|
||||
...................................................;
|
||||
. . . . . . . . . . . . . . . . . . . . . . . . . .;
|
||||
2
d01/ex04/unitests/test_log/test4.replace
Normal file
2
d01/ex04/unitests/test_log/test4.replace
Normal file
@@ -0,0 +1,2 @@
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++++.;
|
||||
. . . . . . . . . . . . . . . . . . . . . . . . . .;
|
||||
1
d01/ex04/unitests/test_log/test5
Normal file
1
d01/ex04/unitests/test_log/test5
Normal file
@@ -0,0 +1 @@
|
||||
test de mmdr foubar
|
||||
1
d01/ex04/unitests/test_log/test5.replace
Normal file
1
d01/ex04/unitests/test_log/test5.replace
Normal file
@@ -0,0 +1 @@
|
||||
test de m||| foubar
|
||||
2
d01/ex04/unitests/test_log/test6
Normal file
2
d01/ex04/unitests/test_log/test6
Normal file
@@ -0,0 +1,2 @@
|
||||
trouve ce mot toutouille
|
||||
et celui-la toutoutouille
|
||||
2
d01/ex04/unitests/test_log/test6.replace
Normal file
2
d01/ex04/unitests/test_log/test6.replace
Normal file
@@ -0,0 +1,2 @@
|
||||
trouve ce mot ||||||||||
|
||||
et celui-la tou||||||||||
|
||||
27
d01/ex04/unitests/test_log/test7
Normal file
27
d01/ex04/unitests/test_log/test7
Normal file
@@ -0,0 +1,27 @@
|
||||
No more tears, my heart is dry
|
||||
I don't laugh and I don't cry
|
||||
I don't think about you all the time
|
||||
But when I do - I wonder why
|
||||
|
||||
You have to go out of my door
|
||||
And leave just like you did before
|
||||
I know I said that I was sure
|
||||
But rich men can't imagine poor.
|
||||
|
||||
One day baby, we'll be old
|
||||
Oh baby, we'll be old
|
||||
And think of all the stories that we could have told
|
||||
|
||||
Little me and little you
|
||||
Kept doing all the things they do
|
||||
They never really think it through
|
||||
Like I can never think you're true
|
||||
|
||||
Here I go again - the blame
|
||||
The guilt, the pain, the hurt, the shame
|
||||
The founding fathers of our plane
|
||||
That's stuck in heavy clouds of rain.
|
||||
|
||||
One day baby, we'll be old
|
||||
Oh baby, we'll be old
|
||||
And think of all the stories that we could have told
|
||||
27
d01/ex04/unitests/test_log/test7.replace
Normal file
27
d01/ex04/unitests/test_log/test7.replace
Normal file
@@ -0,0 +1,27 @@
|
||||
No more tears, my heart is dry
|
||||
I do000 laugh and I do000 cry
|
||||
I do000 think about you all the time
|
||||
But when I do - I wonder why
|
||||
|
||||
You have to go out of my door
|
||||
And leave just like you did before
|
||||
I know I said that I was sure
|
||||
But rich men ca000 imagine poor.
|
||||
|
||||
One day baby, we'll be old
|
||||
Oh baby, we'll be old
|
||||
And think of all the stories that we could have told
|
||||
|
||||
Little me and little you
|
||||
Kept doing all the things they do
|
||||
They never really think it through
|
||||
Like I can never think you're true
|
||||
|
||||
Here I go again - the blame
|
||||
The guilt, the pain, the hurt, the shame
|
||||
The founding fathers of our plane
|
||||
That's stuck in heavy clouds of rain.
|
||||
|
||||
One day baby, we'll be old
|
||||
Oh baby, we'll be old
|
||||
And think of all the stories that we could have told
|
||||
4
d01/ex04/unitests/test_log/test8
Normal file
4
d01/ex04/unitests/test_log/test8
Normal file
@@ -0,0 +1,4 @@
|
||||
No more tears, my heart is dry
|
||||
I don't laugh and I don't cry
|
||||
I don't think about you all the time
|
||||
But when I do - I wonder why
|
||||
4
d01/ex04/unitests/test_log/test8.replace
Normal file
4
d01/ex04/unitests/test_log/test8.replace
Normal file
@@ -0,0 +1,4 @@
|
||||
No more tears, my heart is doo
|
||||
oooooooolaugh and I don't coo
|
||||
oooooooothink about you all the time
|
||||
But when I do - I wonder why
|
||||
@@ -1,13 +1,9 @@
|
||||
#include "Karen.hpp"
|
||||
|
||||
void (Karen::*Karen::_fp[4])() = { &Karen::_debug, &Karen::_info, &Karen::_warning, &Karen::_error};
|
||||
|
||||
Karen::Karen() {
|
||||
|
||||
_fp[0] = &Karen::_debug;
|
||||
_fp[1] = &Karen::_info;
|
||||
_fp[2] = &Karen::_warning;
|
||||
_fp[3] = &Karen::_error;
|
||||
|
||||
_level[0] = "DEBUG";
|
||||
_level[1] = "INFO";
|
||||
_level[2] = "WARNING";
|
||||
|
||||
@@ -14,7 +14,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
void (Karen::*_fp[4])();
|
||||
static void (Karen::*_fp[4])();
|
||||
std::string _level[4];
|
||||
|
||||
void _debug( void );
|
||||
|
||||
BIN
d01/ex05/karen
BIN
d01/ex05/karen
Binary file not shown.
Reference in New Issue
Block a user