summaryrefslogtreecommitdiff
path: root/cpp/rubygen/cppgen.rb
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2007-09-10 18:37:36 +0000
committerGordon Sim <gsim@apache.org>2007-09-10 18:37:36 +0000
commitfbda2ac45519f7108fc48f483d76d1487c2b3544 (patch)
tree08a3fc85a9730b42892f3075e18855421b378299 /cpp/rubygen/cppgen.rb
parent002b38eecc23c7e9be56fbab0b643829acbb4bb8 (diff)
downloadqpid-python-fbda2ac45519f7108fc48f483d76d1487c2b3544.tar.gz
Support for keyword args in session interface
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@574323 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/rubygen/cppgen.rb')
-rwxr-xr-xcpp/rubygen/cppgen.rb17
1 files changed, 11 insertions, 6 deletions
diff --git a/cpp/rubygen/cppgen.rb b/cpp/rubygen/cppgen.rb
index c6f06e80c7..0de448869d 100755
--- a/cpp/rubygen/cppgen.rb
+++ b/cpp/rubygen/cppgen.rb
@@ -68,6 +68,7 @@ class CppType
def retcref() @ret="const #{name}&"; self; end
def passcref() @param="const #{name}&"; self; end
def code(str) @code=str; self; end
+ def defval(str) @defval=str; self; end
def encode(value, buffer)
@code ? "#{buffer}.put#{@code}(#{value});" : "#{value}.encode(#{buffer});"
@@ -85,6 +86,10 @@ class CppType
end
end
+ def default_value()
+ return @defval ||= "#{name}()"
+ end
+
def to_s() name; end;
end
@@ -107,12 +112,12 @@ end
class AmqpDomain
@@typemap = {
- "bit"=> CppType.new("bool").code("Octet"),
- "octet"=>CppType.new("uint8_t").code("Octet"),
- "short"=>CppType.new("uint16_t").code("Short"),
- "long"=>CppType.new("uint32_t").code("Long"),
- "longlong"=>CppType.new("uint64_t").code("LongLong"),
- "timestamp"=>CppType.new("uint64_t").code("LongLong"),
+ "bit"=> CppType.new("bool").code("Octet").defval("false"),
+ "octet"=>CppType.new("uint8_t").code("Octet").defval("0"),
+ "short"=>CppType.new("uint16_t").code("Short").defval("0"),
+ "long"=>CppType.new("uint32_t").code("Long").defval("0"),
+ "longlong"=>CppType.new("uint64_t").code("LongLong").defval("0"),
+ "timestamp"=>CppType.new("uint64_t").code("LongLong").defval("0"),
"longstr"=>CppType.new("string").passcref.retcref.code("LongString"),
"shortstr"=>CppType.new("string").passcref.retcref.code("ShortString"),
"table"=>CppType.new("FieldTable").passcref.retcref.code("FieldTable"),