-
Notifications
You must be signed in to change notification settings - Fork 192
fix #292 handle argument keys with multiple values #302
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
76261d6
fix #292 handle argument keys with multiple values
stuart-byma 77b9f04
fix #292 handle argument keys with multiple values
stuart-byma c2a0850
fix #292 handle argument keys with multiple values
stuart-byma 92bbd19
fix #292 handle argument keys with multiple values
stuart-byma 9ff21a0
fix #292 handle argument keys with multiple values
stuart-byma 1d01b2b
fix #292 handle argument keys with multiple values
stuart-byma 64a2046
fix #292 handle argument keys with multiple values
stuart-byma eb50b88
fix #292 handle argument keys with multiple values
stuart-byma c41ed6a
fix #292 handle argument keys with multiple values
stuart-byma 2b93e23
fix #292 handle argument keys with multiple values
stuart-byma 576d081
fix #292 handle argument keys with multiple values
stuart-byma 9fece76
fix #292 handle argument keys with multiple values
stuart-byma da2eb97
fix #292 handle argument keys with multiple values
stuart-byma File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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,65 @@ | ||
| /* | ||
| This file is part of libhttpserver | ||
| Copyright (C) 2011-2019 Sebastiano Merlino | ||
|
|
||
| This library is free software; you can redistribute it and/or | ||
| modify it under the terms of the GNU Lesser General Public | ||
| License as published by the Free Software Foundation; either | ||
| version 2.1 of the License, or (at your option) any later version. | ||
|
|
||
| This library is distributed in the hope that it will be useful, | ||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| Lesser General Public License for more details. | ||
|
|
||
| You should have received a copy of the GNU Lesser General Public | ||
| License along with this library; if not, write to the Free Software | ||
| Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 | ||
| USA | ||
| */ | ||
|
|
||
| #if !defined (_HTTPSERVER_HPP_INSIDE_) && !defined (HTTPSERVER_COMPILATION) | ||
| #error "Only <httpserver.hpp> or <httpserverpp> can be included directly." | ||
| #endif | ||
|
|
||
| #ifndef SRC_HTTPSERVER_HTTP_ARG_VALUE_HPP_ | ||
| #define SRC_HTTPSERVER_HTTP_ARG_VALUE_HPP_ | ||
|
|
||
| #include <string> | ||
| #include <string_view> | ||
| #include <vector> | ||
|
|
||
| namespace httpserver { | ||
|
|
||
| class http_arg_value { | ||
| public: | ||
| std::string_view get_flat_value() const { | ||
| return values.empty() ? "" : values[0]; | ||
| } | ||
|
|
||
| std::vector<std::string_view> get_all_values() const { | ||
| return values; | ||
| } | ||
|
|
||
| operator std::string() const { | ||
| return std::string(get_flat_value()); | ||
| } | ||
|
|
||
| operator std::string_view() const { | ||
| return get_flat_value(); | ||
| } | ||
|
|
||
| operator std::vector<std::string>() const { | ||
| std::vector<std::string> result; | ||
| for (auto const & value : values) { | ||
| result.push_back(std::string(value)); | ||
| } | ||
| return result; | ||
| } | ||
|
|
||
| std::vector<std::string_view> values; | ||
| }; | ||
|
|
||
| } // end namespace httpserver | ||
|
|
||
| #endif // SRC_HTTPSERVER_HTTP_ARG_VALUE_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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this doing? (I cannot find it used elsewhere)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is required to activate heterogeneous lookup using this comparator.
is_transparentjust needs to be defined, it doesn't get referenced anywhere. From cppreference:The member type is_transparent indicates to the caller that this function object is a transparent function object: it accepts arguments of arbitrary types and uses perfect forwarding, which avoids unnecessary copying and conversion when the function object is used in heterogeneous context, or with rvalue arguments. In particular, template functions such as std::set::find and std::set::lower_bound make use of this member type on their Compare types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh cool. I learned something :). Thank you!