-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* read_as changed write_from to read_as * fix eigen_test * removed extra decay_t
- Loading branch information
1 parent
9295732
commit e804eec
Showing
12 changed files
with
99 additions
and
44 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
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,22 @@ | ||
// Glaze Library | ||
// For the license information refer to glaze.hpp | ||
|
||
#pragma once | ||
|
||
#include "glaze/core/ptr.hpp" | ||
#include "glaze/binary/read.hpp" | ||
#include "glaze/binary/write.hpp" | ||
|
||
namespace glz | ||
{ | ||
template <class T, class B> | ||
bool read_as_binary(T&& root_value, const sv json_ptr, B&& buffer) { | ||
return read_as<opts{.format = binary}>(std::forward<T>(root_value), json_ptr, buffer); | ||
} | ||
|
||
template <class T, class B> | ||
bool write_as_binary(T&& root_value, const sv json_ptr, B& buffer) | ||
{ | ||
return write_as<opts{.format = binary}>(std::forward<T>(root_value), json_ptr, buffer); | ||
} | ||
} |
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,38 @@ | ||
// Glaze Library | ||
// For the license information refer to glaze.hpp | ||
|
||
#pragma once | ||
|
||
#include "glaze/core/opts.hpp" | ||
#include "glaze/core/read.hpp" | ||
#include "glaze/core/write.hpp" | ||
#include "glaze/util/for_each.hpp" | ||
#include "glaze/json/json_ptr.hpp" | ||
|
||
namespace glz | ||
{ | ||
// Given a JSON pointer path, reads from the buffer into the object | ||
template <opts Opts, class T, class B> | ||
bool read_as(T&& root_value, const sv json_ptr, B&& buffer) { | ||
return detail::seek_impl( | ||
[&](auto&& val) { | ||
read<Opts>(val, buffer); | ||
}, | ||
std::forward<T>(root_value), json_ptr | ||
); | ||
} | ||
|
||
// Given a JSON pointer path, find the value in the buffer and reads only that sub value | ||
/*template <opts Opts, class T, class B> | ||
bool read_sub(T&& root_value, const sv json_ptr, B&& buffer) { | ||
}*/ | ||
|
||
// Given a JSON pointer path, writes into a buffer the specified value | ||
template <opts Opts, class T, class B> | ||
bool write_as(T&& root_value, const sv json_ptr, B& buffer) | ||
{ | ||
return detail::seek_impl([&](auto&& val) { write<Opts>(val, buffer); }, | ||
std::forward<T>(root_value), json_ptr); | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
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,22 @@ | ||
// Glaze Library | ||
// For the license information refer to glaze.hpp | ||
|
||
#pragma once | ||
|
||
#include "glaze/core/ptr.hpp" | ||
#include "glaze/json/read.hpp" | ||
#include "glaze/json/write.hpp" | ||
|
||
namespace glz | ||
{ | ||
template <class T, class B> | ||
bool read_as_json(T&& root_value, const sv json_ptr, B&& buffer) { | ||
return read_as<opts{}>(std::forward<T>(root_value), json_ptr, buffer); | ||
} | ||
|
||
template <class T, class B> | ||
bool write_as_json(T&& root_value, const sv json_ptr, B& buffer) | ||
{ | ||
return write_as<opts{}>(std::forward<T>(root_value), json_ptr, buffer); | ||
} | ||
} |
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