X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=resource%2Finclude%2FOCUtilities.h;h=65ea6afc2b5db8e9e9a0b5ddf4435ea52ee84b5d;hb=935fdb9b67b6c10d007e652e9e2e028fd6ccfe09;hp=a7368207deefae5975611dee09bd4d2f416ad596;hpb=00b3660e45c56cb3db35dc2596a054f801b5591a;p=platform%2Fupstream%2Fiotivity.git diff --git a/resource/include/OCUtilities.h b/resource/include/OCUtilities.h index a736820..65ea6af 100644 --- a/resource/include/OCUtilities.h +++ b/resource/include/OCUtilities.h @@ -27,34 +27,30 @@ #include #include -#include "OCException.h" +#include +#include namespace OC { namespace Utilities { typedef std::map QueryParamsKeyVal; + /* - * @brief Helper function to get query parameter from a URI - * @remarks Its okay to return a copy of the container.\ - * The size is not expected to be huge. - * @remarks Temporary: The URI must strictly have\ - * coap as the protocol in the fully qualified URI\ - * e.g., coap://1.2.3.4:5657/foo?bar=0) - * @remarks If a separate class for URI parser is needed,\ - * please talk to Erich Keane. - * @todo If more URI elements need to be parsed,\ - * please move the common parsing logic to a - * different function + * @brief helper function that parses the query parameters component + * of a URI into a key-value map. This function expects the uri + * parameter to contain the query parameters component of a URI + * (everything after the '?', excluding anything anchors). + * + * Note that output will not perform URL decoding */ QueryParamsKeyVal getQueryParams(const std::string& uri); - } } /* The C++11 standard unfortunately forgot to provide make_unique<>! However, if we're using C++14 or later, we want to take the standard library's implementation: */ -#if defined(__cplusplus) && __cplusplus < 201300 namespace OC { +#if defined(__cplusplus) && __cplusplus < 201300 template std::unique_ptr make_unique(XS&& ...xs) @@ -62,15 +58,13 @@ namespace OC { return std::unique_ptr(new T(std::forward(xs)...)); } -} // namespace OC #else using std::make_unique; #endif +} // namespace OC namespace OC { - using OC::make_unique; - /* Examine an OCStackResult, and either forward its value or raise an exception: */ OCStackResult result_guard(const OCStackResult r); @@ -98,4 +92,24 @@ namespace OC { } // namespace OC +namespace OC +{ + template + struct is_vector + { + constexpr static bool value = false; + }; + + template + struct is_vector>::value + >::type + > + { + constexpr static bool value = true; + }; +} // namespace OC + #endif +