Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite7bfb97

Browse files
committed
Moved around some directories and updated build scripts.
1 parente10bdf1 commite7bfb97

File tree

76 files changed

+4999
-19
lines changed

Some content is hidden

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

76 files changed

+4999
-19
lines changed

‎CMakeLists.txt‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,16 @@ if (Boost_FOUND)
8181
if(CPP-NETLIB_BUILD_TESTS)
8282
enable_testing()
8383
endif()
84-
add_subdirectory(libs/network/src)
84+
#add_subdirectory(libs/network/src)
8585
if(CPP-NETLIB_BUILD_TESTS)
8686
enable_testing()
87-
add_subdirectory(libs/network/test)
87+
#add_subdirectory(libs/network/test)
8888
if (NOTMSVC)
89-
add_subdirectory(libs/mime/test)
89+
#add_subdirectory(libs/mime/test)
9090
endif(NOTMSVC)
9191
endif()
9292
if(CPP-NETLIB_BUILD_EXAMPLES)
93-
add_subdirectory(libs/network/example)
93+
#add_subdirectory(libs/network/example)
9494
endif()
9595
endif(Boost_FOUND)
9696

@@ -104,3 +104,10 @@ message(STATUS " CPP-NETLIB_BUILD_TESTS: ${CPP-NETLIB_BUILD_TESTS}\t(Buil
104104
message(STATUS" CPP-NETLIB_BUILD_EXAMPLES: ${CPP-NETLIB_BUILD_EXAMPLES}\t(Build the examples using cpp-netlib: ON, OFF)")
105105
message(STATUS" CPP-NETLIB_ALWAYS_LOGGING: ${CPP-NETLIB_ALWAYS_LOGGING}\t(Allow cpp-netlib to log debug messages even in non-debug mode: ON, OFF)")
106106
message(STATUS" CPP-NETLIB_DISABLE_LOGGING: ${CPP-NETLIB_DISABLE_LOGGING}\t(Disable logging definitely, no logging code will be generated or compiled: ON, OFF)")
107+
108+
############################################################################
109+
#
110+
# The code following this point is for the new directory structure
111+
#
112+
113+
add_subdirectory(uri)

‎libs/network/src/CMakeLists.txt‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ if( CPP-NETLIB_ALWAYS_LOGGING )
3030
endif()
3131

3232
if(NOT CPP-NETLIB_DISABLE_LOGGING )
33-
set( CPP-NETLIB_LOGGING_SRCS
34-
logging/logging.cpp
33+
set( CPP-NETLIB_LOGGING_SRCS
34+
logging/logging.cpp
3535
)
3636
add_library(cppnetlib-logging ${CPP-NETLIB_LOGGING_SRCS})
3737
foreach (src_file ${CPP-NETLIB_LOGGING_SRCS})
@@ -40,24 +40,24 @@ if( NOT CPP-NETLIB_DISABLE_LOGGING )
4040
PROPERTIESCOMPILE_FLAGS ${CPP-NETLIB_CXXFLAGS})
4141
endif()
4242
endforeach(src_file)
43-
43+
4444
# this library name is defined only if we created the target
4545
# if not then it will be empty
4646
set( CPP-NETLIB_LOGGING_LIB cppnetlib-logging )
47-
48-
endif()
4947

50-
set(CPP-NETLIB_URI_SRCS uri/uri.cpp uri/schemes.cpp uri/normalize.cpp)
51-
add_library(cppnetlib-uri ${CPP-NETLIB_URI_SRCS})
52-
foreach (src_file ${CPP-NETLIB_URI_SRCS})
53-
if (${CMAKE_CXX_COMPILER_ID}MATCHES GNU)
54-
set_source_files_properties(${src_file}
55-
PROPERTIESCOMPILE_FLAGS ${CPP-NETLIB_CXXFLAGS})
56-
elseif (${CMAKE_CXX_COMPILER_ID}MATCHES Clang)
57-
set_source_files_properties(${src_file}
58-
PROPERTIESCOMPILE_FLAGS ${CPP-NETLIB_CXXFLAGS})
5948
endif()
60-
endforeach(src_file)
49+
50+
#set(CPP-NETLIB_URI_SRCS uri/uri.cpp uri/schemes.cpp uri/normalize.cpp)
51+
#add_library(cppnetlib-uri ${CPP-NETLIB_URI_SRCS})
52+
#foreach (src_file ${CPP-NETLIB_URI_SRCS})
53+
#if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
54+
# set_source_files_properties(${src_file}
55+
# PROPERTIES COMPILE_FLAGS ${CPP-NETLIB_CXXFLAGS})
56+
#elseif (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
57+
# set_source_files_properties(${src_file}
58+
# PROPERTIES COMPILE_FLAGS ${CPP-NETLIB_CXXFLAGS})
59+
#endif()
60+
#endforeach(src_file)
6161

6262
set(CPP-NETLIB_MESSAGE_SRCS message/message.cpp)
6363
add_library(cppnetlib-message ${CPP-NETLIB_MESSAGE_SRCS})

‎message/CMakeLists.txt‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
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+
add_subdirectory(src)
7+
add_subdirectory(test)

‎message/src/directives.cpp‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2011 Dean Michael Berris (dberris@google.com).
2+
// Copyright 2011 Google, Inc.
3+
// Distributed under the Boost Software License, Version 1.0.
4+
// (See accompanying file LICENSE_1_0.txt or copy at
5+
// http://www.boost.org/LICENSE_1_0.txt)
6+
7+
// This is the directives file where all standard directives on messages are
8+
// pulled in and compiled into a library.
9+
10+
#ifdef NETWORK_NO_LIB
11+
#undef NETWORK_NO_LIB
12+
#endif
13+
14+
#include<network/message/directives/header.ipp>
15+
#include<network/message/directives/remove_header.ipp>

‎message/src/message.cpp‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2011 Dean Michael Berris (dberris@google.com).
2+
// Copyright 2011 Google, Inc.
3+
// Distributed under the Boost Software License, Version 1.0.
4+
// (See accompanying file LICENSE_1_0.txt or copy at
5+
// http://www.boost.org/LICENSE_1_0.txt)
6+
7+
// This is the conglomeration of all message-related implementation files. All
8+
// we're doing is including all the .ipp files that are relevant.
9+
10+
#ifdef NETWORK_NO_LIB
11+
#undef NETWORK_NO_LIB
12+
#endif
13+
14+
#include<network/message/message.ipp>
15+
#include<network/message/message_base.ipp>

‎message/src/message.hpp‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright Dean Michael Berris 2007.
2+
// Copyright 2011 Dean Michael Berris (dberris@google.com).
3+
// Copyright 2011 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_MESSAGE_HPP_20111021
9+
#defineNETWORK_MESSAGE_HPP_20111021
10+
11+
#include<network/message_fwd.hpp>
12+
#include<network/detail/directive_base.hpp>
13+
#include<network/detail/wrapper_base.hpp>
14+
#include<network/message/directives.hpp>
15+
#include<network/message/wrappers.hpp>
16+
#include<network/message/transformers.hpp>
17+
18+
#include<network/message/modifiers/add_header.hpp>
19+
#include<network/message/modifiers/remove_header.hpp>
20+
#include<network/message/modifiers/clear_headers.hpp>
21+
#include<network/message/modifiers/source.hpp>
22+
#include<network/message/modifiers/destination.hpp>
23+
#include<network/message/modifiers/body.hpp>
24+
25+
#include<network/message/message.hpp>
26+
27+
#ifdef NETWORK_DEBUG
28+
#include<network/message/message_concept.hpp>
29+
#endif
30+
31+
#endif// NETWORK_MESSAGE_HPP_20111021
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// Copyright 2011 Dean Michael Berris <dberris@google.com>.
2+
// Copyright 2011 Google, Inc.
3+
// Distributed under the Boost Software License, Version 1.0.
4+
// (See accompanying file LICENSE_1_0.txt or copy at
5+
// http://www.boost.org/LICENSE_1_0.txt)
6+
7+
#ifndef NETWORK_MESSAGE_BASIC_MESSAGE_HPP_20110911
8+
#defineNETWORK_MESSAGE_BASIC_MESSAGE_HPP_20110911
9+
10+
#include<network/message_base.hpp>
11+
#include<boost/scoped_ptr.hpp>
12+
13+
namespacenetwork {
14+
15+
structbasic_storage_pimpl;
16+
17+
structbasic_storage_base : message_base {
18+
basic_storage_base();
19+
basic_storage_base(basic_storage_baseconst &);
20+
basic_storage_base(basic_storage_base &&);
21+
virtualvoidset_destination(std::stringconst & destination);
22+
virtualvoidset_source(std::stringconst & source);
23+
virtualvoidappend_header(std::stringconst & name,
24+
std::stringconst & value);
25+
virtualvoidremove_headers(std::stringconst & name);
26+
virtualvoidremove_headers();
27+
virtualvoidset_body(std::stringconst & body);
28+
virtualvoidappend_body(std::stringconst & data);
29+
30+
virtualvoidget_destination(std::string & destination);
31+
virtualvoidget_source(std::string & source);
32+
virtualvoidget_headers(function<void(std::stringconst &, std::stringconst &)> inserter);
33+
virtualvoidget_headers(std::stringconst & name, function<void(std::stringconst &, std::stringconst &)> inserter);
34+
virtualvoidget_body(std::string & body);
35+
virtualvoidget_body(function<void(iterator_range<charconst *>)> chunk_reader, size_t size);
36+
37+
virtualvoidswap(basic_storage_base & other);
38+
39+
virtual~basic_storage_base();
40+
protected:
41+
scoped_ptr<basic_storage_pimpl> pimpl;
42+
};
43+
44+
voidswap(basic_storage_base & l, basic_storage_base & r);
45+
46+
}// namespace network
47+
48+
#endif/* NETWORK_MESSAGE_BASIC_MESSAGE_HPP_20110911*/
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
// Copyright 2011 Dean Michael Berris <dberris@google.com>.
2+
// Copyright 2011 Google, Inc.
3+
// Distributed under the Boost Software License, Version 1.0.
4+
// (See accompanying file LICENSE_1_0.txt or copy at
5+
// http://www.boost.org/LICENSE_1_0.txt)
6+
7+
#ifndef NETWORK_MESSAGE_BASIC_MESSAGE_IPP_20110911
8+
#defineNETWORK_MESSAGE_BASIC_MESSAGE_IPP_20110911
9+
10+
namespacenetwork {
11+
12+
structbasic_storage_pimpl {
13+
basic_storage_pimpl();
14+
basic_storage_pimpl(basic_storage_pimplconst &);
15+
16+
virtual basic_storage_pimpl*clone();
17+
protected:
18+
friendstructbasic_storage_base;
19+
std::string source_, destination_;
20+
typedef std::multimap<std::string, std::string> headers_container_type;
21+
headers_container_type headers_;
22+
std::string body_;
23+
};
24+
25+
basic_storage_base::basic_storage_base()
26+
: pimpl(new (std::nothrow) basic_storage_pimpl())
27+
{}
28+
29+
basic_storage_base::basic_storage_base(basic_storage_baseconst & other)
30+
: pimpl(other.clone())
31+
{}
32+
33+
voidbasic_storage_base::set_destination(std::stringconst & destination) {
34+
pimpl->destination_ = destination;
35+
}
36+
37+
voidbasic_storage_base::set_source(std::stringconst & source) {
38+
pimpl->source_ = source;
39+
}
40+
41+
voidbasic_storage_base::append_header(std::stringconst & name,
42+
std::stringconst & value) {
43+
pimpl->headers_.insert(std::make_pair(name, value));
44+
}
45+
46+
voidbasic_storage_base::remove_headers(std::stringconst & name) {
47+
pimpl->headers_.erase(name);
48+
}
49+
50+
voidbasic_storage_base::remove_headers() {
51+
basic_storage_pimpl::headers_container_type().swap(pimpl->headers_);
52+
}
53+
54+
voidbasic_storage_base::set_body(std::stringconst & body) {
55+
pimpl->body = body;
56+
}
57+
58+
voidbasic_storage_base::append_body(std::stringconst & data) {
59+
pimpl->body.append(data);
60+
}
61+
62+
voidbasic_storage_base::get_destination(std::string & destination) {
63+
destination = pimpl->destination;
64+
}
65+
66+
voidbasic_storage_base::get_source(std::string & source) {
67+
source = pimpl->source;
68+
}
69+
70+
voidbasic_storage_base::get_headers(function<void(std::stringconst &, std::stringconst &)> inserter) {
71+
copy(pimpl->headers_, inserter);
72+
}
73+
74+
voidbasic_storage_base::get_headers(std::stringconst & name, function<void(std::stringconst &, std::stringconst &)> inserter) {
75+
basic_storage_pimpl::headers_container_type::const_iterator
76+
it = pimpl->headers_.find(name),
77+
pe = pimpl->headers_.end();
78+
for (; it != pe; ++it)
79+
inserter(it->first, it->second);
80+
}
81+
82+
voidbasic_storage_base::get_body(std::string & body) {
83+
// TODO use iostreams!
84+
body = pimpl_->body;
85+
}
86+
87+
voidbasic_storage_base::get_body(function<void(iterator_range<charconst *>)> chunk_reader, size_t size) {
88+
// TODO use iostreams!
89+
std::string::const_iterator it = pimpl->body.begin(),
90+
pe = pimpl->body.end();
91+
std::advance(it, size);
92+
chunk_reader(make_iterator_range(it, pe));
93+
pimpl->body.assign(it, pe);
94+
}
95+
96+
basic_storage_base::~basic_storage_base() {
97+
pimpl->reset();
98+
}
99+
100+
voidbasic_storage_base::swap(basic_storage_base & other) {
101+
std::swap(pimpl, other.pimpl);
102+
}
103+
104+
voidswap(basic_storage_base & l, basic_storage_base & r) {
105+
l.swap(r);
106+
}
107+
108+
}/* network*/
109+
110+
#endif/* NETWORK_MESSAGE_BASIC_MESSAGE_IPP_20110911*/

‎message/src/message/directives.hpp‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright Dean Michael Berris 2007.
2+
// Copyright 2012 Google, Inc.
3+
// Distributed under the Boost Software License, Version 1.0.
4+
// (See accompanying file LICENSE_1_0.txt or copy at
5+
// http://www.boost.org/LICENSE_1_0.txt)
6+
7+
#ifndef NETWORK_MESSAGE_DIRECTIVES_HPP__
8+
#defineNETWORK_MESSAGE_DIRECTIVES_HPP__
9+
10+
#include<network/message/directives/detail/string_directive.hpp>
11+
#include<network/message/directives/header.hpp>
12+
#include<network/message/directives/remove_header.hpp>
13+
14+
namespacenetwork {
15+
16+
NETWORK_STRING_DIRECTIVE(source);
17+
NETWORK_STRING_DIRECTIVE(destination);
18+
NETWORK_STRING_DIRECTIVE(body);
19+
20+
}// namespace network
21+
22+
#endif// NETWORK_MESSAGE_DIRECTIVES_HPP__
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Copyright 2010-2012 Dean Michael Berris <dberris@google.com>
2+
// Copyright 2012 Google, Inc.
3+
// Distributed under the Boost Software License, Version 1.0.
4+
// (See accompanying file LICENSE_1_0.txt or copy at
5+
// http://www.boost.org/LICENSE_1_0.txt)
6+
7+
#ifndef NETWORK_MESSAGE_DIRECTIVES_DETAIL_STRING_DIRECTIVE_HPP_20100915
8+
#defineNETWORK_MESSAGE_DIRECTIVES_DETAIL_STRING_DIRECTIVE_HPP_20100915
9+
10+
#include<boost/variant/variant.hpp>
11+
#include<boost/variant/apply_visitor.hpp>
12+
#include<boost/variant/static_visitor.hpp>
13+
#include<boost/utility/enable_if.hpp>
14+
#include<boost/mpl/if.hpp>
15+
#include<boost/mpl/or.hpp>
16+
17+
// To create your own string directive, you can use the preprocessor macro
18+
// NETWORK_STRING_DIRECTIVE which takes three parameters: the name of
19+
// the directive, a name for the variable to use in the directive visitor,
20+
// and the body to be implemented in the visitor. An example directive for
21+
// setting the source of a message would look something like this given the
22+
// NETWORK_STRING_DIRECTIVE macro:
23+
//
24+
// NETWORK_STRING_DIRECTIVE(source, source_,
25+
// message.source(source_)
26+
// , message.source=source_);
27+
//
28+
29+
#ifndef NETWORK_STRING_DIRECTIVE
30+
#defineNETWORK_STRING_DIRECTIVE(name) \
31+
structname##_directive { \
32+
std::stringconst & value; \
33+
explicit name##_directive(std::stringconst & value_) \
34+
: value(value_) {} \
35+
name##_directive(name##_directiveconst & other) \
36+
: value(other.value) {} \
37+
template<classMessage> \
38+
voidoperator()(Message & message)const { \
39+
message.set_##name(value); \
40+
} \
41+
}; \
42+
\
43+
inline name##_directiveconst \
44+
name (std::stringconst & input) { \
45+
return name##_directive(input); \
46+
}
47+
#endif/* NETWORK_STRING_DIRECTIVE*/
48+
49+
#endif/* NETWORK_MESSAGE_DIRECTIVES_DETAIL_STRING_DIRECTIVE_HPP_20100915*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp