• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #region Copyright notice and license
2 // Protocol Buffers - Google's data interchange format
3 // Copyright 2015 Google Inc.  All rights reserved.
4 //
5 // Use of this source code is governed by a BSD-style
6 // license that can be found in the LICENSE file or at
7 // https://developers.google.com/open-source/licenses/bsd
8 #endregion
9 
10 using Google.Protobuf.Collections;
11 
12 namespace Google.Protobuf
13 {
14     /// <summary>
15     /// Generic interface for a Protocol Buffers message containing one or more extensions, where the type parameter is expected to be the same type as the implementation class.
16     /// This interface is experiemental and is subject to change.
17     /// </summary>
18     public interface IExtendableMessage<T> : IMessage<T> where T : IExtendableMessage<T>
19     {
20         /// <summary>
21         /// Gets the value of the specified extension
22         /// </summary>
GetExtension(Extension<T, TValue> extension)23         TValue GetExtension<TValue>(Extension<T, TValue> extension);
24 
25         /// <summary>
26         /// Gets the value of the specified repeated extension or null if the extension isn't registered in this set.
27         /// For a version of this method that never returns null, use <see cref="IExtendableMessage{T}.GetOrInitializeExtension{TValue}(RepeatedExtension{T, TValue})"/>
28         /// </summary>
GetExtension(RepeatedExtension<T, TValue> extension)29         RepeatedField<TValue> GetExtension<TValue>(RepeatedExtension<T, TValue> extension);
30 
31         /// <summary>
32         /// Gets the value of the specified repeated extension, registering it if it hasn't already been registered.
33         /// </summary>
GetOrInitializeExtension(RepeatedExtension<T, TValue> extension)34         RepeatedField<TValue> GetOrInitializeExtension<TValue>(RepeatedExtension<T, TValue> extension);
35 
36         /// <summary>
37         /// Sets the value of the specified extension
38         /// </summary>
SetExtension(Extension<T, TValue> extension, TValue value)39         void SetExtension<TValue>(Extension<T, TValue> extension, TValue value);
40 
41         /// <summary>
42         /// Gets whether the value of the specified extension is set
43         /// </summary>
HasExtension(Extension<T, TValue> extension)44         bool HasExtension<TValue>(Extension<T, TValue> extension);
45 
46         /// <summary>
47         /// Clears the value of the specified extension
48         /// </summary>
ClearExtension(Extension<T, TValue> extension)49         void ClearExtension<TValue>(Extension<T, TValue> extension);
50 
51         /// <summary>
52         /// Clears the value of the specified repeated extension
53         /// </summary>
ClearExtension(RepeatedExtension<T, TValue> extension)54         void ClearExtension<TValue>(RepeatedExtension<T, TValue> extension);
55     }
56 }
57