From 54176b26a9be6c9903b375596b778f51f5947921 Mon Sep 17 00:00:00 2001 From: Sydney Acksman Date: Mon, 24 Sep 2018 15:42:24 -0500 Subject: C# Proto2 feature : Field presence and default values (#4642) * Compiler changes * Generated code changes * Library changes * Compiler style changes * Generated style changes * Fix Windows build errors * Implement changes from review * Reintroduce proto2 check * Compiler changes (required handling review) * Generated code changes (required handling review) * Library changes (required handling review * Field presence rewrite (compiler changes) * Field presence rewrite (generated code changes) * Compiler comment * IFieldAccessor.HasValue library implementation * Remove Clear methods and default values from proto3 code (Compiler) * Remove Clear methods and default values from proto3 code (Generated) * Remove Clear methods and default values from proto3 code (Library) * Fix distcheck error * Rewrite default string values to use base64 and convert * Library changes (IMessage2) * Compiler changes (IMessage2) * Generated changes (IMessage2) * Rebased and regenerated * Compiler changes (initialized extension) * Generated changes (initialized extension) * Library changes (initialized extension) * Refactor MessageExtensions.IsRequired * Move string default value creator and bytes default value creator back to seperate methods * Dead code cleanup * Fixed segmentation fault Removed unused header method declarations --- csharp/src/Google.Protobuf/Reflection/IFieldAccessor.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'csharp/src/Google.Protobuf/Reflection/IFieldAccessor.cs') diff --git a/csharp/src/Google.Protobuf/Reflection/IFieldAccessor.cs b/csharp/src/Google.Protobuf/Reflection/IFieldAccessor.cs index cfe56fde..8f7ef3c6 100644 --- a/csharp/src/Google.Protobuf/Reflection/IFieldAccessor.cs +++ b/csharp/src/Google.Protobuf/Reflection/IFieldAccessor.cs @@ -51,6 +51,11 @@ namespace Google.Protobuf.Reflection /// void Clear(IMessage message); + /// + /// Indicates whether the field in the specified message is set. For proto3 fields, this throws an + /// + bool HasValue(IMessage message); + /// /// Fetches the field value. For repeated values, this will be an /// implementation. For map values, this will be an -- cgit v1.2.3