aboutsummaryrefslogtreecommitdiff
path: root/src/ProtoGen/PrimitiveFieldGenerator.cs
diff options
context:
space:
mode:
authorcsharptest <roger@csharptest.net>2010-11-09 20:49:12 -0600
committercsharptest <roger@csharptest.net>2010-11-09 20:49:12 -0600
commit272cb8aee775de65e08b4ab17c485cd678d08266 (patch)
tree3489244ff5bd901592b535ea5ad9352096d1521f /src/ProtoGen/PrimitiveFieldGenerator.cs
parente49547735834485dd22842e1a82bc5ae4139b8a8 (diff)
downloadprotobuf-272cb8aee775de65e08b4ab17c485cd678d08266.tar.gz
protobuf-272cb8aee775de65e08b4ab17c485cd678d08266.tar.bz2
protobuf-272cb8aee775de65e08b4ab17c485cd678d08266.zip
Lite feature complete.
Diffstat (limited to 'src/ProtoGen/PrimitiveFieldGenerator.cs')
-rw-r--r--src/ProtoGen/PrimitiveFieldGenerator.cs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/ProtoGen/PrimitiveFieldGenerator.cs b/src/ProtoGen/PrimitiveFieldGenerator.cs
index ce3fd238..dbc203d0 100644
--- a/src/ProtoGen/PrimitiveFieldGenerator.cs
+++ b/src/ProtoGen/PrimitiveFieldGenerator.cs
@@ -103,5 +103,17 @@ namespace Google.ProtocolBuffers.ProtoGen {
CapitalizedTypeName, Number, PropertyName);
writer.WriteLine("}");
}
+
+ public override void WriteHash(TextGenerator writer) {
+ writer.WriteLine("if (has{0}) hash ^= {1}_.GetHashCode();", PropertyName, Name);
+ }
+
+ public override void WriteEquals(TextGenerator writer) {
+ writer.WriteLine("if (has{0} != other.has{0} || (has{0} && !{1}_.Equals(other.{1}_))) return false;", PropertyName, Name);
+ }
+
+ public override void WriteToString(TextGenerator writer) {
+ writer.WriteLine("PrintField(\"{0}\", has{1}, {2}_, writer);", Descriptor.Name, PropertyName, Name);
+ }
}
}