-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce 'x-script' asset caching protocol (#237)
* Introduce 'x-script' asset caching protocol * Remove use of std::function * Extract abi_stable_format.h
- Loading branch information
1 parent
cc40bc7
commit bc042dd
Showing
16 changed files
with
282 additions
and
54 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#pragma once | ||
|
||
#include <vcpkg/base/expected.h> | ||
#include <vcpkg/base/stringview.h> | ||
|
||
#include <string> | ||
|
||
namespace vcpkg | ||
{ | ||
namespace details | ||
{ | ||
template<class F> | ||
void api_stable_format_cb(void* f, std::string& s, StringView sv) | ||
{ | ||
(*(F*)(f))(s, sv); | ||
} | ||
|
||
ExpectedS<std::string> api_stable_format_impl(StringView fmtstr, | ||
void (*cb)(void*, std::string&, StringView), | ||
void* data); | ||
|
||
} | ||
|
||
// This function exists in order to provide an API-stable formatting function similar to `std::format()` that does | ||
// not depend on the feature set of fmt or the C++ standard library and thus can be contractual for user interfaces. | ||
template<class F> | ||
ExpectedS<std::string> api_stable_format(StringView fmtstr, F&& handler) | ||
{ | ||
return details::api_stable_format_impl(fmtstr, &details::api_stable_format_cb<F>, &handler); | ||
} | ||
} |
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
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,16 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
#include <system_error> | ||
|
||
namespace vcpkg | ||
{ | ||
template<class T, class S> | ||
struct ExpectedT; | ||
|
||
template<class T> | ||
using Expected = ExpectedT<T, std::error_code>; | ||
|
||
template<class T> | ||
using ExpectedS = ExpectedT<T, std::string>; | ||
} |
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
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
Oops, something went wrong.