forked fromglynos/cpp-netlib
- Notifications
You must be signed in to change notification settings - Fork425
Restructure dirs#179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Restructure dirs#179
Changes from1 commit
Commits
Show all changes
7 commits Select commitHold shift + click to select a range
e7bfb97 Moved around some directories and updated build scripts.
glynos4d424b8 Updated build scripts for the restructured uri so that it compiles on…
glynosfd5e7d5 Restructured the message framework, passing tests on Linux/GCC 4.7.
glynos9c4f0a5 Restructured logging code into a new subdirectory.
glynoseacf307 Updated build script references.
glynosdcbb386 Removed obsolete files; updated build scripts so that the include pat…
glynos33176c3 Adjustments to build scripts in order to compile on MSVC 2012.
glynosFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
NextNext commit
Moved around some directories and updated build scripts.
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
commite7bfb972a5c83d2e0e7f9717124088fcad5cd572
There are no files selected for viewing
15 changes: 11 additions & 4 deletionsCMakeLists.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
30 changes: 15 additions & 15 deletionslibs/network/src/CMakeLists.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletionsmessage/CMakeLists.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # Copyright (c) Glyn Matthews 2012. | ||
| # Distributed under the Boost Software License, Version 1.0. | ||
| # (See accompanying file LICENSE_1_0.txt or copy at | ||
| # http://www.boost.org/LICENSE_1_0.txt) | ||
| add_subdirectory(src) | ||
| add_subdirectory(test) |
15 changes: 15 additions & 0 deletionsmessage/src/directives.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| // Copyright 2011 Dean Michael Berris (dberris@google.com). | ||
| // Copyright 2011 Google, Inc. | ||
| // Distributed under the Boost Software License, Version 1.0. | ||
| // (See accompanying file LICENSE_1_0.txt or copy at | ||
| // http://www.boost.org/LICENSE_1_0.txt) | ||
| // This is the directives file where all standard directives on messages are | ||
| // pulled in and compiled into a library. | ||
| #ifdef NETWORK_NO_LIB | ||
| #undef NETWORK_NO_LIB | ||
| #endif | ||
| #include <network/message/directives/header.ipp> | ||
| #include <network/message/directives/remove_header.ipp> |
15 changes: 15 additions & 0 deletionsmessage/src/message.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| // Copyright 2011 Dean Michael Berris (dberris@google.com). | ||
| // Copyright 2011 Google, Inc. | ||
| // Distributed under the Boost Software License, Version 1.0. | ||
| // (See accompanying file LICENSE_1_0.txt or copy at | ||
| // http://www.boost.org/LICENSE_1_0.txt) | ||
| // This is the conglomeration of all message-related implementation files. All | ||
| // we're doing is including all the .ipp files that are relevant. | ||
| #ifdef NETWORK_NO_LIB | ||
| #undef NETWORK_NO_LIB | ||
| #endif | ||
| #include <network/message/message.ipp> | ||
| #include <network/message/message_base.ipp> |
31 changes: 31 additions & 0 deletionsmessage/src/message.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| // Copyright Dean Michael Berris 2007. | ||
| // Copyright 2011 Dean Michael Berris (dberris@google.com). | ||
| // Copyright 2011 Google, Inc. | ||
| // Distributed under the Boost Software License, Version 1.0. | ||
| // (See accompanying file LICENSE_1_0.txt or copy at | ||
| // http://www.boost.org/LICENSE_1_0.txt) | ||
| #ifndef NETWORK_MESSAGE_HPP_20111021 | ||
| #define NETWORK_MESSAGE_HPP_20111021 | ||
| #include <network/message_fwd.hpp> | ||
| #include <network/detail/directive_base.hpp> | ||
| #include <network/detail/wrapper_base.hpp> | ||
| #include <network/message/directives.hpp> | ||
| #include <network/message/wrappers.hpp> | ||
| #include <network/message/transformers.hpp> | ||
| #include <network/message/modifiers/add_header.hpp> | ||
| #include <network/message/modifiers/remove_header.hpp> | ||
| #include <network/message/modifiers/clear_headers.hpp> | ||
| #include <network/message/modifiers/source.hpp> | ||
| #include <network/message/modifiers/destination.hpp> | ||
| #include <network/message/modifiers/body.hpp> | ||
| #include <network/message/message.hpp> | ||
| #ifdef NETWORK_DEBUG | ||
| #include <network/message/message_concept.hpp> | ||
| #endif | ||
| #endif // NETWORK_MESSAGE_HPP_20111021 |
48 changes: 48 additions & 0 deletionsmessage/src/message/basic_message.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| // Copyright 2011 Dean Michael Berris <dberris@google.com>. | ||
| // Copyright 2011 Google, Inc. | ||
| // Distributed under the Boost Software License, Version 1.0. | ||
| // (See accompanying file LICENSE_1_0.txt or copy at | ||
| // http://www.boost.org/LICENSE_1_0.txt) | ||
| #ifndef NETWORK_MESSAGE_BASIC_MESSAGE_HPP_20110911 | ||
| #define NETWORK_MESSAGE_BASIC_MESSAGE_HPP_20110911 | ||
| #include <network/message_base.hpp> | ||
| #include <boost/scoped_ptr.hpp> | ||
| namespace network { | ||
| struct basic_storage_pimpl; | ||
| struct basic_storage_base : message_base { | ||
| basic_storage_base(); | ||
| basic_storage_base(basic_storage_base const &); | ||
| basic_storage_base(basic_storage_base &&); | ||
| virtual void set_destination(std::string const & destination); | ||
| virtual void set_source(std::string const & source); | ||
| virtual void append_header(std::string const & name, | ||
| std::string const & value); | ||
| virtual void remove_headers(std::string const & name); | ||
| virtual void remove_headers(); | ||
| virtual void set_body(std::string const & body); | ||
| virtual void append_body(std::string const & data); | ||
| virtual void get_destination(std::string & destination); | ||
| virtual void get_source(std::string & source); | ||
| virtual void get_headers(function<void(std::string const &, std::string const &)> inserter); | ||
| virtual void get_headers(std::string const & name, function<void(std::string const &, std::string const &)> inserter); | ||
| virtual void get_body(std::string & body); | ||
| virtual void get_body(function<void(iterator_range<char const *>)> chunk_reader, size_t size); | ||
| virtual void swap(basic_storage_base & other); | ||
| virtual ~basic_storage_base(); | ||
| protected: | ||
| scoped_ptr<basic_storage_pimpl> pimpl; | ||
| }; | ||
| void swap(basic_storage_base & l, basic_storage_base & r); | ||
| } // namespace network | ||
| #endif /* NETWORK_MESSAGE_BASIC_MESSAGE_HPP_20110911 */ |
110 changes: 110 additions & 0 deletionsmessage/src/message/basic_message.ipp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| // Copyright 2011 Dean Michael Berris <dberris@google.com>. | ||
| // Copyright 2011 Google, Inc. | ||
| // Distributed under the Boost Software License, Version 1.0. | ||
| // (See accompanying file LICENSE_1_0.txt or copy at | ||
| // http://www.boost.org/LICENSE_1_0.txt) | ||
| #ifndef NETWORK_MESSAGE_BASIC_MESSAGE_IPP_20110911 | ||
| #define NETWORK_MESSAGE_BASIC_MESSAGE_IPP_20110911 | ||
| namespace network { | ||
| struct basic_storage_pimpl { | ||
| basic_storage_pimpl(); | ||
| basic_storage_pimpl(basic_storage_pimpl const &); | ||
| virtual basic_storage_pimpl* clone(); | ||
| protected: | ||
| friend struct basic_storage_base; | ||
| std::string source_, destination_; | ||
| typedef std::multimap<std::string, std::string> headers_container_type; | ||
| headers_container_type headers_; | ||
| std::string body_; | ||
| }; | ||
| basic_storage_base::basic_storage_base() | ||
| : pimpl(new (std::nothrow) basic_storage_pimpl()) | ||
| {} | ||
| basic_storage_base::basic_storage_base(basic_storage_base const & other) | ||
| : pimpl(other.clone()) | ||
| {} | ||
| void basic_storage_base::set_destination(std::string const & destination) { | ||
| pimpl->destination_ = destination; | ||
| } | ||
| void basic_storage_base::set_source(std::string const & source) { | ||
| pimpl->source_ = source; | ||
| } | ||
| void basic_storage_base::append_header(std::string const & name, | ||
| std::string const & value) { | ||
| pimpl->headers_.insert(std::make_pair(name, value)); | ||
| } | ||
| void basic_storage_base::remove_headers(std::string const & name) { | ||
| pimpl->headers_.erase(name); | ||
| } | ||
| void basic_storage_base::remove_headers() { | ||
| basic_storage_pimpl::headers_container_type().swap(pimpl->headers_); | ||
| } | ||
| void basic_storage_base::set_body(std::string const & body) { | ||
| pimpl->body = body; | ||
| } | ||
| void basic_storage_base::append_body(std::string const & data) { | ||
| pimpl->body.append(data); | ||
| } | ||
| void basic_storage_base::get_destination(std::string & destination) { | ||
| destination = pimpl->destination; | ||
| } | ||
| void basic_storage_base::get_source(std::string & source) { | ||
| source = pimpl->source; | ||
| } | ||
| void basic_storage_base::get_headers(function<void(std::string const &, std::string const &)> inserter) { | ||
| copy(pimpl->headers_, inserter); | ||
| } | ||
| void basic_storage_base::get_headers(std::string const & name, function<void(std::string const &, std::string const &)> inserter) { | ||
| basic_storage_pimpl::headers_container_type::const_iterator | ||
| it = pimpl->headers_.find(name), | ||
| pe = pimpl->headers_.end(); | ||
| for (; it != pe; ++it) | ||
| inserter(it->first, it->second); | ||
| } | ||
| void basic_storage_base::get_body(std::string & body) { | ||
| // TODO use iostreams! | ||
| body = pimpl_->body; | ||
| } | ||
| void basic_storage_base::get_body(function<void(iterator_range<char const *>)> chunk_reader, size_t size) { | ||
| // TODO use iostreams! | ||
| std::string::const_iterator it = pimpl->body.begin(), | ||
| pe = pimpl->body.end(); | ||
| std::advance(it, size); | ||
| chunk_reader(make_iterator_range(it, pe)); | ||
| pimpl->body.assign(it, pe); | ||
| } | ||
| basic_storage_base::~basic_storage_base() { | ||
| pimpl->reset(); | ||
| } | ||
| void basic_storage_base::swap(basic_storage_base & other) { | ||
| std::swap(pimpl, other.pimpl); | ||
| } | ||
| void swap(basic_storage_base & l, basic_storage_base & r) { | ||
| l.swap(r); | ||
| } | ||
| } /* network */ | ||
| #endif /* NETWORK_MESSAGE_BASIC_MESSAGE_IPP_20110911 */ |
22 changes: 22 additions & 0 deletionsmessage/src/message/directives.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| // Copyright Dean Michael Berris 2007. | ||
| // Copyright 2012 Google, Inc. | ||
| // Distributed under the Boost Software License, Version 1.0. | ||
| // (See accompanying file LICENSE_1_0.txt or copy at | ||
| // http://www.boost.org/LICENSE_1_0.txt) | ||
| #ifndef NETWORK_MESSAGE_DIRECTIVES_HPP__ | ||
| #define NETWORK_MESSAGE_DIRECTIVES_HPP__ | ||
| #include <network/message/directives/detail/string_directive.hpp> | ||
| #include <network/message/directives/header.hpp> | ||
| #include <network/message/directives/remove_header.hpp> | ||
| namespace network { | ||
| NETWORK_STRING_DIRECTIVE(source); | ||
| NETWORK_STRING_DIRECTIVE(destination); | ||
| NETWORK_STRING_DIRECTIVE(body); | ||
| } // namespace network | ||
| #endif // NETWORK_MESSAGE_DIRECTIVES_HPP__ |
49 changes: 49 additions & 0 deletionsmessage/src/message/directives/detail/string_directive.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| // Copyright 2010-2012 Dean Michael Berris <dberris@google.com> | ||
| // Copyright 2012 Google, Inc. | ||
| // Distributed under the Boost Software License, Version 1.0. | ||
| // (See accompanying file LICENSE_1_0.txt or copy at | ||
| // http://www.boost.org/LICENSE_1_0.txt) | ||
| #ifndef NETWORK_MESSAGE_DIRECTIVES_DETAIL_STRING_DIRECTIVE_HPP_20100915 | ||
| #define NETWORK_MESSAGE_DIRECTIVES_DETAIL_STRING_DIRECTIVE_HPP_20100915 | ||
| #include <boost/variant/variant.hpp> | ||
| #include <boost/variant/apply_visitor.hpp> | ||
| #include <boost/variant/static_visitor.hpp> | ||
| #include <boost/utility/enable_if.hpp> | ||
| #include <boost/mpl/if.hpp> | ||
| #include <boost/mpl/or.hpp> | ||
| // To create your own string directive, you can use the preprocessor macro | ||
| // NETWORK_STRING_DIRECTIVE which takes three parameters: the name of | ||
| // the directive, a name for the variable to use in the directive visitor, | ||
| // and the body to be implemented in the visitor. An example directive for | ||
| // setting the source of a message would look something like this given the | ||
| // NETWORK_STRING_DIRECTIVE macro: | ||
| // | ||
| // NETWORK_STRING_DIRECTIVE(source, source_, | ||
| // message.source(source_) | ||
| // , message.source=source_); | ||
| // | ||
| #ifndef NETWORK_STRING_DIRECTIVE | ||
| #define NETWORK_STRING_DIRECTIVE(name) \ | ||
| struct name##_directive { \ | ||
| std::string const & value; \ | ||
| explicit name##_directive(std::string const & value_) \ | ||
| : value(value_) {} \ | ||
| name##_directive(name##_directive const & other) \ | ||
| : value(other.value) {} \ | ||
| template <class Message> \ | ||
| void operator()(Message & message) const { \ | ||
| message.set_##name(value); \ | ||
| } \ | ||
| }; \ | ||
| \ | ||
| inline name##_directive const \ | ||
| name (std::string const & input) { \ | ||
| return name##_directive(input); \ | ||
| } | ||
| #endif /* NETWORK_STRING_DIRECTIVE */ | ||
| #endif /* NETWORK_MESSAGE_DIRECTIVES_DETAIL_STRING_DIRECTIVE_HPP_20100915 */ |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.