Skip to content

Commit 723513d

Browse files
author
Sebastiano Merlino
committed
Modified code in order to use forward declaration in .h instead of including headers
Reordered including structures
1 parent f727f0c commit 723513d

18 files changed

+1457
-8507
lines changed

src/HttpEndpoint.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/*
2+
This file is part of libhttpserver
3+
Copyright (C) 2011 Sebastiano Merlino
4+
5+
This library is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU Lesser General Public
7+
License as published by the Free Software Foundation; either
8+
version 2.1 of the License, or (at your option) any later version.
9+
10+
This library 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 GNU
13+
Lesser General Public License for more details.
14+
15+
You should have received a copy of the GNU Lesser General Public
16+
License along with this library; if not, write to the Free Software
17+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18+
19+
*/
120
#include "HttpEndpoint.hpp"
221
#include "HttpUtils.hpp"
322
#include "string_utilities.hpp"

src/HttpRequest.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
/*
2+
This file is part of libhttpserver
3+
Copyright (C) 2011 Sebastiano Merlino
4+
5+
This library is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU Lesser General Public
7+
License as published by the Free Software Foundation; either
8+
version 2.1 of the License, or (at your option) any later version.
9+
10+
This library 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 GNU
13+
Lesser General Public License for more details.
14+
15+
You should have received a copy of the GNU Lesser General Public
16+
License along with this library; if not, write to the Free Software
17+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18+
19+
*/
20+
#include "HttpUtils.hpp"
121
#include "HttpRequest.hpp"
222
#include "string_utilities.hpp"
323

src/HttpResource.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/*
2+
This file is part of libhttpserver
3+
Copyright (C) 2011 Sebastiano Merlino
4+
5+
This library is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU Lesser General Public
7+
License as published by the Free Software Foundation; either
8+
version 2.1 of the License, or (at your option) any later version.
9+
10+
This library 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 GNU
13+
Lesser General Public License for more details.
14+
15+
You should have received a copy of the GNU Lesser General Public
16+
License along with this library; if not, write to the Free Software
17+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18+
19+
*/
120
#include "HttpResource.hpp"
221
#include "HttpUtils.hpp"
322
#include "HttpRequest.hpp"

src/HttpResponse.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,24 @@
1+
/*
2+
This file is part of libhttpserver
3+
Copyright (C) 2011 Sebastiano Merlino
4+
5+
This library is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU Lesser General Public
7+
License as published by the Free Software Foundation; either
8+
version 2.1 of the License, or (at your option) any later version.
9+
10+
This library 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 GNU
13+
Lesser General Public License for more details.
14+
15+
You should have received a copy of the GNU Lesser General Public
16+
License along with this library; if not, write to the Free Software
17+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18+
19+
*/
120
#include <cstdio>
21+
#include "HttpUtils.hpp"
222
#include "HttpResponse.hpp"
323
#include "Webserver.hpp"
424

src/Makefile.am

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
# License along with this library; if not, write to the Free Software
1717
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1818

19-
INCLUDES = -I../
19+
INCLUDES = -I../ -I$(srcdir)/httpserver/
2020
METASOURCES = AUTO
2121
lib_LTLIBRARIES = libhttpserver.la
2222
libhttpserver_la_SOURCES = string_utilities.cpp Webserver.cpp HttpUtils.cpp HttpEndpoint.cpp HttpRequest.cpp HttpResponse.cpp HttpResource.cpp
23-
noinst_HEADERS = string_utilities.hpp
24-
include_HEADERS = Webserver.hpp HttpUtils.hpp HttpEndpoint.hpp HttpRequest.hpp HttpResponse.hpp HttpResource.hpp
23+
noinst_HEADERS = httpserver/string_utilities.hpp
24+
nobase_include_HEADERS = httpserver.h httpserver/Webserver.hpp httpserver/HttpUtils.hpp httpserver/HttpEndpoint.hpp httpserver/HttpRequest.hpp httpserver/HttpResponse.hpp httpserver/HttpResource.hpp
2525
AM_CXXFLAGS = -fPIC -Wall
2626
libhttpserver_la_LIBADD = -lmicrohttpd
2727
libhttpserver_la_LDFLAGS =

src/Webserver.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,28 @@
1717
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1818
1919
*/
20-
#include "Webserver.hpp"
21-
#include "HttpUtils.hpp"
22-
#include "iostream"
23-
#include "string_utilities.hpp"
20+
#include <iostream>
2421
#include <stdlib.h>
2522
#include <stdio.h>
2623
#include <errno.h>
2724
#include <unistd.h>
2825
#include <sys/stat.h>
2926
#include <sys/types.h>
3027
#include <signal.h>
28+
3129
#ifdef WITH_PYTHON
3230
#include <Python.h>
3331
#endif
3432

33+
#include "HttpUtils.hpp"
34+
#include "HttpResource.hpp"
35+
#include "HttpResponse.hpp"
36+
#include "HttpRequest.hpp"
37+
#include "HttpEndpoint.hpp"
38+
#include "string_utilities.hpp"
39+
#include "Webserver.hpp"
40+
41+
3542
using namespace std;
3643

3744
namespace httpserver {
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,20 @@
1+
#
2+
# This file is part of libhttpserver
3+
# Copyright (C) 2011 Sebastiano Merlino
4+
#
5+
# This library is free software; you can redistribute it and/or
6+
# modify it under the terms of the GNU Lesser General Public
7+
# License as published by the Free Software Foundation; either
8+
# version 2.1 of the License, or (at your option) any later version.
9+
#
10+
# This library 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 GNU
13+
# Lesser General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU Lesser General Public
16+
# License along with this library; if not, write to the Free Software
17+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18+
#
119
$(srcdir)/WebserverWrap.cpp $(srcdir)/WebserverWrap.h: $(top_srcdir)/src/Webserver.hpp
220
swig -c++ -$(language) -o $(srcdir)/WebserverWrap.cpp $(srcdir)/../Webserver.hpp

src/httpserver.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#ifndef _httpserver_h_
2+
#define _httpserver_h_
3+
4+
#include "httpserver/HttpUtils.hpp"
5+
#include "httpserver/HttpEndpoint.hpp"
6+
#include "httpserver/HttpResource.hpp"
7+
#include "httpserver/HttpResponse.hpp"
8+
#include "httpserver/HttpRequest.hpp"
9+
#include "httpserver/Webserver.hpp"
10+
11+
#endif
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/*
2+
This file is part of libhttpserver
3+
Copyright (C) 2011 Sebastiano Merlino
4+
5+
This library is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU Lesser General Public
7+
License as published by the Free Software Foundation; either
8+
version 2.1 of the License, or (at your option) any later version.
9+
10+
This library 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 GNU
13+
Lesser General Public License for more details.
14+
15+
You should have received a copy of the GNU Lesser General Public
16+
License along with this library; if not, write to the Free Software
17+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18+
19+
*/
120
#ifndef _http_endpoint_hpp_
221
#define _http_endpoint_hpp_
322

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,42 @@
1+
/*
2+
This file is part of libhttpserver
3+
Copyright (C) 2011 Sebastiano Merlino
4+
5+
This library is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU Lesser General Public
7+
License as published by the Free Software Foundation; either
8+
version 2.1 of the License, or (at your option) any later version.
9+
10+
This library 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 GNU
13+
Lesser General Public License for more details.
14+
15+
You should have received a copy of the GNU Lesser General Public
16+
License along with this library; if not, write to the Free Software
17+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18+
19+
*/
120
#ifndef _http_request_hpp_
221
#define _http_request_hpp_
322

423
#include <map>
524
#include <vector>
625
#include <string>
7-
#include "HttpUtils.hpp"
826

927
namespace httpserver
1028
{
1129

1230
class Webserver;
1331

32+
namespace http
33+
{
34+
class HeaderComparator;
35+
class ArgComparator;
36+
};
37+
1438
using namespace http;
39+
1540
/**
1641
* Class representing an abstraction for an Http Request. It is used from classes using these apis to receive information through http protocol.
1742
**/

0 commit comments

Comments
 (0)