summaryrefslogtreecommitdiff
path: root/cpp/rubygen/cppgen.rb
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2008-02-29 22:07:40 +0000
committerAlan Conway <aconway@apache.org>2008-02-29 22:07:40 +0000
commit6dd59f62185ab8547cc1eec0a57731e0ab5a8645 (patch)
tree25539ade95b792d9e8228eb5b24d5a65340bc5d6 /cpp/rubygen/cppgen.rb
parent3fb6c758d2d7d7c1822e216e3c22db4630eb19e0 (diff)
downloadqpid-python-6dd59f62185ab8547cc1eec0a57731e0ab5a8645.tar.gz
Template visitors for amqp_0_10::Command, Control and Struct.
Serialization for all str/vbin types. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@632457 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/rubygen/cppgen.rb')
-rwxr-xr-xcpp/rubygen/cppgen.rb22
1 files changed, 15 insertions, 7 deletions
diff --git a/cpp/rubygen/cppgen.rb b/cpp/rubygen/cppgen.rb
index 5d2695c77a..df4ba49ca8 100755
--- a/cpp/rubygen/cppgen.rb
+++ b/cpp/rubygen/cppgen.rb
@@ -57,6 +57,7 @@ class String
def cppsafe() CppMangle.include?(self) ? self+"_" : self; end
def amqp2cpp()
+ throw 'Invalid "array".amqp2cpp' if self=="array"
path=split(".")
name=path.pop
return name.typename if path.empty?
@@ -112,21 +113,28 @@ class CppType
def to_s() name; end;
end
+class AmqpElement
+ # convert my amqp type_ attribute to a C++ type.
+ def amqp2cpp()
+ return "Array<#{ArrayTypes[name].amqp2cpp}> " if type_=="array"
+ return type_.amqp2cpp
+ end
+end
+
class AmqpField
def cppname() name.lcaps.cppsafe; end
def cpptype() domain.cpptype; end
def bit?() domain.type_ == "bit"; end
def signature() cpptype.param+" "+cppname; end
- # FIXME aconway 2008-02-27: qualified
- def paramtype()
- fqtype=type_
- unless type_.index(".")
+ def fqtypename()
+ unless type_.index(".")
c=containing_class
return c.domain(type_).fqtypename if c.domain(type_)
return c.struct(type_).fqclassname if c.struct(type_)
end
- "call_traits<#{fqtype.amqp2cpp}>::param_type";
+ return amqp2cpp
end
+ def paramtype() "call_traits<#{fqtypename}>::param_type"; end
end
class AmqpMethod
@@ -337,8 +345,8 @@ class CppGen < Generator
def ctor_decl(name, params=[]) function_decl(name, params); end
def ctor_defn(name, params=[], inits=[])
- signature(name+"::"+name, params)
- scope(":","") { genl inits.join(",\n")} if not inits.empty?
+ signature(name, params, inits.empty? ? "" : " :")
+ indent { gen inits.join(",\n") } if not inits.empty?
scope() { yield }
end