diff options
author | csharptest <roger@csharptest.net> | 2010-11-09 20:49:12 -0600 |
---|---|---|
committer | csharptest <roger@csharptest.net> | 2010-11-09 20:49:12 -0600 |
commit | 272cb8aee775de65e08b4ab17c485cd678d08266 (patch) | |
tree | 3489244ff5bd901592b535ea5ad9352096d1521f /src/ProtoGen/RepeatedEnumFieldGenerator.cs | |
parent | e49547735834485dd22842e1a82bc5ae4139b8a8 (diff) | |
download | protobuf-272cb8aee775de65e08b4ab17c485cd678d08266.tar.gz protobuf-272cb8aee775de65e08b4ab17c485cd678d08266.tar.bz2 protobuf-272cb8aee775de65e08b4ab17c485cd678d08266.zip |
Lite feature complete.
Diffstat (limited to 'src/ProtoGen/RepeatedEnumFieldGenerator.cs')
-rw-r--r-- | src/ProtoGen/RepeatedEnumFieldGenerator.cs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/ProtoGen/RepeatedEnumFieldGenerator.cs b/src/ProtoGen/RepeatedEnumFieldGenerator.cs index e30a4c24..c500d38b 100644 --- a/src/ProtoGen/RepeatedEnumFieldGenerator.cs +++ b/src/ProtoGen/RepeatedEnumFieldGenerator.cs @@ -175,5 +175,20 @@ namespace Google.ProtocolBuffers.ProtoGen { writer.Outdent(); writer.WriteLine("}"); } + + public override void WriteHash(TextGenerator writer) { + writer.WriteLine("foreach({0} i in {1}_)", TypeName, Name); + writer.WriteLine(" hash ^= i.GetHashCode();"); + } + + public override void WriteEquals(TextGenerator writer) { + writer.WriteLine("if({0}_.Count != other.{0}_.Count) return false;", Name); + writer.WriteLine("for(int ix=0; ix < {0}_.Count; ix++)", Name); + writer.WriteLine(" if(!{0}_[ix].Equals(other.{0}_[ix])) return false;", Name); + } + + public override void WriteToString(TextGenerator writer) { + writer.WriteLine("PrintField(\"{0}\", {1}_, writer);", Descriptor.Name, Name); + } } } |