Add header file with placeholder functions for working with absolute and relative URIs

This commit is contained in:
Tristan Penman 2015-12-13 12:56:12 +11:00
parent 3365287ef0
commit 00686e26f0
2 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,36 @@
#ifndef __VALIJSON_INTERNAL_URI_HPP
#define __VALIJSON_INTERNAL_URI_HPP
#include <string>
namespace valijson {
namespace internal {
namespace uri {
/**
* @brief Placeholder function to check whether a URI is absolute
*
* This function just checks for '://'
*/
inline bool isUriAbsolute(const std::string &documentUri)
{
static const char * placeholderMarker = "://";
return documentUri.find(placeholderMarker) != std::string::npos;
}
/**
* Placeholder function to resolve a relative URI within a given scope
*/
inline std::string resolveRelativeUri(
const std::string &resolutionScope,
const std::string &relativeUri)
{
return resolutionScope + relativeUri;
}
} // namespace uri
} // namespace internal
} // namespace valijson
#endif // __VALIJSON_INTERNAL_URI_HPP

View File

@ -41,6 +41,7 @@
/* Begin PBXFileReference section */
6A309D2D1C28C1FD00EF761C /* subschema.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = subschema.hpp; sourceTree = "<group>"; };
6A34698C1BD109A900C97DA2 /* json_reference.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = json_reference.hpp; path = internal/json_reference.hpp; sourceTree = "<group>"; };
6A356B0D1C1CFD020007EB8B /* uri.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = uri.hpp; path = internal/uri.hpp; sourceTree = "<group>"; };
6A477F8417D6BCBB0013571C /* libboost_regex-mt.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libboost_regex-mt.dylib"; path = "/usr/local/lib/libboost_regex-mt.dylib"; sourceTree = "<absolute>"; };
6A506D121AF884E100C2C818 /* draft-03.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = "draft-03.json"; sourceTree = "<group>"; };
6A506D131AF884E100C2C818 /* draft-04.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = "draft-04.json"; sourceTree = "<group>"; };
@ -332,6 +333,7 @@
children = (
6A506D1E1AF88D8700C2C818 /* json_pointer.hpp */,
6A34698C1BD109A900C97DA2 /* json_reference.hpp */,
6A356B0D1C1CFD020007EB8B /* uri.hpp */,
);
name = internal;
sourceTree = "<group>";