From 4329f0ed631955e36303f32e5da66466543690ee Mon Sep 17 00:00:00 2001 From: Mirek Fidler Date: Sat, 22 Feb 2025 11:47:30 +0100 Subject: [PATCH] .Core: docs and cosmetics --- uppsrc/Core/Stream.h | 2 - uppsrc/Core/Util.h | 24 +- .../Core/src.tpp/SerializationUtils_en-us.tpp | 314 ++++++++---------- 3 files changed, 144 insertions(+), 196 deletions(-) diff --git a/uppsrc/Core/Stream.h b/uppsrc/Core/Stream.h index e905bde55..b9181abeb 100644 --- a/uppsrc/Core/Stream.h +++ b/uppsrc/Core/Stream.h @@ -555,7 +555,6 @@ bool SaveStream(Stream& out, const String& data); int64 CopyStream(Stream& dest, Stream& src, int64 count = INT64_MAX); -#ifndef PLATFORM_WINCE void CoutUTF8(); Stream& Cout(); Stream& Cerr(); @@ -563,7 +562,6 @@ String ReadStdIn(); String ReadSecret(); void EnableEcho(bool b = true); void DisableEcho(); -#endif Stream& NilStream(); diff --git a/uppsrc/Core/Util.h b/uppsrc/Core/Util.h index e21d07c28..5ded3b198 100644 --- a/uppsrc/Core/Util.h +++ b/uppsrc/Core/Util.h @@ -385,36 +385,24 @@ bool Store(Event serialize, Stream& stream, int version = Null); bool LoadFromFile(Event serialize, const char *file = NULL, int version = Null); bool StoreToFile(Event serialize, const char *file = NULL, int version = Null); -template -void SerializeTFn(Stream &s, T *x) -{ - s % *x; -} - -template -Event SerializeCb(T& x) -{ - return callback1(SerializeTFn, &x); -} - template bool Load(T& x, Stream& s, int version = Null) { - return Load(SerializeCb(x), s, version); + return Load([&](Stream& s) { s % x; }, s, version); } template bool Store(T& x, Stream& s, int version = Null) { - return Store(SerializeCb(x), s, version); + return Store([&](Stream& s) { s % x; }, s, version); } template bool LoadFromFile(T& x, const char *name = NULL, int version = Null) { - return LoadFromFile(SerializeCb(x), name, version); + return LoadFromFile([&](Stream& s) { s % x; }, name, version); } template bool StoreToFile(T& x, const char *name = NULL, int version = Null) { - return StoreToFile(SerializeCb(x), name, version); + return StoreToFile([&](Stream& s) { s % x; }, name, version); } template @@ -457,10 +445,6 @@ void StoreToGlobal(Event serialize, const char *name); void SerializeGlobalConfigs(Stream& s); -#ifdef PLATFORM_WINCE -inline void abort() { TerminateProcess(NULL, -1); } -#endif - template hash_t HashBySerialize(const T& cont) { diff --git a/uppsrc/Core/src.tpp/SerializationUtils_en-us.tpp b/uppsrc/Core/src.tpp/SerializationUtils_en-us.tpp index 5c4f97ddc..78c7d956d 100644 --- a/uppsrc/Core/src.tpp/SerializationUtils_en-us.tpp +++ b/uppsrc/Core/src.tpp/SerializationUtils_en-us.tpp @@ -1,5 +1,4 @@ topic "Serialization utilities"; -[2 $$0,0#00000000000000000000000000000000:Default] [i448;a25;kKO9;2 $$1,0#37138531426314131252341829483380:class] [l288;2 $$2,0#27521748481378242620020725143825:desc] [0 $$3,0#96390100711032703541132217272105:end] @@ -9,214 +8,181 @@ topic "Serialization utilities"; [l288;i1121;b17;O9;~~~.1408;2 $$7,0#10431211400427159095818037425705:param] [i448;b42;O9;2 $$8,8#61672508125594000341940100500538:tparam] [b42;2 $$9,9#13035079074754324216151401829390:normal] -[{_}%EN-US -[ {{10000@(113.42.0) [s0; [*@2;4 Serialization utilities]]}}&] -[s0;*@3;4 &] -[ {{10000t/25b/25@1 [s0;%- [* Function List]]}}&] -[s0;0%- &] -[s5;:Pack16`(Stream`&`,int`&`):%- [_^Stream^ Stream][@(0.0.255) `&]_[* Pack16]([_^Stream^ Str -eam][@(0.0.255) `&]_[*@3 s], [@(0.0.255) int`&]_[*@3 i])&] -[s2; Serializes 32`-bit data, optimizing it for 16`-bit values. If -value is in `-32767`-32767 range, it is serialized as 2 bytes, +[2 $$0,0#00000000000000000000000000000000:Default] +[{_} +[ {{10000@(113.42.0) [s0;%% [*@2;4 Serialization utilities]]}}&] +[s0;*@3;4%% &] +[ {{10000t/25b/25@1 [s0; [* Function List]]}}&] +[s0;0 &] +[s5;:Pack16`(Stream`&`,int`&`): [_^Stream^ Stream][@(0.0.255) `&]_[* Pack16]([_^Stream^ Strea +m][@(0.0.255) `&]_[*@3 s], [@(0.0.255) int`&]_[*@3 i])&] +[s2;%% Serializes 32`-bit data, optimizing it for 16`-bit values. +If value is in `-32767`-32767 range, it is serialized as 2 bytes, otherwise 6 bytes are used.&] -[s7; [%-*C@3 s]-|Stream.&] -[s7; [%-*C@3 i]-|Data to serialize.&] -[s7; [*/ Return value]-|s for chaining.&] -[s3; &] -[s4;%- &] -[s5;:Pack16`(Stream`&`,int`&`,int`&`):%- [_^Stream^ Stream][@(0.0.255) `&]_[* Pack16]([_^Stream^ S +[s7;%% [%-*C@3 s]-|Stream.&] +[s7;%% [%-*C@3 i]-|Data to serialize.&] +[s7;%% [*/ Return value]-|s for chaining.&] +[s3;%% &] +[s4; &] +[s5;:Pack16`(Stream`&`,int`&`,int`&`): [_^Stream^ Stream][@(0.0.255) `&]_[* Pack16]([_^Stream^ S tream][@(0.0.255) `&]_[*@3 s], [@(0.0.255) int`&]_[*@3 i1], [@(0.0.255) int`&]_[*@3 i2])&] -[s5;:Pack16`(Stream`&`,int`&`,int`&`,int`&`):%- [_^Stream^ Stream][@(0.0.255) `&]_[* Pack16 -]([_^Stream^ Stream][@(0.0.255) `&]_[*@3 s], [@(0.0.255) int`&]_[*@3 i1], +[s5;:Pack16`(Stream`&`,int`&`,int`&`,int`&`): [_^Stream^ Stream][@(0.0.255) `&]_[* Pack16]( +[_^Stream^ Stream][@(0.0.255) `&]_[*@3 s], [@(0.0.255) int`&]_[*@3 i1], [@(0.0.255) int`&]_[*@3 i2], [@(0.0.255) int`&]_[*@3 i3])&] -[s5;:Pack16`(Stream`&`,int`&`,int`&`,int`&`,int`&`):%- [_^Stream^ Stream][@(0.0.255) `&]_ -[* Pack16]([_^Stream^ Stream][@(0.0.255) `&]_[*@3 s], [@(0.0.255) int`&]_[*@3 i1], +[s5;:Pack16`(Stream`&`,int`&`,int`&`,int`&`,int`&`): [_^Stream^ Stream][@(0.0.255) `&]_[* P +ack16]([_^Stream^ Stream][@(0.0.255) `&]_[*@3 s], [@(0.0.255) int`&]_[*@3 i1], [@(0.0.255) int`&]_[*@3 i2], [@(0.0.255) int`&]_[*@3 i3], [@(0.0.255) int`&]_[*@3 i4])&] -[s5;:Pack16`(Stream`&`,int`&`,int`&`,int`&`,int`&`,int`&`):%- [_^Stream^ Stream][@(0.0.255) `& +[s5;:Pack16`(Stream`&`,int`&`,int`&`,int`&`,int`&`,int`&`): [_^Stream^ Stream][@(0.0.255) `& ]_[* Pack16]([_^Stream^ Stream][@(0.0.255) `&]_[*@3 s], [@(0.0.255) int`&]_[*@3 i1], [@(0.0.255) int`&]_[*@3 i2], [@(0.0.255) int`&]_[*@3 i3], [@(0.0.255) int`&]_[*@3 i4], [@(0.0.255) int`&]_[*@3 i5])&] -[s2; Calls Pack16 for each of individual 32`-bit integer parameters.&] +[s2;%% Calls Pack16 for each of individual 32`-bit integer parameters.&] [s3; &] -[s4;%- &] -[s5;:Load`(Callback1``,Stream`&`):%- [@(0.0.255) bool]_[* Load]([_^Callback1^ Ca -llback1][@(0.0.255) <][_^Stream^ Stream][@(0.0.255) `&>]_[*@3 serialize], -[_^Stream^ Stream][@(0.0.255) `&]_[*@3 stream])&] -[s2; Smart serialization restore. Data to serialize are represented -by Callback. First, backup of current state of data is performed -and stored in memory. Then data are loaded from the specified +[s4; &] +[s5;:Upp`:`:Store`(Event`,Stream`&`,int`): [@(0.0.255) bool] [* Store](Event [*@3 serialize], Stream[@(0.0.255) `&] [*@3 stream], [@(0.0.255) int] +[*@3 version ][@(0.0.255) `=] [* Null])&] +[s2;%% Serialization save with some additional data to ensure data +integrity. Data to serialize are represented by Event. If [%-*@3 version] +is not Null, it is stored with data and must be specified with +Load `- only the same version number will successfully be Loaded.&] +[s3;%% &] +[s4; &] +[s5;:Upp`:`:Load`(Event`,Stream`&`,int`): [@(0.0.255) bool] [* Load](Event [*@3 serialize], Stream[@(0.0.255) `&] [*@3 stream], [@(0.0.255) int] +[*@3 version ][@(0.0.255) `=] [* Null])&] +[s2;%% Smart serialization restore. Data to serialize is represented +by Event. First, backup of current state of data is performed +and stored in the memory. Then data is loaded from the specified stream. If restoring of data is successful (no LoadingError exception is thrown), Load returns true. If LoadingError is thrown, it is caught by Load, data are restored from backup copy and Load -returns false.&] -[s7; [%-*C@3 serialize]-|Callback to the serialization function.&] -[s7; [%-*C@3 stream]-|Stream.&] -[s7; [*/ Return value]-|true indicates success.&] +returns false. If [%-*@3 version ]is not Null, Load loads it from +the stream (at appropriate unspecified point) and checks that +the version is the same as used with Store.&] +[s3;%% &] +[s4; &] +[s5;:Upp`:`:LoadFromFile`(Event`,const char`*`,int`): [@(0.0.255) bool] +[* LoadFromFile](Event [*@3 serialize], [@(0.0.255) const] +[@(0.0.255) char] [@(0.0.255) `*][*@3 file] [@(0.0.255) `=] [@3 0], [@(0.0.255) int] +[*@3 version ][@(0.0.255) `=] [* Null])&] +[s2;%% Using [%-*^topic`:`/`/Core`/src`/SerializationUtils`_en`-us`#Upp`:`:Load`(Event`,Stream`&`,int`)^ L +oad], restores data from the [%-*@3 file].&] [s3; &] -[s4;%- &] -[s5;:Store`(Callback1``,Stream`&`):%- [@(0.0.255) bool]_[* Store]([_^Callback1^ C -allback1][@(0.0.255) <][_^Stream^ Stream][@(0.0.255) `&>]_[*@3 serialize], -[_^Stream^ Stream][@(0.0.255) `&]_[*@3 stream])&] -[s2; Serialization save. Data to serialize are represented by Callback.&] -[s7; [%-*C@3 serialize]-|Callback to the serialization function.&] -[s7; [%-*C@3 stream]-|Stream.&] -[s7; [*/ Return value]-|true if data were properly stored to the stream.&] +[s4; &] +[s5;:Upp`:`:StoreToFile`(Event`,const char`*`,int`): [@(0.0.255) bool] +[* StoreToFile](Event [*@3 serialize], [@(0.0.255) const] +[@(0.0.255) char] [@(0.0.255) `*][*@3 file] [@(0.0.255) `=] [@3 0], [@(0.0.255) int] +[*@3 version ][@(0.0.255) `=] [* Null])&] +[s2;%% Using [%-*^topic`:`/`/Core`/src`/SerializationUtils`_en`-us`#Upp`:`:Store`(Event`,Stream`&`,int`)^ S +tore], stores data to the [%-*@3 file].&] [s3; &] -[s4;%- &] -[s5;:LoadFromFile`(Callback1``,const char`*`):%- [@(0.0.255) bool]_[* LoadFrom -File]([_^Callback1^ Callback1][@(0.0.255) <]Stream[@(0.0.255) `&>]_[*@3 serialize], -[@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 file]_`=_NULL)&] -[s2; Using [^topic`:`/`/Core`/src`/SerializationUtils`$en`-us`#`:`:Load`(Callback1``,Stream`&`)^ L -oad], data are restored from the file.&] -[s7; [%-*C@3 serialize]-|Callback to the serialization function.&] -[s7; [%-*C@3 file]-|Filename.&] -[s7; [*/ Return value]-|true indicates success.&] +[s4; &] +[s5;:Upp`:`:Load`(T`&`,Stream`&`,int`): [@(0.0.255) template] <[@(0.0.255) class] +T> [@(0.0.255) bool] [* Load](T[@(0.0.255) `&] [*@3 x], Stream[@(0.0.255) `&] +[*@3 s], [@(0.0.255) int] [*@3 version ][@(0.0.255) `=] [* Null])&] +[s2;%% Using [*^topic`:`/`/Core`/src`/SerializationUtils`_en`-us`#Upp`:`:Load`(Event`,Stream`&`,int`)^ L +oad ]and T`::Serialize, loads [%-*@3 x] from the stream[%- ][%-*@3 s].&] [s3; &] -[s4;%- &] -[s5;:StoreToFile`(Callback1``,const char`*`):%- [@(0.0.255) bool]_[* StoreToFi -le]([_^Callback1^ Callback1][@(0.0.255) <]Stream[@(0.0.255) `&>]_[*@3 serialize], -[@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 file]_`=_NULL)&] -[s2; Using [^topic`:`/`/Core`/src`/SerializationUtils`$en`-us`#`:`:Store`(Callback1``,Stream`&`)^ S -tore] data are saved to the file.&] -[s7; [%-*C@3 serialize]-|Callback to the serialization function.&] -[s7; [%-*C@3 file]-|Filename.&] -[s7; [*/ Return value]-|true indicates success.&] +[s4; &] +[s5;:Upp`:`:Store`(T`&`,Stream`&`,int`): [@(0.0.255) template] <[@(0.0.255) class] +T> [@(0.0.255) bool] [* Store](T[@(0.0.255) `&] [*@3 x], Stream[@(0.0.255) `&] +[*@3 s], [@(0.0.255) int] [*@3 version ][@(0.0.255) `=] [* Null])&] +[s2;%% Using [%-*^topic`:`/`/Core`/src`/SerializationUtils`_en`-us`#Upp`:`:Store`(Event`,Stream`&`,int`)^ S +tore ]and T`::Serialize, stores [%-*@3 x] to the stream.&] [s3; &] -[s4;%- &] -[s5;:Load`(T`&`,Stream`&`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T][@(0.0.255) >]_ -[@(0.0.255) bool]_[* Load]([*@4 T][@(0.0.255) `&]_[*@3 x], [_^Stream^ Stream][@(0.0.255) `&]_[*@3 s -])&] -[s2; Calls [^topic`:`/`/Core`/src`/SerializationUtils`$en`-us`#`:`:Load`(Callback1``,Stream`&`)^ L -oad] with callback(`&[@3 x], `&T`::Serialize) as serialization callback. -In other words, [@3 x] is restored using its Serialize method.&] -[s7; [*C@4 T]-|Type of object to restore.&] -[s7; [%-*C@3 x]-|Reference to the object.&] -[s7; [%-*C@3 s]-|Stream.&] -[s7; [*/ Return value]-|true indicates success.&] +[s4; &] +[s5;:Upp`:`:LoadFromFile`(T`&`,const char`*`,int`): [@(0.0.255) template] +<[@(0.0.255) class] T> [@(0.0.255) bool] [* LoadFromFile](T[@(0.0.255) `&] +[*@3 x], [@(0.0.255) const] [@(0.0.255) char] [@(0.0.255) `*][*@3 name] +[@(0.0.255) `=] [@3 0], [@(0.0.255) int] [*@3 version ][@(0.0.255) `=] +[* Null])&] +[s2;%% Using [*^topic`:`/`/Core`/src`/SerializationUtils`_en`-us`#Upp`:`:LoadFromFile`(Event`,const char`*`,int`)^ L +oadFromFile ]and T`::Serialize, loads [%-*@3 x] from the stream.&] [s3; &] -[s4;%- &] -[s5;:Store`(T`&`,Stream`&`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T][@(0.0.255) > -]_[@(0.0.255) bool]_[* Store]([*@4 T][@(0.0.255) `&]_[*@3 x], [_^Stream^ Stream][@(0.0.255) `&]_ -[*@3 s])&] -[s2; Calls [^topic`:`/`/Core`/src`/SerializationUtils`$en`-us`#`:`:Store`(T`&`,Stream`&`)^ S -tore] with callback(`&[@3 x], `&T`::Serialize) as serialization -callback. In other words, [@3 x] is stored using its Serialize -method.&] -[s7; [*C@4 T]-|Type of object to restore.&] -[s7; [%-*C@3 x]-|Reference to the object.&] -[s7; [%-*C@3 s]-|Stream.&] -[s7; [*/ Return value]-|true indicates success.&] +[s4; &] +[s5;:Upp`:`:StoreToFile`(T`&`,const char`*`,int`): [@(0.0.255) template] +<[@(0.0.255) class] T> [@(0.0.255) bool] [* StoreToFile](T[@(0.0.255) `&] +[*@3 x], [@(0.0.255) const] [@(0.0.255) char] [@(0.0.255) `*][*@3 name] +[@(0.0.255) `=] [@3 0], [@(0.0.255) int] [*@3 version ][@(0.0.255) `=] +[* Null])&] +[s2;%% Using [*^topic`:`/`/Core`/src`/SerializationUtils`_en`-us`#Upp`:`:StoreToFile`(Event`,const char`*`,int`)^ L +oadFromFile ]and T`::Serialize, stores [%-*@3 x] to the stream.&] +[s3;%% &] +[s4;%% &] +[s5;:StoreAsString`(T`&`): [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T][@(0.0.255) >]_[_^String^ S +tring]_[* StoreAsString]([*@4 T][@(0.0.255) `&]_[*@3 x])&] +[s2;%% Stores [@3 x] using its Serialize method and StringStream.&] [s3; &] -[s4;%- &] -[s5;:LoadFromFile`(T`&`,const char`*`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T][@(0.0.255) > -]_[@(0.0.255) bool]_[* LoadFromFile]([*@4 T][@(0.0.255) `&]_[*@3 x], [@(0.0.255) const]_[@(0.0.255) c -har]_`*[*@3 name]_`=_NULL)&] -[s2; Calls [^topic`:`/`/Core`/src`/SerializationUtils`$en`-us`#`:`:LoadFromFile`(Callback1``,const char`*`)^ L -oadFromFile] with callback(`&[@3 x], `&T`::Serialize) as serialization -callback. In other words, [@3 x] is restored from the file using -its Serialize method.&] -[s7; [*C@4 T]-|Type of object to restore.&] -[s7; [%-*C@3 x]-|Reference to the object.&] -[s7; [%-*C@3 name]-|Filename.&] -[s7; [*/ Return value]-|true indicates success.&] -[s3; &] -[s4;%- &] -[s5;:StoreToFile`(T`&`,const char`*`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T][@(0.0.255) > -]_[@(0.0.255) bool]_[* StoreToFile]([*@4 T][@(0.0.255) `&]_[*@3 x], [@(0.0.255) const]_[@(0.0.255) c -har]_`*[*@3 name]_`=_NULL)&] -[s2; Calls [^topic`:`/`/Core`/src`/SerializationUtils`$en`-us`#`:`:StoreToFile`(Callback1``,const char`*`)^ S -toreToFile] with callback(`&[@3 x], `&T`::Serialize) as serialization -callback. In other words, [@3 x] is stored to the file using its -Serialize method.&] -[s7; [*C@4 T]-|Type of object to store.&] -[s7; [%-*C@3 x]-|Reference to the object.&] -[s7; [%-*C@3 name]-|Filename.&] -[s7; [*/ Return value]-|true indicates success.&] -[s3; &] -[s4;%- &] -[s5;:StoreAsString`(T`&`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T][@(0.0.255) >]_ -[_^String^ String]_[* StoreAsString]([*@4 T][@(0.0.255) `&]_[*@3 x])&] -[s2; Stores [@3 x] using its Serialize method and StringStream.&] -[s7; [*C@4 T]-|Type of object to store.&] -[s7; [%-*C@3 x]-|Reference to the object.&] -[s7; [*/ Return value]-|String containing serialized [@3 x].&] -[s3; &] -[s4;%- &] -[s5;:LoadFromString`(T`&`,const String`&`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T +[s4; &] +[s5;:LoadFromString`(T`&`,const String`&`): [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T ][@(0.0.255) >]_[@(0.0.255) bool]_[* LoadFromString]([*@4 T][@(0.0.255) `&]_[*@3 x], [@(0.0.255) const]_[_^String^ String][@(0.0.255) `&]_[*@3 s])&] -[s2; Restores serialized data from the String (e.g. previously stored -by StoreAsString).&] -[s7; [*C@4 T]-|Type of object to restore.&] -[s7; [%-*C@3 x]-|Reference to object.&] -[s7; [%-*C@3 s]-|String containing serialized [@3 x].&] -[s7; [*/ Return value]-|true indicates success.&] -[s3; &] -[s0; &] -[s0; &] -[s0; &] -[s0; [*@3;4 Global modular serialization support]&] -[s0;# Modular serialization is a viable option for storing configuration +[s2;%% Restores serialized data from the String (e.g. previously +stored by StoreAsString).&] +[s3;%% &] +[s0;%% &] +[s0;%% [*@3;4 Global modular serialization support]&] +[s0;#%% Modular serialization is a viable option for storing configuration of applications consisting of many modules. It allows individual storing/loading data for given global configuration key and also serialization of all such data with single stream.&] -[s0;3 &] -[ {{10000t/25b/25@1 [s0;%- [* Function List]]}}&] -[s0;0%- &] -[s5;:RegisterGlobalConfig`(const char`*`):%- [@(0.0.255) void]_[* RegisterGlobalConfig]([@(0.0.255) c +[s0;3%% &] +[ {{10000t/25b/25@1 [s0; [* Function List]]}}&] +[s0;0 &] +[s5;:RegisterGlobalConfig`(const char`*`): [@(0.0.255) void]_[* RegisterGlobalConfig]([@(0.0.255) c onst]_[@(0.0.255) char]_`*[*@3 name])&] -[s7; Registers name as global configuration key.&] -[s3; &] -[s4;%- &] -[s5;:Upp`:`:RegisterGlobalSerialize`(const char`*`,Upp`:`:Event``):%- [@(0.0.255) v +[s7;%% Registers name as global configuration key.&] +[s3;%% &] +[s4; &] +[s5;:Upp`:`:RegisterGlobalSerialize`(const char`*`,Upp`:`:Event``): [@(0.0.255) v oid]_[* RegisterGlobalSerialize]([@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 name], [_^Upp`:`:Event^ Event]_[*@3 WhenSerialize])&] -[s2; Registers name as global configuration key. [%-*@3 WhenSerialize] -is directly used to serialize data, unlike other variants of -global config key, where data are stored / retrieved using LoadFromGlobal -/ StoreToGlobal.&] -[s3; &] -[s4;%- &] -[s5;:Upp`:`:RegisterGlobalConfig`(const char`*`,Upp`:`:Event`<`>`):%- [@(0.0.255) void]_ -[* RegisterGlobalConfig]([@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 name], +[s2;%% Registers name as global configuration key. [%-*@3 WhenSerialize] +is directly used to serialize data, unlike other variants, where +data are stored / retrieved using LoadFromGlobal / StoreToGlobal.&] +[s3;%% &] +[s4; &] +[s5;:Upp`:`:RegisterGlobalConfig`(const char`*`,Upp`:`:Event`<`>`): [@(0.0.255) void]_[* R +egisterGlobalConfig]([@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 name], [_^Upp`:`:Event^ Event]<>_[*@3 WhenFlush])&] -[s2; Registers name as global configuration key. [%-*C@3 WhenFlush] +[s2;%% Registers name as global configuration key. [%-*C@3 WhenFlush] is called before storing of all configuration keys is performed by SerializeGlobalConfigs `- this is useful when StoreToGlobal has to be explicitly triggered before storing configuration.&] -[s3; &] -[s4;%- &] -[s5;:LoadFromGlobal`(T`&`,const char`*`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T -][@(0.0.255) >]_[@(0.0.255) bool]_[* LoadFromGlobal]([*@4 T][@(0.0.255) `&]_[*@3 x], +[s3;%% &] +[s4; &] +[s5;:LoadFromGlobal`(T`&`,const char`*`): [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T][@(0.0.255) > +]_[@(0.0.255) bool]_[* LoadFromGlobal]([*@4 T][@(0.0.255) `&]_[*@3 x], [@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 name])&] -[s2; Loads [%-*@3 x] from global configuration key [%-*@3 name], using +[s2;%% Loads [%-*@3 x] from global configuration key [%-*@3 name], using Serialize method of T.&] -[s3; &] -[s4;%- &] -[s5;:StoreToGlobal`(T`&`,const char`*`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T -][@(0.0.255) >]_[@(0.0.255) void]_[* StoreToGlobal]([*@4 T][@(0.0.255) `&]_[*@3 x], -[@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 name])&] -[s2; Stores [@3 x] to global configuration key [%-*@3 name], using Serialize -method of T.&] -[s3; &] -[s4;%- &] -[s5;:Upp`:`:LoadFromGlobal`(Upp`:`:Event``,const char`*`):%- [@(0.0.255) b +[s3;%% &] +[s4; &] +[s5;:StoreToGlobal`(T`&`,const char`*`): [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T][@(0.0.255) > +]_[@(0.0.255) void]_[* StoreToGlobal]([*@4 T][@(0.0.255) `&]_[*@3 x], [@(0.0.255) const]_[@(0.0.255) c +har]_`*[*@3 name])&] +[s2;%% Stores [@3 x] to global configuration key [%-*@3 name], using +Serialize method of T.&] +[s3;%% &] +[s4; &] +[s5;:Upp`:`:LoadFromGlobal`(Upp`:`:Event``,const char`*`): [@(0.0.255) b ool]_[* LoadFromGlobal]([_^Upp`:`:Event^ Event]_[*@3 serialize], [@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 name])&] -[s2; Loads [%-*@3 x] from global configuration key [%-*@3 name], using +[s2;%% Loads [%-*@3 x] from global configuration key [%-*@3 name], using [%-*@3 serialize] as serialization function.&] -[s3; &] -[s4;%- &] -[s5;:Upp`:`:StoreToGlobal`(Upp`:`:Event``,const char`*`):%- [@(0.0.255) v +[s3;%% &] +[s4; &] +[s5;:Upp`:`:StoreToGlobal`(Upp`:`:Event``,const char`*`): [@(0.0.255) v oid]_[* StoreToGlobal]([_^Upp`:`:Event^ Event]_[*@3 x], [@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 name])&] -[s2; Stores [@3 x] to global configuration key [%-*@3 name], using [%-*@3 serialize] -as serialization function.&] -[s3; &] -[s4;%- &] -[s5;:SerializeGlobalConfigs`(Stream`&`):%- [@(0.0.255) void]_[* SerializeGlobalConfigs]([_^Stream^ S +[s2;%% Stores [@3 x] to global configuration key [%-*@3 name], using +[%-*@3 serialize] as serialization function.&] +[s3;%% &] +[s4; &] +[s5;:SerializeGlobalConfigs`(Stream`&`): [@(0.0.255) void]_[* SerializeGlobalConfigs]([_^Stream^ S tream][@(0.0.255) `&]_[*@3 s])&] -[s2; Serializes all registered global configuration data from/to +[s2;%% Serializes all registered global configuration data from/to single stream.&] -[s3; &] -[s0; ]] \ No newline at end of file +[s3;%% &] +[s0;%% ]] \ No newline at end of file