forked from glynos/cpp-netlib
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[URI] Non-hierarchical URIs can now be built using the builder.
- Loading branch information
Showing
6 changed files
with
129 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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 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,40 @@ | ||
// Copyright 2012 Glyn Matthews. | ||
// 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 __BOOST_NETWORK_URI_SCHEMES_INC__ | ||
# define __BOOST_NETWORK_URI_SCHEMES_INC__ | ||
|
||
|
||
#include <boost/unordered_set.hpp> | ||
#include <string> | ||
|
||
|
||
namespace boost { | ||
namespace network { | ||
namespace uri { | ||
struct hierarchical_schemes { | ||
|
||
static void register_(const std::string &scheme); | ||
static bool exists(const std::string &scheme); | ||
|
||
static boost::unordered_set<std::string> schemes_; | ||
|
||
}; | ||
|
||
struct non_hierarchical_schemes { | ||
|
||
static void register_(const std::string &scheme); | ||
static bool exists(const std::string &scheme); | ||
|
||
static boost::unordered_set<std::string> schemes_; | ||
|
||
}; | ||
} // namespace uri | ||
} // namespace network | ||
} // namespace boost | ||
|
||
|
||
#endif // __BOOST_NETWORK_URI_SCHEMES_INC__ |
This file contains 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 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 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,71 @@ | ||
// Copyright 2012 Glyn Matthews. | ||
// 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) | ||
|
||
|
||
#include <boost/network/uri/schemes.hpp> | ||
|
||
|
||
namespace boost { | ||
namespace network { | ||
namespace uri { | ||
boost::unordered_set<std::string> hierarchical_schemes::schemes_; | ||
|
||
void hierarchical_schemes::register_(const std::string &scheme) { | ||
schemes_.insert(scheme); | ||
} | ||
|
||
bool hierarchical_schemes::exists(const std::string &scheme) { | ||
schemes_.end() != schemes_.find(scheme); | ||
} | ||
|
||
boost::unordered_set<std::string> non_hierarchical_schemes::schemes_; | ||
|
||
void non_hierarchical_schemes::register_(const std::string &scheme) { | ||
schemes_.insert(scheme); | ||
} | ||
|
||
bool non_hierarchical_schemes::exists(const std::string &scheme) { | ||
schemes_.end() != schemes_.find(scheme); | ||
} | ||
|
||
namespace { | ||
bool register_hierarchical_schemes() { | ||
hierarchical_schemes::register_("http"); | ||
hierarchical_schemes::register_("https"); | ||
hierarchical_schemes::register_("shttp"); | ||
hierarchical_schemes::register_("ftp"); | ||
hierarchical_schemes::register_("file"); | ||
hierarchical_schemes::register_("dns"); | ||
hierarchical_schemes::register_("nfs"); | ||
hierarchical_schemes::register_("imap"); | ||
hierarchical_schemes::register_("nntp"); | ||
hierarchical_schemes::register_("pop"); | ||
hierarchical_schemes::register_("rsync"); | ||
hierarchical_schemes::register_("snmp"); | ||
hierarchical_schemes::register_("telnet"); | ||
hierarchical_schemes::register_("svn"); | ||
hierarchical_schemes::register_("svn+ssh"); | ||
hierarchical_schemes::register_("git"); | ||
hierarchical_schemes::register_("git+ssh"); | ||
return true; | ||
} | ||
|
||
bool register_non_hierarchical_schemes() { | ||
non_hierarchical_schemes::register_("mailto"); | ||
non_hierarchical_schemes::register_("news"); | ||
non_hierarchical_schemes::register_("im"); | ||
non_hierarchical_schemes::register_("sip"); | ||
non_hierarchical_schemes::register_("sms"); | ||
non_hierarchical_schemes::register_("xmpp"); | ||
return true; | ||
} | ||
|
||
|
||
static bool hierarchical = register_hierarchical_schemes(); | ||
static bool non_hierarchical = register_non_hierarchical_schemes(); | ||
} // namespace | ||
} // namespace uri | ||
} // namespace network | ||
} // namespace boost |
This file contains 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