From 48ce28bf2fed8edde98f14c79807b4f4411cca6c Mon Sep 17 00:00:00 2001 From: Jon Skeet Date: Thu, 14 Aug 2008 20:35:32 +0100 Subject: Copyright fixes, a bit of documentation, and removed unnecessary using directives. --- csharp/ProtocolBuffers.Test/AbstractMessageTest.cs | 17 ++++++++++++++- .../ProtocolBuffers.Test/CodedOutputStreamTest.cs | 4 ++-- csharp/ProtocolBuffers.Test/DescriptorsTest.cs | 17 ++++++++++++++- csharp/ProtocolBuffers.Test/DynamicMessageTest.cs | 20 +++++++++++++---- .../ProtocolBuffers.Test/GeneratedMessageTest.cs | 20 +++++++++++++---- csharp/ProtocolBuffers.Test/MessageTest.cs | 18 +++++++++++++--- csharp/ProtocolBuffers.Test/ReflectionTester.cs | 21 ++++++++++++++---- csharp/ProtocolBuffers.Test/ServiceTest.cs | 17 ++++++++++++++- csharp/ProtocolBuffers.Test/TestUtil.cs | 19 ++++++++++++++-- csharp/ProtocolBuffers.Test/TextFormatTest.cs | 17 ++++++++++++++- csharp/ProtocolBuffers.Test/UnknownFieldSetTest.cs | 17 ++++++++++++++- csharp/ProtocolBuffers.Test/WireFormatTest.cs | 20 +++++++++++++---- csharp/ProtocolBuffers/AbstractBuilder.cs | 22 +++++++++++++++---- csharp/ProtocolBuffers/ByteString.cs | 2 +- csharp/ProtocolBuffers/CodedOutputStream.cs | 2 +- csharp/ProtocolBuffers/Collections/Dictionaries.cs | 21 ++++++++++++++---- csharp/ProtocolBuffers/Collections/Lists.cs | 25 +++++++++++++++++++--- .../Collections/ReadOnlyDictionary.cs | 21 ++++++++++++++---- .../DescriptorProtos/IDescriptorProto.cs | 20 ++++++++++++++++- .../DescriptorProtos/PartialClasses.cs | 20 +++++++++++++---- .../ProtocolBuffers/Descriptors/DescriptorBase.cs | 19 ++++++++++++---- .../ProtocolBuffers/Descriptors/DescriptorPool.cs | 19 ++++++++++++++-- .../ProtocolBuffers/Descriptors/DescriptorUtil.cs | 20 +++++++++++++++-- .../Descriptors/DescriptorValidationException.cs | 25 ++++++++++++++++++---- .../ProtocolBuffers/Descriptors/EnumDescriptor.cs | 23 +++++++++++++++++--- .../Descriptors/EnumDescriptorIndexAttribute.cs | 17 ++++++++++++++- .../Descriptors/EnumValueDescriptor.cs | 22 +++++++++++++++++-- .../ProtocolBuffers/Descriptors/FieldDescriptor.cs | 24 ++++++++++++++++++--- .../Descriptors/FieldMappingAttribute.cs | 21 ++++++++++++++---- csharp/ProtocolBuffers/Descriptors/FieldType.cs | 17 ++++++++++++++- .../ProtocolBuffers/Descriptors/FileDescriptor.cs | 23 ++++++++++++++++---- csharp/ProtocolBuffers/Descriptors/IDescriptor.cs | 18 +++++++++++++--- .../Descriptors/IndexedDescriptorBase.cs | 18 +++++++++++++--- csharp/ProtocolBuffers/Descriptors/MappedType.cs | 18 +++++++++++++--- .../Descriptors/MessageDescriptor.cs | 19 ++++++++++++++-- .../Descriptors/MethodDescriptor.cs | 19 ++++++++++++++-- .../Descriptors/PackageDescriptor.cs | 17 ++++++--------- .../Descriptors/ServiceDescriptor.cs | 20 ++++++++++++++--- csharp/ProtocolBuffers/DynamicMessage.cs | 25 ++++++++++++++++++---- csharp/ProtocolBuffers/ExtendableBuilder.cs | 17 +++++++++++++-- csharp/ProtocolBuffers/ExtendableMessage.cs | 20 ++++++++++++++--- csharp/ProtocolBuffers/ExtensionInfo.cs | 15 +++++++++++++ csharp/ProtocolBuffers/FieldAccess/Delegates.cs | 11 ---------- .../FieldAccess/FieldAccessorTable.cs | 19 ++++++++++++++-- .../ProtocolBuffers/FieldAccess/IFieldAccessor.cs | 18 +++++++++++++++- .../FieldAccess/RepeatedMessageAccessor.cs | 16 +++++++++++++- .../FieldAccess/RepeatedPrimitiveAccessor.cs | 16 +++++++++++++- .../FieldAccess/SingleEnumAccessor.cs | 16 +++++++++++++- .../FieldAccess/SingleMessageAccessor.cs | 16 +++++++++++++- .../FieldAccess/SinglePrimitiveAccessor.cs | 16 +++++++++++++- csharp/ProtocolBuffers/FieldSet.cs | 22 +++++++++++++++---- csharp/ProtocolBuffers/GeneratedBuilder.cs | 20 +++++++++++++---- csharp/ProtocolBuffers/GeneratedExtensionBase.cs | 18 ++++++++++++++-- csharp/ProtocolBuffers/GeneratedMessage.cs | 19 +++++++++++++--- csharp/ProtocolBuffers/GeneratedRepeatException.cs | 19 ++++++++++++++-- csharp/ProtocolBuffers/GeneratedSingleExtension.cs | 19 ++++++++++++++-- csharp/ProtocolBuffers/IRpcChannel.cs | 17 ++++++++++++++- csharp/ProtocolBuffers/IRpcController.cs | 17 ++++++++++++++- csharp/ProtocolBuffers/IService.cs | 19 +++++++++++++--- .../InvalidProtocolBufferException.cs | 5 +---- csharp/ProtocolBuffers/Properties/AssemblyInfo.cs | 18 ++++++++++++++-- csharp/ProtocolBuffers/ProtocolBuffers.csproj | 1 - csharp/ProtocolBuffers/RpcUtil.cs | 22 ++++++++++++++++--- csharp/ProtocolBuffers/TextFormat.cs | 17 ++++++++++++++- csharp/ProtocolBuffers/TextGenerator.cs | 20 ++++++++++++++--- csharp/ProtocolBuffers/TextTokenizer.cs | 17 ++++++++++++++- .../UninitializedMessageException.cs | 2 +- csharp/ProtocolBuffers/UnknownField.cs | 19 ++++++++++++++-- csharp/ProtocolBuffers/UnknownFieldSet.cs | 19 +++++++++++++--- csharp/ProtocolBuffers/WireFormat.cs | 6 +++--- 70 files changed, 1039 insertions(+), 181 deletions(-) delete mode 100644 csharp/ProtocolBuffers/FieldAccess/Delegates.cs (limited to 'csharp') diff --git a/csharp/ProtocolBuffers.Test/AbstractMessageTest.cs b/csharp/ProtocolBuffers.Test/AbstractMessageTest.cs index 4178c92e..38cc8636 100644 --- a/csharp/ProtocolBuffers.Test/AbstractMessageTest.cs +++ b/csharp/ProtocolBuffers.Test/AbstractMessageTest.cs @@ -1,4 +1,19 @@ -using System; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System; using System.Collections.Generic; using Google.ProtocolBuffers.Descriptors; using NUnit.Framework; diff --git a/csharp/ProtocolBuffers.Test/CodedOutputStreamTest.cs b/csharp/ProtocolBuffers.Test/CodedOutputStreamTest.cs index 84cddd12..41b7b4b3 100644 --- a/csharp/ProtocolBuffers.Test/CodedOutputStreamTest.cs +++ b/csharp/ProtocolBuffers.Test/CodedOutputStreamTest.cs @@ -1,5 +1,4 @@ -using System.IO; -// Protocol Buffers - Google's data interchange format +// Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. // http://code.google.com/p/protobuf/ // @@ -14,6 +13,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +using System.IO; using Google.ProtocolBuffers.TestProtos; using NUnit.Framework; diff --git a/csharp/ProtocolBuffers.Test/DescriptorsTest.cs b/csharp/ProtocolBuffers.Test/DescriptorsTest.cs index 6e406af5..c00d413e 100644 --- a/csharp/ProtocolBuffers.Test/DescriptorsTest.cs +++ b/csharp/ProtocolBuffers.Test/DescriptorsTest.cs @@ -1,4 +1,19 @@ -using System; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System; using System.Collections.Generic; using System.Text; using NUnit.Framework; diff --git a/csharp/ProtocolBuffers.Test/DynamicMessageTest.cs b/csharp/ProtocolBuffers.Test/DynamicMessageTest.cs index 5f9f6bee..11fc2d82 100644 --- a/csharp/ProtocolBuffers.Test/DynamicMessageTest.cs +++ b/csharp/ProtocolBuffers.Test/DynamicMessageTest.cs @@ -1,8 +1,20 @@ -using System; -using System.Collections.Generic; -using System.Text; +using Google.ProtocolBuffers.TestProtos; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. using NUnit.Framework; -using Google.ProtocolBuffers.TestProtos; namespace Google.ProtocolBuffers { [TestFixture] diff --git a/csharp/ProtocolBuffers.Test/GeneratedMessageTest.cs b/csharp/ProtocolBuffers.Test/GeneratedMessageTest.cs index 7299b50b..9a08ed95 100644 --- a/csharp/ProtocolBuffers.Test/GeneratedMessageTest.cs +++ b/csharp/ProtocolBuffers.Test/GeneratedMessageTest.cs @@ -1,9 +1,21 @@ -using System; -using System.Collections.Generic; -using System.Text; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. using Google.ProtocolBuffers.Descriptors; -using NUnit.Framework; using Google.ProtocolBuffers.TestProtos; +using NUnit.Framework; namespace Google.ProtocolBuffers { [TestFixture] diff --git a/csharp/ProtocolBuffers.Test/MessageTest.cs b/csharp/ProtocolBuffers.Test/MessageTest.cs index 6d56f0e5..d206e78f 100644 --- a/csharp/ProtocolBuffers.Test/MessageTest.cs +++ b/csharp/ProtocolBuffers.Test/MessageTest.cs @@ -1,6 +1,18 @@ -using System; -using System.Collections.Generic; -using System.Text; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. using Google.ProtocolBuffers.Descriptors; using Google.ProtocolBuffers.TestProtos; using NUnit.Framework; diff --git a/csharp/ProtocolBuffers.Test/ReflectionTester.cs b/csharp/ProtocolBuffers.Test/ReflectionTester.cs index c0e4af39..0a4b9646 100644 --- a/csharp/ProtocolBuffers.Test/ReflectionTester.cs +++ b/csharp/ProtocolBuffers.Test/ReflectionTester.cs @@ -1,9 +1,22 @@ -using System; -using System.Collections.Generic; -using System.Text; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System; using Google.ProtocolBuffers.Descriptors; -using NUnit.Framework; using Google.ProtocolBuffers.TestProtos; +using NUnit.Framework; namespace Google.ProtocolBuffers { /// diff --git a/csharp/ProtocolBuffers.Test/ServiceTest.cs b/csharp/ProtocolBuffers.Test/ServiceTest.cs index d4864e2b..34f83bda 100644 --- a/csharp/ProtocolBuffers.Test/ServiceTest.cs +++ b/csharp/ProtocolBuffers.Test/ServiceTest.cs @@ -1,4 +1,19 @@ -using System; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System; using Google.ProtocolBuffers.Descriptors; using Google.ProtocolBuffers.TestProtos; using NUnit.Framework; diff --git a/csharp/ProtocolBuffers.Test/TestUtil.cs b/csharp/ProtocolBuffers.Test/TestUtil.cs index c0cbd1b6..f155af6d 100644 --- a/csharp/ProtocolBuffers.Test/TestUtil.cs +++ b/csharp/ProtocolBuffers.Test/TestUtil.cs @@ -1,7 +1,22 @@ -using System; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System; using System.Collections.Generic; -using System.Text; using System.IO; +using System.Text; using Google.ProtocolBuffers.TestProtos; using NUnit.Framework; diff --git a/csharp/ProtocolBuffers.Test/TextFormatTest.cs b/csharp/ProtocolBuffers.Test/TextFormatTest.cs index fa12e45d..a8cd3557 100644 --- a/csharp/ProtocolBuffers.Test/TextFormatTest.cs +++ b/csharp/ProtocolBuffers.Test/TextFormatTest.cs @@ -1,4 +1,19 @@ -using System; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System; using System.IO; using System.Text; using Google.ProtocolBuffers.TestProtos; diff --git a/csharp/ProtocolBuffers.Test/UnknownFieldSetTest.cs b/csharp/ProtocolBuffers.Test/UnknownFieldSetTest.cs index d0a2c540..921bc066 100644 --- a/csharp/ProtocolBuffers.Test/UnknownFieldSetTest.cs +++ b/csharp/ProtocolBuffers.Test/UnknownFieldSetTest.cs @@ -1,4 +1,19 @@ -using System; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System; using System.Collections.Generic; using Google.ProtocolBuffers.Descriptors; using Google.ProtocolBuffers.TestProtos; diff --git a/csharp/ProtocolBuffers.Test/WireFormatTest.cs b/csharp/ProtocolBuffers.Test/WireFormatTest.cs index e0451f89..6e4e506f 100644 --- a/csharp/ProtocolBuffers.Test/WireFormatTest.cs +++ b/csharp/ProtocolBuffers.Test/WireFormatTest.cs @@ -1,9 +1,21 @@ -using System; -using System.Collections.Generic; -using System.Text; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using Google.ProtocolBuffers.Descriptors; using Google.ProtocolBuffers.TestProtos; using NUnit.Framework; -using Google.ProtocolBuffers.Descriptors; namespace Google.ProtocolBuffers { [TestFixture] diff --git a/csharp/ProtocolBuffers/AbstractBuilder.cs b/csharp/ProtocolBuffers/AbstractBuilder.cs index bb71edac..f0561823 100644 --- a/csharp/ProtocolBuffers/AbstractBuilder.cs +++ b/csharp/ProtocolBuffers/AbstractBuilder.cs @@ -1,9 +1,23 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Google.ProtocolBuffers.Descriptors; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System; using System.Collections; +using System.Collections.Generic; using System.IO; +using Google.ProtocolBuffers.Descriptors; namespace Google.ProtocolBuffers { /// diff --git a/csharp/ProtocolBuffers/ByteString.cs b/csharp/ProtocolBuffers/ByteString.cs index 8a7909e3..13b9c159 100644 --- a/csharp/ProtocolBuffers/ByteString.cs +++ b/csharp/ProtocolBuffers/ByteString.cs @@ -159,7 +159,7 @@ namespace Google.ProtocolBuffers { /// copying being involved. This has to be a nested type in order to have access /// to the private ByteString constructor. /// - internal class CodedBuilder { + internal sealed class CodedBuilder { private readonly CodedOutputStream output; private readonly byte[] buffer; diff --git a/csharp/ProtocolBuffers/CodedOutputStream.cs b/csharp/ProtocolBuffers/CodedOutputStream.cs index 6314a702..e5765842 100644 --- a/csharp/ProtocolBuffers/CodedOutputStream.cs +++ b/csharp/ProtocolBuffers/CodedOutputStream.cs @@ -698,7 +698,7 @@ namespace Google.ProtocolBuffers { /// Indicates that a CodedOutputStream wrapping a flat byte array /// ran out of space. /// - public class OutOfSpaceException : IOException { + public sealed class OutOfSpaceException : IOException { internal OutOfSpaceException() : base("CodedOutputStream was writing to a flat byte array and ran out of space.") { } diff --git a/csharp/ProtocolBuffers/Collections/Dictionaries.cs b/csharp/ProtocolBuffers/Collections/Dictionaries.cs index 640b6597..5ba02664 100644 --- a/csharp/ProtocolBuffers/Collections/Dictionaries.cs +++ b/csharp/ProtocolBuffers/Collections/Dictionaries.cs @@ -1,8 +1,21 @@ -using System; -using System.Collections.Generic; -using System.Text; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System; using System.Collections; -using Google.ProtocolBuffers.Descriptors; +using System.Collections.Generic; namespace Google.ProtocolBuffers.Collections { diff --git a/csharp/ProtocolBuffers/Collections/Lists.cs b/csharp/ProtocolBuffers/Collections/Lists.cs index 0fba3edb..b1b6b122 100644 --- a/csharp/ProtocolBuffers/Collections/Lists.cs +++ b/csharp/ProtocolBuffers/Collections/Lists.cs @@ -1,19 +1,38 @@ -using System; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. using System.Collections.Generic; using System.Collections.ObjectModel; -using System.Text; namespace Google.ProtocolBuffers.Collections { + /// + /// Utility non-generic class for calling into Lists{T} using type inference. + /// public static class Lists { + /// + /// Returns a read-only view of the specified list. + /// public static IList AsReadOnly(IList list) { return Lists.AsReadOnly(list); } } /// - /// Utilities class for dealing with lists. + /// Utility class for dealing with lists. /// public static class Lists { diff --git a/csharp/ProtocolBuffers/Collections/ReadOnlyDictionary.cs b/csharp/ProtocolBuffers/Collections/ReadOnlyDictionary.cs index b67d5cd3..cd4b1898 100644 --- a/csharp/ProtocolBuffers/Collections/ReadOnlyDictionary.cs +++ b/csharp/ProtocolBuffers/Collections/ReadOnlyDictionary.cs @@ -1,14 +1,27 @@ -using System; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System; using System.Collections; using System.Collections.Generic; -using System.Text; -using IEnumerable=System.Collections.IEnumerable; namespace Google.ProtocolBuffers.Collections { /// /// Read-only wrapper around another dictionary. /// - public class ReadOnlyDictionary : IDictionary { + public sealed class ReadOnlyDictionary : IDictionary { readonly IDictionary wrapped; public ReadOnlyDictionary(IDictionary wrapped) { diff --git a/csharp/ProtocolBuffers/DescriptorProtos/IDescriptorProto.cs b/csharp/ProtocolBuffers/DescriptorProtos/IDescriptorProto.cs index 34b27576..1b9f1dc3 100644 --- a/csharp/ProtocolBuffers/DescriptorProtos/IDescriptorProto.cs +++ b/csharp/ProtocolBuffers/DescriptorProtos/IDescriptorProto.cs @@ -1,4 +1,19 @@ -namespace Google.ProtocolBuffers.DescriptorProtos { +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +namespace Google.ProtocolBuffers.DescriptorProtos { /// /// Interface implemented by all DescriptorProtos. The generator doesn't @@ -13,6 +28,9 @@ /// string Name { get; } + /// + /// The options for this descriptor. + /// TOptions Options { get; } } } diff --git a/csharp/ProtocolBuffers/DescriptorProtos/PartialClasses.cs b/csharp/ProtocolBuffers/DescriptorProtos/PartialClasses.cs index 46edb7b1..66501374 100644 --- a/csharp/ProtocolBuffers/DescriptorProtos/PartialClasses.cs +++ b/csharp/ProtocolBuffers/DescriptorProtos/PartialClasses.cs @@ -1,8 +1,20 @@ -using System; -using System.Collections.Generic; -using System.Text; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. -// This class just contains partial classes for each of the +// This file just contains partial classes for each of the // autogenerated classes, so that they implement // IDescriptorProto namespace Google.ProtocolBuffers.DescriptorProtos { diff --git a/csharp/ProtocolBuffers/Descriptors/DescriptorBase.cs b/csharp/ProtocolBuffers/Descriptors/DescriptorBase.cs index 0678cb6d..0c1414ae 100644 --- a/csharp/ProtocolBuffers/Descriptors/DescriptorBase.cs +++ b/csharp/ProtocolBuffers/Descriptors/DescriptorBase.cs @@ -1,8 +1,19 @@ -using System; -using System.Collections.Generic; -using System.Text; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. using Google.ProtocolBuffers.DescriptorProtos; -using Google.ProtocolBuffers.Collections; namespace Google.ProtocolBuffers.Descriptors { /// diff --git a/csharp/ProtocolBuffers/Descriptors/DescriptorPool.cs b/csharp/ProtocolBuffers/Descriptors/DescriptorPool.cs index fc30295e..19a5b6a7 100644 --- a/csharp/ProtocolBuffers/Descriptors/DescriptorPool.cs +++ b/csharp/ProtocolBuffers/Descriptors/DescriptorPool.cs @@ -1,4 +1,19 @@ -using System.Collections.Generic; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System.Collections.Generic; using System; using System.Text; using System.Text.RegularExpressions; @@ -7,7 +22,7 @@ namespace Google.ProtocolBuffers.Descriptors { /// /// Contains lookup tables containing all the descriptors defined in a particular file. /// - internal class DescriptorPool { + internal sealed class DescriptorPool { private readonly IDictionary descriptorsByName = new Dictionary(); diff --git a/csharp/ProtocolBuffers/Descriptors/DescriptorUtil.cs b/csharp/ProtocolBuffers/Descriptors/DescriptorUtil.cs index a75d5f92..c945616d 100644 --- a/csharp/ProtocolBuffers/Descriptors/DescriptorUtil.cs +++ b/csharp/ProtocolBuffers/Descriptors/DescriptorUtil.cs @@ -1,10 +1,26 @@ -using System.Collections.Generic; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System.Collections.Generic; using Google.ProtocolBuffers.Collections; + namespace Google.ProtocolBuffers.Descriptors { /// /// Internal class containing utility methods when working with descriptors. /// - static class DescriptorUtil { + internal static class DescriptorUtil { /// /// Equivalent to Func[TInput, int, TOutput] but usable in .NET 2.0. Only used to convert /// arrays. diff --git a/csharp/ProtocolBuffers/Descriptors/DescriptorValidationException.cs b/csharp/ProtocolBuffers/Descriptors/DescriptorValidationException.cs index bc0c2078..62c723f3 100644 --- a/csharp/ProtocolBuffers/Descriptors/DescriptorValidationException.cs +++ b/csharp/ProtocolBuffers/Descriptors/DescriptorValidationException.cs @@ -1,9 +1,26 @@ -using System; -using System.Collections.Generic; -using System.Text; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System; namespace Google.ProtocolBuffers.Descriptors { - public class DescriptorValidationException : Exception { + /// + /// Thrown when building descriptors fails because the source DescriptorProtos + /// are not valid. + /// + public sealed class DescriptorValidationException : Exception { private readonly String name; private readonly IMessage proto; diff --git a/csharp/ProtocolBuffers/Descriptors/EnumDescriptor.cs b/csharp/ProtocolBuffers/Descriptors/EnumDescriptor.cs index a28efc5f..83090236 100644 --- a/csharp/ProtocolBuffers/Descriptors/EnumDescriptor.cs +++ b/csharp/ProtocolBuffers/Descriptors/EnumDescriptor.cs @@ -1,10 +1,27 @@ - -using System; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. using System.Collections.Generic; using Google.ProtocolBuffers.DescriptorProtos; + namespace Google.ProtocolBuffers.Descriptors { - public class EnumDescriptor : IndexedDescriptorBase { + /// + /// Descriptor for an enum type in a .proto file. + /// + public sealed class EnumDescriptor : IndexedDescriptorBase { private readonly MessageDescriptor containingType; private readonly IList values; diff --git a/csharp/ProtocolBuffers/Descriptors/EnumDescriptorIndexAttribute.cs b/csharp/ProtocolBuffers/Descriptors/EnumDescriptorIndexAttribute.cs index c8d23858..85c814e8 100644 --- a/csharp/ProtocolBuffers/Descriptors/EnumDescriptorIndexAttribute.cs +++ b/csharp/ProtocolBuffers/Descriptors/EnumDescriptorIndexAttribute.cs @@ -1,4 +1,19 @@ -using System; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System; namespace Google.ProtocolBuffers.Descriptors { /// diff --git a/csharp/ProtocolBuffers/Descriptors/EnumValueDescriptor.cs b/csharp/ProtocolBuffers/Descriptors/EnumValueDescriptor.cs index 15b901bd..112a7fb6 100644 --- a/csharp/ProtocolBuffers/Descriptors/EnumValueDescriptor.cs +++ b/csharp/ProtocolBuffers/Descriptors/EnumValueDescriptor.cs @@ -1,8 +1,26 @@ -using System; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. using Google.ProtocolBuffers.DescriptorProtos; namespace Google.ProtocolBuffers.Descriptors { - public class EnumValueDescriptor : IndexedDescriptorBase { + + /// + /// Descriptor for a single enum value within an enum in a .proto file. + /// + public sealed class EnumValueDescriptor : IndexedDescriptorBase { private readonly EnumDescriptor enumDescriptor; diff --git a/csharp/ProtocolBuffers/Descriptors/FieldDescriptor.cs b/csharp/ProtocolBuffers/Descriptors/FieldDescriptor.cs index f2f99a38..0cd552e4 100644 --- a/csharp/ProtocolBuffers/Descriptors/FieldDescriptor.cs +++ b/csharp/ProtocolBuffers/Descriptors/FieldDescriptor.cs @@ -1,12 +1,30 @@ -using System; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System; using System.Collections.Generic; using System.Reflection; using Google.ProtocolBuffers.Collections; using Google.ProtocolBuffers.DescriptorProtos; -using System.Collections.ObjectModel; namespace Google.ProtocolBuffers.Descriptors { - public class FieldDescriptor : IndexedDescriptorBase, IComparable { + + /// + /// Descriptor for a field or extension within a message in a .proto file. + /// + public sealed class FieldDescriptor : IndexedDescriptorBase, IComparable { private readonly MessageDescriptor extensionScope; private EnumDescriptor enumType; diff --git a/csharp/ProtocolBuffers/Descriptors/FieldMappingAttribute.cs b/csharp/ProtocolBuffers/Descriptors/FieldMappingAttribute.cs index 13e8be1e..18f88a31 100644 --- a/csharp/ProtocolBuffers/Descriptors/FieldMappingAttribute.cs +++ b/csharp/ProtocolBuffers/Descriptors/FieldMappingAttribute.cs @@ -1,6 +1,19 @@ -using System; -using System.Collections.Generic; -using System.Text; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System; namespace Google.ProtocolBuffers.Descriptors { @@ -9,7 +22,7 @@ namespace Google.ProtocolBuffers.Descriptors { /// this allows each field type to specify the mapped type and wire type. /// [AttributeUsage(AttributeTargets.Field)] - internal class FieldMappingAttribute : Attribute { + internal sealed class FieldMappingAttribute : Attribute { internal FieldMappingAttribute(MappedType mappedType, WireFormat.WireType wireType) { MappedType = mappedType; WireType = wireType; diff --git a/csharp/ProtocolBuffers/Descriptors/FieldType.cs b/csharp/ProtocolBuffers/Descriptors/FieldType.cs index 30b82d69..7c15c0cc 100644 --- a/csharp/ProtocolBuffers/Descriptors/FieldType.cs +++ b/csharp/ProtocolBuffers/Descriptors/FieldType.cs @@ -1,4 +1,19 @@ - +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + namespace Google.ProtocolBuffers.Descriptors { /// /// Enumeration of all the possible field types. The odd formatting is to make it very clear diff --git a/csharp/ProtocolBuffers/Descriptors/FileDescriptor.cs b/csharp/ProtocolBuffers/Descriptors/FileDescriptor.cs index 9e065c86..b3beea0b 100644 --- a/csharp/ProtocolBuffers/Descriptors/FileDescriptor.cs +++ b/csharp/ProtocolBuffers/Descriptors/FileDescriptor.cs @@ -1,8 +1,23 @@ -using System; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System; +using System.Collections.Generic; using System.Collections.ObjectModel; using Google.ProtocolBuffers.DescriptorProtos; -using System.Collections.Generic; -using Google.ProtocolBuffers.Collections; + namespace Google.ProtocolBuffers.Descriptors { /// @@ -10,7 +25,7 @@ namespace Google.ProtocolBuffers.Descriptors { /// IDescriptor is implemented such that the File property returns this descriptor, /// and the FullName is the same as the Name. /// - public class FileDescriptor : IDescriptor { + public sealed class FileDescriptor : IDescriptor { private readonly FileDescriptorProto proto; private readonly IList messageTypes; diff --git a/csharp/ProtocolBuffers/Descriptors/IDescriptor.cs b/csharp/ProtocolBuffers/Descriptors/IDescriptor.cs index ff562840..2143f39a 100644 --- a/csharp/ProtocolBuffers/Descriptors/IDescriptor.cs +++ b/csharp/ProtocolBuffers/Descriptors/IDescriptor.cs @@ -1,6 +1,18 @@ -using System; -using System.Collections.Generic; -using System.Text; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. namespace Google.ProtocolBuffers.Descriptors { diff --git a/csharp/ProtocolBuffers/Descriptors/IndexedDescriptorBase.cs b/csharp/ProtocolBuffers/Descriptors/IndexedDescriptorBase.cs index 04fd3e62..d04d40db 100644 --- a/csharp/ProtocolBuffers/Descriptors/IndexedDescriptorBase.cs +++ b/csharp/ProtocolBuffers/Descriptors/IndexedDescriptorBase.cs @@ -1,6 +1,18 @@ -using System; -using System.Collections.Generic; -using System.Text; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. using Google.ProtocolBuffers.DescriptorProtos; namespace Google.ProtocolBuffers.Descriptors { diff --git a/csharp/ProtocolBuffers/Descriptors/MappedType.cs b/csharp/ProtocolBuffers/Descriptors/MappedType.cs index 8d6c8ced..ca7a7b43 100644 --- a/csharp/ProtocolBuffers/Descriptors/MappedType.cs +++ b/csharp/ProtocolBuffers/Descriptors/MappedType.cs @@ -1,6 +1,18 @@ -using System; -using System.Collections.Generic; -using System.Text; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. namespace Google.ProtocolBuffers.Descriptors { /// diff --git a/csharp/ProtocolBuffers/Descriptors/MessageDescriptor.cs b/csharp/ProtocolBuffers/Descriptors/MessageDescriptor.cs index 02343937..e3df02fe 100644 --- a/csharp/ProtocolBuffers/Descriptors/MessageDescriptor.cs +++ b/csharp/ProtocolBuffers/Descriptors/MessageDescriptor.cs @@ -1,4 +1,19 @@ -using System.Collections.Generic; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System.Collections.Generic; using Google.ProtocolBuffers.DescriptorProtos; namespace Google.ProtocolBuffers.Descriptors { @@ -6,7 +21,7 @@ namespace Google.ProtocolBuffers.Descriptors { /// /// Describes a message type. /// - public class MessageDescriptor : IndexedDescriptorBase { + public sealed class MessageDescriptor : IndexedDescriptorBase { private readonly MessageDescriptor containingType; private readonly IList nestedTypes; diff --git a/csharp/ProtocolBuffers/Descriptors/MethodDescriptor.cs b/csharp/ProtocolBuffers/Descriptors/MethodDescriptor.cs index 4b4dc707..13e6d141 100644 --- a/csharp/ProtocolBuffers/Descriptors/MethodDescriptor.cs +++ b/csharp/ProtocolBuffers/Descriptors/MethodDescriptor.cs @@ -1,10 +1,25 @@ -using Google.ProtocolBuffers.DescriptorProtos; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using Google.ProtocolBuffers.DescriptorProtos; namespace Google.ProtocolBuffers.Descriptors { /// /// Describes a single method in a service. /// - public class MethodDescriptor : IndexedDescriptorBase { + public sealed class MethodDescriptor : IndexedDescriptorBase { private readonly ServiceDescriptor service; private MessageDescriptor inputType; diff --git a/csharp/ProtocolBuffers/Descriptors/PackageDescriptor.cs b/csharp/ProtocolBuffers/Descriptors/PackageDescriptor.cs index acef6200..9884c4a6 100644 --- a/csharp/ProtocolBuffers/Descriptors/PackageDescriptor.cs +++ b/csharp/ProtocolBuffers/Descriptors/PackageDescriptor.cs @@ -3,17 +3,12 @@ using System.Collections.Generic; using System.Text; namespace Google.ProtocolBuffers.Descriptors { - /* - * Represents a package in the symbol table. We use PackageDescriptors - * just as placeholders so that someone cannot define, say, a message type - * that has the same name as an existing package. - */ - /// - /// Represents a package in the symbol table. We use PackageDescriptors - /// just as placeholders so that someone cannot define, say, a message type - /// that has the same name as an existing package. - /// - internal class PackageDescriptor : IDescriptor { + /// + /// Represents a package in the symbol table. We use PackageDescriptors + /// just as placeholders so that someone cannot define, say, a message type + /// that has the same name as an existing package. + /// + internal sealed class PackageDescriptor : IDescriptor { private readonly string name; private readonly string fullName; diff --git a/csharp/ProtocolBuffers/Descriptors/ServiceDescriptor.cs b/csharp/ProtocolBuffers/Descriptors/ServiceDescriptor.cs index 67ef0418..cb152637 100644 --- a/csharp/ProtocolBuffers/Descriptors/ServiceDescriptor.cs +++ b/csharp/ProtocolBuffers/Descriptors/ServiceDescriptor.cs @@ -1,6 +1,20 @@ -using System; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System; using System.Collections.Generic; -using System.Text; using Google.ProtocolBuffers.DescriptorProtos; namespace Google.ProtocolBuffers.Descriptors { @@ -8,7 +22,7 @@ namespace Google.ProtocolBuffers.Descriptors { /// /// Describes a service type. /// - public class ServiceDescriptor : IndexedDescriptorBase { + public sealed class ServiceDescriptor : IndexedDescriptorBase { private readonly IList methods; diff --git a/csharp/ProtocolBuffers/DynamicMessage.cs b/csharp/ProtocolBuffers/DynamicMessage.cs index 224b8dee..970a8c5e 100644 --- a/csharp/ProtocolBuffers/DynamicMessage.cs +++ b/csharp/ProtocolBuffers/DynamicMessage.cs @@ -1,7 +1,21 @@ -using System; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System; using System.Collections.Generic; using System.IO; -using System.Text; using Google.ProtocolBuffers.Descriptors; namespace Google.ProtocolBuffers { @@ -9,7 +23,7 @@ namespace Google.ProtocolBuffers { /// /// An implementation of IMessage that can represent arbitrary types, given a MessageaDescriptor. /// - public class DynamicMessage : AbstractMessage { + public sealed class DynamicMessage : AbstractMessage { private readonly MessageDescriptor type; private readonly FieldSet fields; @@ -226,7 +240,10 @@ namespace Google.ProtocolBuffers { } } - public class Builder : AbstractBuilder { + /// + /// Builder for dynamic messages. Instances are created with DynamicMessage.CreateBuilder. + /// + public sealed class Builder : AbstractBuilder { private readonly MessageDescriptor type; private FieldSet fields; private UnknownFieldSet unknownFields; diff --git a/csharp/ProtocolBuffers/ExtendableBuilder.cs b/csharp/ProtocolBuffers/ExtendableBuilder.cs index 3cc43944..f05743ec 100644 --- a/csharp/ProtocolBuffers/ExtendableBuilder.cs +++ b/csharp/ProtocolBuffers/ExtendableBuilder.cs @@ -1,6 +1,19 @@ -using System; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. using System.Collections.Generic; -using System.Text; using Google.ProtocolBuffers.Descriptors; namespace Google.ProtocolBuffers { diff --git a/csharp/ProtocolBuffers/ExtendableMessage.cs b/csharp/ProtocolBuffers/ExtendableMessage.cs index 84a69b53..c3b37dd5 100644 --- a/csharp/ProtocolBuffers/ExtendableMessage.cs +++ b/csharp/ProtocolBuffers/ExtendableMessage.cs @@ -1,8 +1,22 @@ -using System; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System; using System.Collections.Generic; -using System.Text; -using Google.ProtocolBuffers.Descriptors; using Google.ProtocolBuffers.Collections; +using Google.ProtocolBuffers.Descriptors; namespace Google.ProtocolBuffers { public abstract class ExtendableMessage : GeneratedMessage diff --git a/csharp/ProtocolBuffers/ExtensionInfo.cs b/csharp/ProtocolBuffers/ExtensionInfo.cs index a4936104..00cf0d00 100644 --- a/csharp/ProtocolBuffers/ExtensionInfo.cs +++ b/csharp/ProtocolBuffers/ExtensionInfo.cs @@ -1,3 +1,18 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. using Google.ProtocolBuffers.Descriptors; namespace Google.ProtocolBuffers diff --git a/csharp/ProtocolBuffers/FieldAccess/Delegates.cs b/csharp/ProtocolBuffers/FieldAccess/Delegates.cs deleted file mode 100644 index 000ae250..00000000 --- a/csharp/ProtocolBuffers/FieldAccess/Delegates.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Google.ProtocolBuffers.FieldAccess { - /// - /// Declarations of delegate types used for field access. Can't - /// use Func and Action (other than one parameter) as we can't guarantee .NET 3.5. - /// - internal delegate bool HasFunction(TMessage message); -} diff --git a/csharp/ProtocolBuffers/FieldAccess/FieldAccessorTable.cs b/csharp/ProtocolBuffers/FieldAccess/FieldAccessorTable.cs index 231b974c..24113b41 100644 --- a/csharp/ProtocolBuffers/FieldAccess/FieldAccessorTable.cs +++ b/csharp/ProtocolBuffers/FieldAccess/FieldAccessorTable.cs @@ -1,4 +1,19 @@ -using System; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System; using Google.ProtocolBuffers.Descriptors; namespace Google.ProtocolBuffers.FieldAccess { @@ -8,7 +23,7 @@ namespace Google.ProtocolBuffers.FieldAccess { /// create appropriate instances in the .proto file description class. /// TODO(jonskeet): See if we can hide it somewhere... /// - public class FieldAccessorTable { + public sealed class FieldAccessorTable { readonly IFieldAccessor[] accessors; diff --git a/csharp/ProtocolBuffers/FieldAccess/IFieldAccessor.cs b/csharp/ProtocolBuffers/FieldAccess/IFieldAccessor.cs index 76b34021..3e47fdc6 100644 --- a/csharp/ProtocolBuffers/FieldAccess/IFieldAccessor.cs +++ b/csharp/ProtocolBuffers/FieldAccess/IFieldAccessor.cs @@ -1,4 +1,20 @@ -namespace Google.ProtocolBuffers.FieldAccess { +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +namespace Google.ProtocolBuffers.FieldAccess { /// /// Allows fields to be reflectively accessed in a smart manner. diff --git a/csharp/ProtocolBuffers/FieldAccess/RepeatedMessageAccessor.cs b/csharp/ProtocolBuffers/FieldAccess/RepeatedMessageAccessor.cs index 92cc2c94..d0c53dcc 100644 --- a/csharp/ProtocolBuffers/FieldAccess/RepeatedMessageAccessor.cs +++ b/csharp/ProtocolBuffers/FieldAccess/RepeatedMessageAccessor.cs @@ -1,6 +1,20 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. using System; using System.Reflection; -using Google.ProtocolBuffers.Descriptors; namespace Google.ProtocolBuffers.FieldAccess { diff --git a/csharp/ProtocolBuffers/FieldAccess/RepeatedPrimitiveAccessor.cs b/csharp/ProtocolBuffers/FieldAccess/RepeatedPrimitiveAccessor.cs index 15ea6253..ad44991d 100644 --- a/csharp/ProtocolBuffers/FieldAccess/RepeatedPrimitiveAccessor.cs +++ b/csharp/ProtocolBuffers/FieldAccess/RepeatedPrimitiveAccessor.cs @@ -1,7 +1,21 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. using System; using System.Collections; using System.Reflection; -using Google.ProtocolBuffers.Descriptors; namespace Google.ProtocolBuffers.FieldAccess { /// diff --git a/csharp/ProtocolBuffers/FieldAccess/SingleEnumAccessor.cs b/csharp/ProtocolBuffers/FieldAccess/SingleEnumAccessor.cs index 0e9e68f8..7db6b182 100644 --- a/csharp/ProtocolBuffers/FieldAccess/SingleEnumAccessor.cs +++ b/csharp/ProtocolBuffers/FieldAccess/SingleEnumAccessor.cs @@ -1,5 +1,19 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. using System; -using System.Collections.Generic; using Google.ProtocolBuffers.Descriptors; namespace Google.ProtocolBuffers.FieldAccess { diff --git a/csharp/ProtocolBuffers/FieldAccess/SingleMessageAccessor.cs b/csharp/ProtocolBuffers/FieldAccess/SingleMessageAccessor.cs index 8bdf95d1..7945f461 100644 --- a/csharp/ProtocolBuffers/FieldAccess/SingleMessageAccessor.cs +++ b/csharp/ProtocolBuffers/FieldAccess/SingleMessageAccessor.cs @@ -1,6 +1,20 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. using System; using System.Reflection; -using Google.ProtocolBuffers.Descriptors; namespace Google.ProtocolBuffers.FieldAccess { /// diff --git a/csharp/ProtocolBuffers/FieldAccess/SinglePrimitiveAccessor.cs b/csharp/ProtocolBuffers/FieldAccess/SinglePrimitiveAccessor.cs index 4878e79b..efa77047 100644 --- a/csharp/ProtocolBuffers/FieldAccess/SinglePrimitiveAccessor.cs +++ b/csharp/ProtocolBuffers/FieldAccess/SinglePrimitiveAccessor.cs @@ -1,6 +1,20 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. using System; using System.Reflection; -using Google.ProtocolBuffers.Descriptors; namespace Google.ProtocolBuffers.FieldAccess { /// diff --git a/csharp/ProtocolBuffers/FieldSet.cs b/csharp/ProtocolBuffers/FieldSet.cs index 6e563e7b..fd264646 100644 --- a/csharp/ProtocolBuffers/FieldSet.cs +++ b/csharp/ProtocolBuffers/FieldSet.cs @@ -1,9 +1,23 @@ -using System; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System; using System.Collections; using System.Collections.Generic; -using System.Text; -using Google.ProtocolBuffers.Descriptors; using Google.ProtocolBuffers.Collections; +using Google.ProtocolBuffers.Descriptors; namespace Google.ProtocolBuffers { /// @@ -20,7 +34,7 @@ namespace Google.ProtocolBuffers { /// /// All repeated fields are stored as IList[object] even /// - internal class FieldSet { + internal sealed class FieldSet { private static readonly FieldSet defaultInstance = new FieldSet(new Dictionary()).MakeImmutable(); diff --git a/csharp/ProtocolBuffers/GeneratedBuilder.cs b/csharp/ProtocolBuffers/GeneratedBuilder.cs index 72ecfd40..35f22fc3 100644 --- a/csharp/ProtocolBuffers/GeneratedBuilder.cs +++ b/csharp/ProtocolBuffers/GeneratedBuilder.cs @@ -1,10 +1,22 @@ -using System; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System; using System.Collections; using System.Collections.Generic; -using System.Text; -using Google.ProtocolBuffers.Collections; using Google.ProtocolBuffers.Descriptors; -using System.IO; using Google.ProtocolBuffers.FieldAccess; namespace Google.ProtocolBuffers { diff --git a/csharp/ProtocolBuffers/GeneratedExtensionBase.cs b/csharp/ProtocolBuffers/GeneratedExtensionBase.cs index 6a5bc392..5d8e2845 100644 --- a/csharp/ProtocolBuffers/GeneratedExtensionBase.cs +++ b/csharp/ProtocolBuffers/GeneratedExtensionBase.cs @@ -1,8 +1,22 @@ -using System; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System; using System.Collections; using System.Collections.Generic; using System.Reflection; -using System.Text; using Google.ProtocolBuffers.Descriptors; namespace Google.ProtocolBuffers { diff --git a/csharp/ProtocolBuffers/GeneratedMessage.cs b/csharp/ProtocolBuffers/GeneratedMessage.cs index 0bdf0e3f..e1de84e1 100644 --- a/csharp/ProtocolBuffers/GeneratedMessage.cs +++ b/csharp/ProtocolBuffers/GeneratedMessage.cs @@ -1,7 +1,20 @@ -using System; -using System.Collections; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System; using System.Collections.Generic; -using System.IO; using Google.ProtocolBuffers.Collections; using Google.ProtocolBuffers.Descriptors; using Google.ProtocolBuffers.FieldAccess; diff --git a/csharp/ProtocolBuffers/GeneratedRepeatException.cs b/csharp/ProtocolBuffers/GeneratedRepeatException.cs index ccf8a50e..ae711bd2 100644 --- a/csharp/ProtocolBuffers/GeneratedRepeatException.cs +++ b/csharp/ProtocolBuffers/GeneratedRepeatException.cs @@ -1,4 +1,19 @@ -using System; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System; using System.Collections.Generic; using Google.ProtocolBuffers.Descriptors; using System.Collections; @@ -7,7 +22,7 @@ namespace Google.ProtocolBuffers { /// /// Class used to represent repeat extensions in generated classes. /// - public class GeneratedRepeatExtension : GeneratedExtensionBase> { + public sealed class GeneratedRepeatExtension : GeneratedExtensionBase> { private GeneratedRepeatExtension(FieldDescriptor field) : base(field, typeof(TExtensionElement)) { } diff --git a/csharp/ProtocolBuffers/GeneratedSingleExtension.cs b/csharp/ProtocolBuffers/GeneratedSingleExtension.cs index d9a0adcf..55450f21 100644 --- a/csharp/ProtocolBuffers/GeneratedSingleExtension.cs +++ b/csharp/ProtocolBuffers/GeneratedSingleExtension.cs @@ -1,4 +1,19 @@ -using System; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System; using Google.ProtocolBuffers.Descriptors; namespace Google.ProtocolBuffers { @@ -6,7 +21,7 @@ namespace Google.ProtocolBuffers { /// /// Generated extension for a singular field. /// - public class GeneratedSingleExtension : GeneratedExtensionBase { + public sealed class GeneratedSingleExtension : GeneratedExtensionBase { internal GeneratedSingleExtension(FieldDescriptor descriptor) : base(descriptor, typeof(TExtension)) { } diff --git a/csharp/ProtocolBuffers/IRpcChannel.cs b/csharp/ProtocolBuffers/IRpcChannel.cs index 28b321c6..59427835 100644 --- a/csharp/ProtocolBuffers/IRpcChannel.cs +++ b/csharp/ProtocolBuffers/IRpcChannel.cs @@ -1,4 +1,19 @@ -using System; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System; using Google.ProtocolBuffers.Descriptors; namespace Google.ProtocolBuffers { diff --git a/csharp/ProtocolBuffers/IRpcController.cs b/csharp/ProtocolBuffers/IRpcController.cs index f4e29ad4..88cef2db 100644 --- a/csharp/ProtocolBuffers/IRpcController.cs +++ b/csharp/ProtocolBuffers/IRpcController.cs @@ -1,4 +1,19 @@ -using System; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System; namespace Google.ProtocolBuffers { /// diff --git a/csharp/ProtocolBuffers/IService.cs b/csharp/ProtocolBuffers/IService.cs index 1405fbb9..4bf1e352 100644 --- a/csharp/ProtocolBuffers/IService.cs +++ b/csharp/ProtocolBuffers/IService.cs @@ -1,6 +1,19 @@ -using System; -using System.Collections.Generic; -using System.Text; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System; using Google.ProtocolBuffers.Descriptors; namespace Google.ProtocolBuffers { diff --git a/csharp/ProtocolBuffers/InvalidProtocolBufferException.cs b/csharp/ProtocolBuffers/InvalidProtocolBufferException.cs index 48e86cc3..334a416a 100644 --- a/csharp/ProtocolBuffers/InvalidProtocolBufferException.cs +++ b/csharp/ProtocolBuffers/InvalidProtocolBufferException.cs @@ -19,10 +19,8 @@ namespace Google.ProtocolBuffers { /// /// Thrown when a protocol message being parsed is invalid in some way, /// e.g. it contains a malformed varint or a negative byte length. - /// - /// TODO(jonskeet): Make the methods throw directly? Rename them? /// - public class InvalidProtocolBufferException : IOException { + public sealed class InvalidProtocolBufferException : IOException { internal InvalidProtocolBufferException(string message) : base(message) { @@ -37,7 +35,6 @@ namespace Google.ProtocolBuffers { "misreported its own length."); } - /// TODO(jonskeet): Make this internal again and use InternalVisibleTo? internal static InvalidProtocolBufferException NegativeSize() { return new InvalidProtocolBufferException( "CodedInputStream encountered an embedded string or message " + diff --git a/csharp/ProtocolBuffers/Properties/AssemblyInfo.cs b/csharp/ProtocolBuffers/Properties/AssemblyInfo.cs index 4961ef30..1219e538 100644 --- a/csharp/ProtocolBuffers/Properties/AssemblyInfo.cs +++ b/csharp/ProtocolBuffers/Properties/AssemblyInfo.cs @@ -1,5 +1,19 @@ -using System.Reflection; -using System.Runtime.CompilerServices; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/csharp/ProtocolBuffers/ProtocolBuffers.csproj b/csharp/ProtocolBuffers/ProtocolBuffers.csproj index cf490a73..58760c70 100644 --- a/csharp/ProtocolBuffers/ProtocolBuffers.csproj +++ b/csharp/ProtocolBuffers/ProtocolBuffers.csproj @@ -77,7 +77,6 @@ - diff --git a/csharp/ProtocolBuffers/RpcUtil.cs b/csharp/ProtocolBuffers/RpcUtil.cs index 92675c02..bf383b45 100644 --- a/csharp/ProtocolBuffers/RpcUtil.cs +++ b/csharp/ProtocolBuffers/RpcUtil.cs @@ -1,8 +1,24 @@ -using System; -using System.Collections.Generic; -using System.Text; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System; namespace Google.ProtocolBuffers { + /// + /// Grab-bag of utility functions useful when dealing with RPCs. + /// public static class RpcUtil { /// diff --git a/csharp/ProtocolBuffers/TextFormat.cs b/csharp/ProtocolBuffers/TextFormat.cs index 3b717df4..21d89ae8 100644 --- a/csharp/ProtocolBuffers/TextFormat.cs +++ b/csharp/ProtocolBuffers/TextFormat.cs @@ -1,4 +1,19 @@ -using System; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System; using System.Collections.Generic; using System.Globalization; using System.IO; diff --git a/csharp/ProtocolBuffers/TextGenerator.cs b/csharp/ProtocolBuffers/TextGenerator.cs index b5837504..24961570 100644 --- a/csharp/ProtocolBuffers/TextGenerator.cs +++ b/csharp/ProtocolBuffers/TextGenerator.cs @@ -1,5 +1,19 @@ -using System; -using System.Collections.Generic; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System; using System.IO; using System.Text; @@ -8,7 +22,7 @@ namespace Google.ProtocolBuffers { /// /// Helper class to control indentation /// - internal class TextGenerator { + internal sealed class TextGenerator { /// /// Writer to write formatted text to. diff --git a/csharp/ProtocolBuffers/TextTokenizer.cs b/csharp/ProtocolBuffers/TextTokenizer.cs index a3585ab0..81c83c7d 100644 --- a/csharp/ProtocolBuffers/TextTokenizer.cs +++ b/csharp/ProtocolBuffers/TextTokenizer.cs @@ -1,4 +1,19 @@ -using System; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System; using System.Globalization; using System.Text.RegularExpressions; diff --git a/csharp/ProtocolBuffers/UninitializedMessageException.cs b/csharp/ProtocolBuffers/UninitializedMessageException.cs index 01cdd2f1..4a117403 100644 --- a/csharp/ProtocolBuffers/UninitializedMessageException.cs +++ b/csharp/ProtocolBuffers/UninitializedMessageException.cs @@ -21,7 +21,7 @@ using Google.ProtocolBuffers.Collections; using Google.ProtocolBuffers.Descriptors; namespace Google.ProtocolBuffers { - public class UninitializedMessageException : Exception { + public sealed class UninitializedMessageException : Exception { private readonly IList missingFields; diff --git a/csharp/ProtocolBuffers/UnknownField.cs b/csharp/ProtocolBuffers/UnknownField.cs index b6a1d270..76afe680 100644 --- a/csharp/ProtocolBuffers/UnknownField.cs +++ b/csharp/ProtocolBuffers/UnknownField.cs @@ -1,4 +1,19 @@ -using System.Collections.Generic; +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. +// http://code.google.com/p/protobuf/ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System.Collections.Generic; using System.Collections.ObjectModel; using Google.ProtocolBuffers.Collections; @@ -169,7 +184,7 @@ namespace Google.ProtocolBuffers { /// /// Used to build instances of UnknownField. /// - public class Builder { + public sealed class Builder { private List varintList; private List fixed32List; diff --git a/csharp/ProtocolBuffers/UnknownFieldSet.cs b/csharp/ProtocolBuffers/UnknownFieldSet.cs index 87297d85..a7d19945 100644 --- a/csharp/ProtocolBuffers/UnknownFieldSet.cs +++ b/csharp/ProtocolBuffers/UnknownFieldSet.cs @@ -19,7 +19,18 @@ using System.IO; using Google.ProtocolBuffers.Collections; namespace Google.ProtocolBuffers { - public class UnknownFieldSet { + /// + /// Used to keep track of fields which were seen when parsing a protocol message + /// but whose field numbers or types are unrecognized. This most frequently + /// occurs when new fields are added to a message type and then messages containing + /// those fields are read by old software that was built before the new types were + /// added. + /// + /// Every message contains an UnknownFieldSet. + /// + /// Most users will never need to use this class directly. + /// + public sealed class UnknownFieldSet { private static readonly UnknownFieldSet defaultInstance = new UnknownFieldSet(new Dictionary()); @@ -165,7 +176,6 @@ namespace Google.ProtocolBuffers { } } - /// /// Parses an UnknownFieldSet from the given input. /// @@ -194,7 +204,10 @@ namespace Google.ProtocolBuffers { return CreateBuilder().MergeFrom(input).Build(); } - public class Builder + /// + /// Builder for UnknownFieldSets. + /// + public sealed class Builder { /// /// Mapping from number to field. Note that by using a SortedList we ensure diff --git a/csharp/ProtocolBuffers/WireFormat.cs b/csharp/ProtocolBuffers/WireFormat.cs index 2166db48..6def39e4 100644 --- a/csharp/ProtocolBuffers/WireFormat.cs +++ b/csharp/ProtocolBuffers/WireFormat.cs @@ -28,7 +28,7 @@ namespace Google.ProtocolBuffers { /// the Protocol Buffer wire format. /// /// - public class WireFormat { + public static class WireFormat { public enum WireType : uint { Varint = 0, Fixed64 = 1, @@ -38,13 +38,13 @@ namespace Google.ProtocolBuffers { Fixed32 = 5 } - internal class MessageSetField { + internal static class MessageSetField { internal const int Item = 1; internal const int TypeID = 2; internal const int Message = 3; } - internal class MessageSetTag { + internal static class MessageSetTag { internal static readonly uint ItemStart = MakeTag(MessageSetField.Item, WireType.StartGroup); internal static readonly uint ItemEnd = MakeTag(MessageSetField.Item, WireType.EndGroup); internal static readonly uint TypeID = MakeTag(MessageSetField.TypeID, WireType.Varint); -- cgit v1.2.3