summaryrefslogtreecommitdiff
path: root/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
commitbb2883b9f5cfad0e028a9849ed91e36418a2d0ff (patch)
tree555686e2e819a875048610d88c2cee8e336b3687 /cpp/rubygen/cppgen.rb
parent955d5ccb544ff4f56d35c40aa8934cbf4dfff14e (diff)
downloadqpid-python-bb2883b9f5cfad0e028a9849ed91e36418a2d0ff.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/qpid@568174 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/rubygen/cppgen.rb')
-rwxr-xr-xcpp/rubygen/cppgen.rb31
1 files changed, 30 insertions, 1 deletions
diff --git a/cpp/rubygen/cppgen.rb b/cpp/rubygen/cppgen.rb
index a3314c7e11..109005e743 100755
--- a/cpp/rubygen/cppgen.rb
+++ b/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&"]
}