diff options
author | csharptest <roger@csharptest.net> | 2011-09-09 15:53:10 -0500 |
---|---|---|
committer | rogerk <devnull@localhost> | 2011-09-09 15:53:10 -0500 |
commit | 4a594cac938258c6fc5150a7b99530bed9df483e (patch) | |
tree | 12f285f82937a7651c1edc8b117da4cf6cd5800b /src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs | |
parent | 8f0dcf3df1548a1eff0bed54a9b992f55b8f72d5 (diff) | |
download | protobuf-4a594cac938258c6fc5150a7b99530bed9df483e.tar.gz protobuf-4a594cac938258c6fc5150a7b99530bed9df483e.tar.bz2 protobuf-4a594cac938258c6fc5150a7b99530bed9df483e.zip |
Implemented [Obsolete] attribute for deprecated fields
Diffstat (limited to 'src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs')
-rw-r--r-- | src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs b/src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs index 9e7f5f64..d499011c 100644 --- a/src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs +++ b/src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs @@ -52,17 +52,18 @@ namespace Google.ProtocolBuffers.ProtoGen writer.WriteLine("private int {0}MemoizedSerializedSize;", Name);
}
writer.WriteLine("private pbc::PopsicleList<{0}> {1}_ = new pbc::PopsicleList<{0}>();", TypeName, Name);
- AddClsComplianceCheck(writer);
+ AddPublicMemberAttributes(writer);
writer.WriteLine("public scg::IList<{0}> {1}List {{", TypeName, PropertyName);
writer.WriteLine(" get {{ return pbc::Lists.AsReadOnly({0}_); }}", Name);
writer.WriteLine("}");
// TODO(jonskeet): Redundant API calls? Possibly - include for portability though. Maybe create an option.
+ AddDeprecatedFlag(writer);
writer.WriteLine("public int {0}Count {{", PropertyName);
writer.WriteLine(" get {{ return {0}_.Count; }}", Name);
writer.WriteLine("}");
- AddClsComplianceCheck(writer);
+ AddPublicMemberAttributes(writer);
writer.WriteLine("public {0} Get{1}(int index) {{", TypeName, PropertyName);
writer.WriteLine(" return {0}_[index];", Name);
writer.WriteLine("}");
@@ -72,34 +73,36 @@ namespace Google.ProtocolBuffers.ProtoGen {
// Note: We can return the original list here, because we make it unmodifiable when we build
// We return it via IPopsicleList so that collection initializers work more pleasantly.
- AddClsComplianceCheck(writer);
+ AddPublicMemberAttributes(writer);
writer.WriteLine("public pbc::IPopsicleList<{0}> {1}List {{", TypeName, PropertyName);
writer.WriteLine(" get {{ return result.{0}_; }}", Name);
writer.WriteLine("}");
+ AddDeprecatedFlag(writer);
writer.WriteLine("public int {0}Count {{", PropertyName);
writer.WriteLine(" get {{ return result.{0}Count; }}", PropertyName);
writer.WriteLine("}");
- AddClsComplianceCheck(writer);
+ AddPublicMemberAttributes(writer);
writer.WriteLine("public {0} Get{1}(int index) {{", TypeName, PropertyName);
writer.WriteLine(" return result.Get{0}(index);", PropertyName);
writer.WriteLine("}");
- AddClsComplianceCheck(writer);
+ AddPublicMemberAttributes(writer);
writer.WriteLine("public Builder Set{0}(int index, {1} value) {{", PropertyName, TypeName);
AddNullCheck(writer);
writer.WriteLine(" result.{0}_[index] = value;", Name);
writer.WriteLine(" return this;");
writer.WriteLine("}");
- AddClsComplianceCheck(writer);
+ AddPublicMemberAttributes(writer);
writer.WriteLine("public Builder Add{0}({1} value) {{", PropertyName, TypeName);
AddNullCheck(writer);
writer.WriteLine(" result.{0}_.Add(value);", Name, TypeName);
writer.WriteLine(" return this;");
writer.WriteLine("}");
- AddClsComplianceCheck(writer);
+ AddPublicMemberAttributes(writer);
writer.WriteLine("public Builder AddRange{0}(scg::IEnumerable<{1}> values) {{", PropertyName, TypeName);
writer.WriteLine(" base.AddRange(values, result.{0}_);", Name);
writer.WriteLine(" return this;");
writer.WriteLine("}");
+ AddDeprecatedFlag(writer);
writer.WriteLine("public Builder Clear{0}() {{", PropertyName);
writer.WriteLine(" result.{0}_.Clear();", Name);
writer.WriteLine(" return this;");
|