Enhanced C#
Loyc library documentation
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Public fields | Properties | Public Member Functions | List of all members
SyncProtobuf.SchemaWriter Struct Reference

An implementation of ISyncManager that produces a Protocol Buffers proto3 .proto definition describing the output of SyncProtobuf.Writer. More...


Source file:
Inheritance diagram for SyncProtobuf.SchemaWriter:

Remarks

An implementation of ISyncManager that produces a Protocol Buffers proto3 .proto definition describing the output of SyncProtobuf.Writer.

Mode is SyncMode.Schema, so there is no data: your synchronizer receives a default/null value and should call the same methods it would call when loading. Since a schema saver has no data, it cannot see data-dependent behavior (fields synchronized only on some code paths, or the branch chosen for a polymorphic type tag). It reports NeedsIntegerIds = true, so synchronizers take the same code path they take for the real writer and field numbers line up.

Each distinct sub-object type (identified by the childKey passed to BeginSubObject, normally typeof(T)) becomes a message. Recursive/cyclic types are handled by referencing the message by name. A type synchronized in two conflicting ways causes EndSubObject to throw. The message name is the .NET type name unless SyncTypeTag is called.

The generated .proto describes the wire format exactly: any Protobuf implementation can use it to parse SyncProtobuf.Writer's output. Lists, nullable list elements and deduplicated values appear as generated wrapper message types (e.g. Int32List, StringOpt, PersonRef — see SyncProtobuf for the encoding); decimal and BigInteger (which Protobuf lacks) map to bytes; and a comment at the top names the root message.

Public fields

SyncMode Mode => SyncMode.Schema
 
bool IsReading => true
 
bool IsWriting => false
 
bool SupportsReordering => true
 
bool SupportsDeduplication => true
 
bool NeedsIntegerIds => true
 
bool SupportsNextField => false
 
bool IsPlainText => false
 
ISyncOptions Options => _s._opt
 
bool IsInsideList => _s.IsInsideList
 
bool ReachedEndOfList => _s.ReachedEndOfList
 
int MinimumListLength => _s.MinimumListLength
 
int Depth => _s.Depth
 
FieldId NextField => FieldId.Missing
 
bool Begun
 
bool int Length
 

Properties

object CurrentObject [set]
 

Public Member Functions

SyncType GetFieldType (FieldId name, SyncType expectedType=SyncType.Unknown)
 
bool int object Object BeginSubObject (FieldId name, object?childKey, ObjectMode mode, int listLength=-1)
 
void EndSubObject ()
 
string SyncTypeTag (string?tag)
 
ReadOnlyMemory< byte > Finish ()
 Renders the recorded schema as a proto3 .proto document (UTF-8). More...
 
override string ToString ()
 Renders the recorded schema as a proto3 .proto string. More...
 
bool Sync (FieldId name, bool savable)
 
sbyte Sync (FieldId name, sbyte savable)
 
byte Sync (FieldId name, byte savable)
 
short Sync (FieldId name, short savable)
 
ushort Sync (FieldId name, ushort savable)
 
int Sync (FieldId name, int savable)
 
uint Sync (FieldId name, uint savable)
 
long Sync (FieldId name, long savable)
 
ulong Sync (FieldId name, ulong savable)
 
float Sync (FieldId name, float savable)
 
double Sync (FieldId name, double savable)
 
decimal Sync (FieldId name, decimal savable)
 
BigInteger Sync (FieldId name, BigInteger savable)
 
char Sync (FieldId name, char savable)
 
int Sync (FieldId name, int savable, int bits, bool signed=true)
 
long Sync (FieldId name, long savable, int bits, bool signed=true)
 
BigInteger Sync (FieldId name, BigInteger savable, int bits, bool signed=true)
 
string Sync (FieldId name, string?savable, ObjectMode mode=ObjectMode.Normal)
 
bool Sync (FieldId name, bool?savable)
 
sbyte Sync (FieldId name, sbyte?savable)
 
byte Sync (FieldId name, byte?savable)
 
short Sync (FieldId name, short?savable)
 
ushort Sync (FieldId name, ushort?savable)
 
int Sync (FieldId name, int?savable)
 
uint Sync (FieldId name, uint?savable)
 
long Sync (FieldId name, long?savable)
 
ulong Sync (FieldId name, ulong?savable)
 
float Sync (FieldId name, float?savable)
 
double Sync (FieldId name, double?savable)
 
decimal Sync (FieldId name, decimal?savable)
 
BigInteger Sync (FieldId name, BigInteger?savable)
 
char Sync (FieldId name, char?savable)
 
List SyncListBoolImpl< Scanner, List, ListBuilder > (FieldId name, Scanner scanner, List?saving, ListBuilder builder, ObjectMode mode, int tupleLength=-1)
 
List SyncListByteImpl< Scanner, List, ListBuilder > (FieldId name, Scanner scanner, List?saving, ListBuilder builder, ObjectMode mode, int tupleLength=-1)
 
List SyncListCharImpl< Scanner, List, ListBuilder > (FieldId name, Scanner scanner, List?saving, ListBuilder builder, ObjectMode mode, int tupleLength=-1)
 
void SyncScalarList (FieldId name, string elemType, ObjectMode mode, int tupleLength)
 

Member Function Documentation

ReadOnlyMemory<byte> SyncProtobuf.SchemaWriter.Finish ( )
inline

Renders the recorded schema as a proto3 .proto document (UTF-8).

override string SyncProtobuf.SchemaWriter.ToString ( )

Renders the recorded schema as a proto3 .proto string.