summaryrefslogtreecommitdiff
path: root/qpid/cpp/rubygen/cppgen.rb
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2007-08-21 15:51:41 +0000
committerGordon Sim <gsim@apache.org>2007-08-21 15:51:41 +0000
commit849e954106e5cd789c9d57ccbdc32349762fdc5a (patch)
treefd24cf69d104437f17e203c2cd512cbaeb865d19 /qpid/cpp/rubygen/cppgen.rb
parent87731c6669fd153ba20e889f32da9283b945fa90 (diff)
downloadqpid-python-849e954106e5cd789c9d57ccbdc32349762fdc5a.tar.gz
Refresh of transitional xml to more closely reflect latest specification
Initial execution-result support (not yet handled on c++ client) Generation is now all done through the ruby code (it is a little slower at present I'm afraid, will try to speed it up over the next weeks) git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@568174 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/rubygen/cppgen.rb')
-rwxr-xr-xqpid/cpp/rubygen/cppgen.rb31
1 files changed, 30 insertions, 1 deletions
diff --git a/qpid/cpp/rubygen/cppgen.rb b/qpid/cpp/rubygen/cppgen.rb
index a3314c7e11..109005e743 100755
--- a/qpid/cpp/rubygen/cppgen.rb
+++ b/qpid/cpp/rubygen/cppgen.rb
@@ -62,9 +62,11 @@ end
# Additional methods for AmqpField.
class AmqpField
def cppname() @cache_cppname ||= name.lcaps.cppsafe; end
- def cpptype() @cache_cpptype ||= amqp_root.param_type(field_type); end
+ def cpptype() @cache_cpptype ||= defined_as_struct ? "const " + field_type.caps + "&" : amqp_root.param_type(field_type); end
+ def cpp_member_type() @cache_cpp_member_type ||= defined_as_struct ? field_type.caps : amqp_root.member_type(field_type); end
def cppret_type() @cache_cpptype ||= amqp_root.return_type(field_type); end
def type_name () @type_name ||= cpptype+" "+cppname; end
+ def bit?() field_type == "bit" end
end
# Additional methods for AmqpMethod
@@ -82,6 +84,32 @@ class AmqpClass
end
end
+class AmqpStruct
+ def cppname()
+ @cache_cppname ||= cppname_impl()
+ end
+
+private
+
+ def cppname_impl()
+ #The name of the struct comes from the context it appears in:
+ #structs defined in a domain get their name from the domain
+ #element, structs defined in a result element get their name by
+ #appending 'Result' to the enclosing method name.
+ if (domain?)
+ parent.attributes["name"].caps
+ else
+ if (result?)
+ method = parent.parent
+ method.parent.attributes["name"].caps + method.attributes["name"].caps + "Result"
+ else
+ raise "Bad struct context: expected struct to be child of <domain> or <result>"
+ end
+ end
+
+ end
+end
+
# Additional methos for AmqpRoot
class AmqpRoot
# FIXME aconway 2007-06-20: fix u_int types, should be uint
@@ -97,6 +125,7 @@ class AmqpRoot
"table"=>["FieldTable", "const FieldTable&", "const FieldTable&"],
"content"=>["Content", "const Content&", "const Content&"],
"rfc1982-long-set"=>["SequenceNumberSet", "const SequenceNumberSet&", "const SequenceNumberSet&"],
+ "long-struct"=>["string", "const string&"],
"uuid"=>["string", "const string&"] # FIXME should be: ["Uuid", "const Uuid&", "const Uuid&"]
}