Thrift: Added support for double type across all languages
Summary: Just for completeness cause I'm crazy. Let's never use these!
Notes: Also made thrift grammar support # style comments, so you can do this at the top of your files
#!/usr/local/bin/thrift --cpp
/**
* This is a thrift def file youc an invoke directly and gen code!
*/
blah
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664789 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/py/src/protocol/TBinaryProtocol.py b/lib/py/src/protocol/TBinaryProtocol.py
index 860f461..25f3218 100644
--- a/lib/py/src/protocol/TBinaryProtocol.py
+++ b/lib/py/src/protocol/TBinaryProtocol.py
@@ -73,6 +73,10 @@
buff = pack("!q", i64)
otrans.write(buff)
+ def writeDouble(self, otrans, dub):
+ buff = pack("!d", dub)
+ otrans.write(buff)
+
def writeString(self, otrans, str):
self.writeI32(otrans, len(str))
otrans.write(str)
@@ -153,6 +157,11 @@
val, = unpack('!q', buff)
return val
+ def readDouble(self, itrans):
+ buff = itrans.readAll(8)
+ val, = unpack('!d', buff)
+ return val
+
def readString(self, itrans):
len = self.readI32(itrans)
str = itrans.readAll(len)