diff options
author | Jon Skeet <skeet@pobox.com> | 2008-08-14 20:35:32 +0100 |
---|---|---|
committer | Jon Skeet <skeet@pobox.com> | 2008-08-14 20:35:32 +0100 |
commit | 48ce28bf2fed8edde98f14c79807b4f4411cca6c (patch) | |
tree | eb68459cdde93fa1be14517650e7c0d0bba3a6c3 | |
parent | 5923b37223a013139ff0b01558eb37a206c33fd1 (diff) | |
download | protobuf-48ce28bf2fed8edde98f14c79807b4f4411cca6c.tar.gz protobuf-48ce28bf2fed8edde98f14c79807b4f4411cca6c.tar.bz2 protobuf-48ce28bf2fed8edde98f14c79807b4f4411cca6c.zip |
Copyright fixes, a bit of documentation, and removed unnecessary using directives.
70 files changed, 1039 insertions, 181 deletions
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 { /// <summary> 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 { /// <summary> 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. /// </summary> - 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. /// </summary> - 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 { + /// <summary> + /// Utility non-generic class for calling into Lists{T} using type inference. + /// </summary> public static class Lists { + /// <summary> + /// Returns a read-only view of the specified list. + /// </summary> public static IList<T> AsReadOnly<T>(IList<T> list) { return Lists<T>.AsReadOnly(list); } } /// <summary> - /// Utilities class for dealing with lists. + /// Utility class for dealing with lists. /// </summary> public static class Lists<T> { 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 { /// <summary> /// Read-only wrapper around another dictionary. /// </summary> - public class ReadOnlyDictionary<TKey, TValue> : IDictionary<TKey, TValue> { + public sealed class ReadOnlyDictionary<TKey, TValue> : IDictionary<TKey, TValue> { readonly IDictionary<TKey, TValue> wrapped; public ReadOnlyDictionary(IDictionary<TKey, TValue> 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 { /// <summary> /// Interface implemented by all DescriptorProtos. The generator doesn't @@ -13,6 +28,9 @@ /// </summary> string Name { get; } + /// <summary> + /// The options for this descriptor. + /// </summary> 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 { /// <summary> 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 { /// <summary> /// Contains lookup tables containing all the descriptors defined in a particular file. /// </summary> - internal class DescriptorPool { + internal sealed class DescriptorPool { private readonly IDictionary<string, IDescriptor> descriptorsByName = new Dictionary<string, IDescriptor>(); 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 { /// <summary> /// Internal class containing utility methods when working with descriptors. /// </summary> - static class DescriptorUtil { + internal static class DescriptorUtil { /// <summary> /// 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 { + /// <summary> + /// Thrown when building descriptors fails because the source DescriptorProtos + /// are not valid. + /// </summary> + 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<EnumDescriptorProto, EnumOptions> { + /// <summary> + /// Descriptor for an enum type in a .proto file. + /// </summary> + public sealed class EnumDescriptor : IndexedDescriptorBase<EnumDescriptorProto, EnumOptions> { private readonly MessageDescriptor containingType; private readonly IList<EnumValueDescriptor> 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 { /// <summary> 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<EnumValueDescriptorProto, EnumValueOptions> { + + /// <summary> + /// Descriptor for a single enum value within an enum in a .proto file. + /// </summary> + public sealed class EnumValueDescriptor : IndexedDescriptorBase<EnumValueDescriptorProto, EnumValueOptions> { 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<FieldDescriptorProto, FieldOptions>, IComparable<FieldDescriptor> { + + /// <summary> + /// Descriptor for a field or extension within a message in a .proto file. + /// </summary> + public sealed class FieldDescriptor : IndexedDescriptorBase<FieldDescriptorProto, FieldOptions>, IComparable<FieldDescriptor> { 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. /// </summary> [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 { /// <summary> /// 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 { /// <summary> @@ -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. /// </summary> - public class FileDescriptor : IDescriptor<FileDescriptorProto> { + public sealed class FileDescriptor : IDescriptor<FileDescriptorProto> { private readonly FileDescriptorProto proto; private readonly IList<MessageDescriptor> 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 { /// <summary> 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 { /// <summary> /// Describes a message type. /// </summary> - public class MessageDescriptor : IndexedDescriptorBase<DescriptorProto, MessageOptions> { + public sealed class MessageDescriptor : IndexedDescriptorBase<DescriptorProto, MessageOptions> { private readonly MessageDescriptor containingType; private readonly IList<MessageDescriptor> 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 { /// <summary> /// Describes a single method in a service. /// </summary> - public class MethodDescriptor : IndexedDescriptorBase<MethodDescriptorProto, MethodOptions> { + public sealed class MethodDescriptor : IndexedDescriptorBase<MethodDescriptorProto, MethodOptions> { 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. - */ - /// <summary> - /// 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. - /// </summary> - internal class PackageDescriptor : IDescriptor<IMessage> { + /// <summary> + /// 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. + /// </summary> + internal sealed class PackageDescriptor : IDescriptor<IMessage> { 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 { /// <summary> /// Describes a service type. /// </summary> - public class ServiceDescriptor : IndexedDescriptorBase<ServiceDescriptorProto, ServiceOptions> { + public sealed class ServiceDescriptor : IndexedDescriptorBase<ServiceDescriptorProto, ServiceOptions> { private readonly IList<MethodDescriptor> 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 { /// <summary> /// An implementation of IMessage that can represent arbitrary types, given a MessageaDescriptor. /// </summary> - public class DynamicMessage : AbstractMessage<DynamicMessage, DynamicMessage.Builder> { + public sealed class DynamicMessage : AbstractMessage<DynamicMessage, DynamicMessage.Builder> { private readonly MessageDescriptor type; private readonly FieldSet fields; @@ -226,7 +240,10 @@ namespace Google.ProtocolBuffers { } } - public class Builder : AbstractBuilder<DynamicMessage, DynamicMessage.Builder> { + /// <summary> + /// Builder for dynamic messages. Instances are created with DynamicMessage.CreateBuilder. + /// </summary> + public sealed class Builder : AbstractBuilder<DynamicMessage, Builder> { 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<TMessage, TBuilder> : GeneratedMessage<TMessage, TBuilder> 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 { - /// <summary> - /// 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. - /// </summary> - internal delegate bool HasFunction<TMessage>(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... /// </summary> - 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 { /// <summary> /// 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 { /// <summary> 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 { /// <summary> 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 { /// <summary> 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 { /// <summary> @@ -20,7 +34,7 @@ namespace Google.ProtocolBuffers { /// /// All repeated fields are stored as IList[object] even /// </summary> - internal class FieldSet { + internal sealed class FieldSet { private static readonly FieldSet defaultInstance = new FieldSet(new Dictionary<FieldDescriptor, object>()).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 { /// <summary> /// Class used to represent repeat extensions in generated classes. /// </summary> - public class GeneratedRepeatExtension<TExtensionElement> : GeneratedExtensionBase<IList<TExtensionElement>> { + public sealed class GeneratedRepeatExtension<TExtensionElement> : GeneratedExtensionBase<IList<TExtensionElement>> { 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 { /// <summary> /// Generated extension for a singular field. /// </remarks> - public class GeneratedSingleExtension<TExtension> : GeneratedExtensionBase<TExtension> { + public sealed class GeneratedSingleExtension<TExtension> : GeneratedExtensionBase<TExtension> { 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 { /// <summary> 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 { /// <summary> /// 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? /// </summary> - 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 @@ <Compile Include="FieldAccess\SinglePrimitiveAccessor.cs" /> <Compile Include="FieldAccess\RepeatedPrimitiveAccessor.cs" /> <Compile Include="FieldAccess\RepeatedEnumAccessor.cs" /> - <Compile Include="FieldAccess\Delegates.cs" /> <Compile Include="FieldAccess\IFieldAccessor.cs" /> <Compile Include="FieldAccess\FieldAccessorTable.cs" /> <Compile Include="FieldAccess\RepeatedMessageAccessor.cs" /> 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 { + /// <summary> + /// Grab-bag of utility functions useful when dealing with RPCs. + /// </summary> public static class RpcUtil { /// <summary> 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 { /// <summary> /// Helper class to control indentation /// </summary> - internal class TextGenerator { + internal sealed class TextGenerator { /// <summary> /// 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<string> 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 { /// <summary> /// Used to build instances of UnknownField. /// </summary> - public class Builder { + public sealed class Builder { private List<ulong> varintList; private List<uint> 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 { + /// <summary> + /// 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. + /// </summary> + public sealed class UnknownFieldSet { private static readonly UnknownFieldSet defaultInstance = new UnknownFieldSet(new Dictionary<int, UnknownField>()); @@ -165,7 +176,6 @@ namespace Google.ProtocolBuffers { } } - /// <summary> /// Parses an UnknownFieldSet from the given input. /// </summary> @@ -194,7 +204,10 @@ namespace Google.ProtocolBuffers { return CreateBuilder().MergeFrom(input).Build(); } - public class Builder + /// <summary> + /// Builder for UnknownFieldSets. + /// </summary> + public sealed class Builder { /// <summary> /// 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. /// </para> /// </summary> - 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); |