Skip to content

Commit fd5e7d5

Browse files
committed
Restructured the message framework, passing tests on Linux/GCC 4.7.
1 parent 4d424b8 commit fd5e7d5

Some content is hidden

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

44 files changed

+132
-19
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,4 @@ message(STATUS " CPP-NETLIB_DISABLE_LOGGING: ${CPP-NETLIB_DISABLE_LOGGING}\t(
111111
#
112112

113113
add_subdirectory(uri)
114+
add_subdirectory(message)

message/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@
44
# http://www.boost.org/LICENSE_1_0.txt)
55

66
add_subdirectory(src)
7-
add_subdirectory(test)
7+
8+
if(CPP-NETLIB_BUILD_TESTS)
9+
enable_testing()
10+
add_subdirectory(test)
11+
endif(CPP-NETLIB_BUILD_TESTS)

message/src/CMakeLists.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright (c) Glyn Matthews 2012.
2+
# Distributed under the Boost Software License, Version 1.0.
3+
# (See accompanying file LICENSE_1_0.txt or copy at
4+
# http://www.boost.org/LICENSE_1_0.txt)
5+
6+
if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
7+
if (HAVE_STD11)
8+
set(CPP-NETLIB_CXXFLAGS "-Wall -std=c++11")
9+
elseif (HAVE_STD0X)
10+
set(CPP-NETLIB_CXXFLAGS "-Wall -std=c++0x")
11+
endif()
12+
elseif (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
13+
CHECK_CXX_COMPILER_FLAG(-std=c++11 HAVE_STD11)
14+
set(CPP-NETLIB_CXXFLAGS "-Wall -std=c++11 -stdlib=libc++")
15+
set(CPP-NETLIB_CXXFLAGS "-Wall -std=c++11 -stdlib=libc++")
16+
endif()
17+
18+
include_directories(${CPP-NETLIB_SOURCE_DIR}/uri/src ${CPP-NETLIB_SOURCE_DIR}/message/src)
19+
set(CPP-NETLIB_MESSAGE_SRCS message.cpp directives.cpp wrappers.cpp)
20+
add_library(cppnetlib-message ${CPP-NETLIB_MESSAGE_SRCS})
21+
foreach (src_file ${CPP-NETLIB_MESSAGE_SRCS})
22+
if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
23+
set_source_files_properties(${src_file}
24+
PROPERTIES COMPILE_FLAGS ${CPP-NETLIB_CXXFLAGS})
25+
elseif (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
26+
set_source_files_properties(${src_file}
27+
PROPERTIES COMPILE_FLAGS ${CPP-NETLIB_CXXFLAGS})
28+
endif()
29+
endforeach(src_file)

message/src/network/detail/debug.hpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#ifndef NETWORK_DEBUG_HPP_20110410
2+
#define NETWORK_DEBUG_HPP_20110410
3+
4+
// (c) Copyright 2011 Dean Michael Berris.
5+
// Copyright 2012 Google, Inc.
6+
// Copyright 2012 A. Joel Lamotte
7+
// Distributed under the Boost Software License, Version 1.0.
8+
// (See accompanying file LICENSE_1_0.txt or copy at
9+
// http://www.boost.org/LICENSE_1_0.txt)
10+
11+
/** NETWORK_MESSAGE is a debugging macro used by cpp-netlib to
12+
print out network-related errors through standard error. This is only
13+
useful when NETWORK_DEBUG is turned on. Otherwise the macro amounts to a
14+
no-op.
15+
16+
The user can force the logging to be enabled by defining NETWORK_ENABLE_LOGGING.
17+
*/
18+
#if defined(NETWORK_DEBUG) && !defined(NETWORK_ENABLE_LOGGING)
19+
# define NETWORK_ENABLE_LOGGING
20+
#endif
21+
22+
#ifdef NETWORK_ENABLE_LOGGING
23+
24+
# include <network/logging/logging.hpp>
25+
# ifndef NETWORK_MESSAGE
26+
# define NETWORK_MESSAGE(msg) { network::logging::log( network::logging::log_record( __FILE__, __LINE__ ) << msg ); }
27+
# endif
28+
29+
#else
30+
31+
# ifndef NETWORK_MESSAGE
32+
# define NETWORK_MESSAGE(msg)
33+
# endif
34+
35+
#endif
36+
37+
38+
#endif /* end of include guard: NETWORK_DEBUG_HPP_20110410 */
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
// Copyright Dean Michael Berris 2007.
3+
// Copyright 2012 Google, Inc.
4+
// Distributed under the Boost Software License, Version 1.0.
5+
// (See accompanying file LICENSE_1_0.txt or copy at
6+
// http://www.boost.org/LICENSE_1_0.txt)
7+
8+
#ifndef NETWORK_DETAIL_DIRECTIVE_BASE_HPP__
9+
#define NETWORK_DETAIL_DIRECTIVE_BASE_HPP__
10+
11+
/** Defines the base type from which all directives inherit
12+
* to allow friend access to message and other types' internals.
13+
*/
14+
namespace network { namespace detail {
15+
16+
} // namespace detail
17+
18+
} // namespace network
19+
20+
#endif // NETWORK_DETAIL_DIRECTIVE_BASE_HPP__
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
// Copyright Dean Michael Berris 2007.
3+
// Copyright 2012 Google, Inc.
4+
// Distributed under the Boost Software License, Version 1.0.
5+
// (See accompanying file LICENSE_1_0.txt or copy at
6+
// http://www.boost.org/LICENSE_1_0.txt)
7+
8+
#ifndef NETWORK_DETAIL_WRAPPER_BASE_HPP__
9+
#define NETWORK_DETAIL_WRAPPER_BASE_HPP__
10+
11+
#endif // NETWORK_DETAIL_WRAPPER_BASE_HPP__
12+
File renamed without changes.

0 commit comments

Comments
 (0)