File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- #include < iostream>
2-
3- #include < qtils/tagged.hpp>
4- #include < scale/jam_scale.hpp>
5-
6- struct S {
7- explicit operator int () const {
8- return 1 ;
9- }
10- S (int ) {}
11- S &operator +=(auto i) {
12- return *this ;
13- }
14- bool operator ~() {
15- return true ;
16- }
17- };
18-
19- S &operator +=(S &s, auto i) {
20- return s;
21- }
22-
23- struct Tag {};
24-
25- // void encode(qtils::is_tagged_v auto &&tagged, scale::ScaleEncoder auto &encoder) {
26- // encode(untagged(tagged), encoder);
27- // }
28- // void decode(qtils::is_tagged_v auto &tagged, scale::ScaleDecoder auto &decoder) {
29- // decode(untagged(tagged), decoder);
30- // }
311
322int main () {
33- qtils::Tagged<uint, Tag> x;
34- qtils::Tagged<S, Tag> s (1 );
35- qtils::Tagged<std::vector<int >, Tag> v (1 );
36- qtils::Tagged<std::string, Tag> ts;
37- int i;
38-
39- auto us = untagged (s);
40-
41- auto eq1x = 1 == x;
42- auto eqx1 = x == 1 ;
43- auto eqxx = x == x;
44- x = 1 ;
45- s = 1 ;
46- x += 1 ;
47- x += x;
48- s += 1 ;
49- s += x;
50- auto &cx = x;
51- s += cx;
52- s += std::move (x);
53- s += std::move (cx);
54- s += s;
55- // auto ss = x << 1;
56-
57- ++x;
58- --x;
59- auto ix = x++;
60- auto dx = x--;
61-
62- scale::Encoder<scale::backend::ToBytes> es;
63- es << x;
64- es << v;
65-
66- scale::Decoder<scale::backend::FromBytes> ds (es.backend ().to_vector ());
67- ds >> x;
68-
69- auto lx = x << 1 ;
70- auto rx = x >> 1 ;
71-
72- auto &&w = !x;
73- auto &&ww = s.operator ~();
74- auto &&wwww = ~x;
75- auto z = ~i;
76- auto zzzz = not x;
77-
3+ // place for experiments
784 return 0 ;
795}
Original file line number Diff line number Diff line change @@ -15,21 +15,20 @@ namespace jam {
1515 template <typename T, typename ... Configs>
1616 [[nodiscard]] outcome::result<std::vector<uint8_t >> encode_with_config (
1717 T &&value, Configs &&...configs) {
18- scale::Encoder<scale::backend::ToBytes> encoder{
19- std::forward<Configs>(configs)...} ;
18+ std::vector< uint8_t > out;
19+ scale::backend::ToBytes encoder (out, std::forward<Configs>(configs)...) ;
2020 try {
2121 encode (std::forward<T>(value), encoder);
2222 } catch (std::system_error &e) {
2323 return outcome::failure (e.code ());
2424 }
25- return std::move (encoder). backend (). to_vector ( );
25+ return std::move (out );
2626 }
2727
2828 template <typename T, typename ... Configs>
2929 [[nodiscard]] outcome::result<T> decode_with_config (
30- scale::ConstSpanOfBytes bytes, Configs &&...configs) {
31- scale::Decoder<scale::backend::FromBytes> decoder{
32- bytes, std::forward<Configs>(configs)...};
30+ const auto &bytes, Configs &&...configs) {
31+ scale::backend::FromBytes decoder (bytes, std::forward<Configs>(configs)...);
3332 T value;
3433 try {
3534 decode (value, decoder);
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ namespace jam {
2929 using std::vector<T>::emplace;
3030
3131 public:
32- friend void encode (const ConfigVec &v, scale::ScaleEncoder auto &encoder) {
32+ friend void encode (const ConfigVec &v, scale::Encoder &encoder) {
3333 const auto &config = encoder.template getConfig <test_vectors::Config>();
3434 auto n = v.configSize (config);
3535 if (n == std::numeric_limits<decltype (n)>::max ()) {
@@ -41,7 +41,7 @@ namespace jam {
4141 }
4242 }
4343
44- friend void decode (ConfigVec &v, scale::ScaleDecoder auto &decoder) {
44+ friend void decode (ConfigVec &v, scale::Decoder &decoder) {
4545 const auto &config = decoder.template getConfig <test_vectors::Config>();
4646 auto n = v.configSize (config);
4747 if (n == std::numeric_limits<decltype (n)>::max ()) {
Original file line number Diff line number Diff line change @@ -2,8 +2,8 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
22vcpkg_from_github (
33 OUT_SOURCE_PATH SOURCE_PATH
44 REPO qdrvm/qtils
5- REF f5013e52027f6b3014c2ae902a94903583898639
6- SHA512 6492edc93437b8edc254014b5face0521f0fd46fce6e6cab4e577fc00b6964b5930c75fd228fd8f3bb10bf57a6dd8722dcf2912a488b3f1174a99ed991ae4c54
5+ REF refs/tags/v0.1.0
6+ SHA512 301987eefc98b66c42dcf731d73c11c3e9835098fc3d9a1b8e3adef9b73dad6b0198019d416e1809956620377b48e575157d56b278dcdcf65a24ecdfc134605e
77)
88vcpkg_cmake_configure (SOURCE_PATH "${SOURCE_PATH} " )
99vcpkg_cmake_install ()
Original file line number Diff line number Diff line change 11{
22 "name" : " qtils" ,
3- "version" : " 0.0.3 " ,
3+ "version" : " 0.1.0 " ,
44 "dependencies" : [
55 { "name" : " vcpkg-cmake" , "host" : true },
66 { "name" : " vcpkg-cmake-config" , "host" : true },
Original file line number Diff line number Diff line change @@ -2,8 +2,8 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
22vcpkg_from_github (
33 OUT_SOURCE_PATH SOURCE_PATH
44 REPO qdrvm/scale-codec-cpp
5- REF 6ecc0c67eadacc9ab8acdeb73488bdc4c6e30d1c
6- SHA512 22267674113f04fb9c4624bd2cb69e6f4053edd129bfa5ffb83136e4ce2c04f6fe3dce9c729d5df08c84fd92a8a69938c249fa5068132ebc4a42d205142fb921
5+ REF refs/tags/v2.0.1
6+ SHA512 cc5158cdfecea7f516e2f110adcc00f3024649507908b366ef34a76398efcb735011d8fcacd2f41016eb769dfa74e93ee3af20049560fafd1576b280fb92acc7
77)
88vcpkg_cmake_configure (
99 SOURCE_PATH "${SOURCE_PATH} "
Original file line number Diff line number Diff line change 11{
22 "name" : " scale" ,
3- "version" : " 1.1.3 " ,
3+ "version" : " 2.0.1 " ,
44 "dependencies" : [
55 { "name" : " vcpkg-cmake" , "host" : true },
66 { "name" : " vcpkg-cmake-config" , "host" : true },
Original file line number Diff line number Diff line change 11vcpkg_check_linkage (ONLY_STATIC_LIBRARY )
22vcpkg_from_github (
33 OUT_SOURCE_PATH SOURCE_PATH
4- REPO xDimon /soralog
5- REF 4dfffd3d949b1c16a04db2e5756555a4031732f7
6- SHA512 4a8f6066433e6bde504454ea256915e8e6975c060eabdaebd031df409d348b8c22ccd716ec11c4466b0f4322b1f2524350dcc77c3615a8511cba9886f88e7260
4+ REPO qdrvm /soralog
5+ REF refs/tags/v0.2.5
6+ SHA512 47375cc61c78ebc4119781bf19ce3b92c4a5a40ed4dc77c0156ac0750df1e4d13455bf6f60d9ea2f0b7bf7dda75423eed320edce453617ab06d6c1c9a8a8843c
77)
88vcpkg_cmake_configure (SOURCE_PATH "${SOURCE_PATH} " )
99vcpkg_cmake_install ()
10- #vcpkg_cmake_config_fixup(PACKAGE_NAME "soralog")
11- file (REMOVE_RECURSE "${CURRENT_PACKAGES_DIR} /debug/include" )
10+ file (REMOVE_RECURSE "${CURRENT_PACKAGES_DIR} /debug/include" )
You can’t perform that action at this time.
0 commit comments