summaryrefslogtreecommitdiff
path: root/cpp/rubygen/cppgen.rb
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/rubygen/cppgen.rb')
-rwxr-xr-xcpp/rubygen/cppgen.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/cpp/rubygen/cppgen.rb b/cpp/rubygen/cppgen.rb
index 63a2e6857e..d0f31a8ba8 100755
--- a/cpp/rubygen/cppgen.rb
+++ b/cpp/rubygen/cppgen.rb
@@ -57,7 +57,6 @@ 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?
@@ -116,7 +115,7 @@ end
class AmqpElement
# convert my amqp type_ attribute to a C++ type.
def amqp2cpp()
- return "Array<#{ArrayTypes[name].amqp2cpp}> " if type_=="array"
+ return "ArrayDomain<#{ArrayTypes[name].amqp2cpp}> " if type_=="array"
return type_.amqp2cpp
end
end
@@ -166,6 +165,11 @@ class AmqpAction
include AmqpHasFields
end
+class AmqpType
+ def typename() name.typename; end
+ def fixed?() fixed_width; end
+end
+
class AmqpCommand < AmqpAction
def base() "Command"; end
end
@@ -281,10 +285,11 @@ class CppGen < Generator
genl
names = name.split("::")
names.each { |n| genl "namespace #{n} {" }
+ genl "namespace {" if (names.empty?)
genl
yield
genl
- genl('}'*names.size+" // namespace "+name)
+ genl('}'*([names.size, 1].max)+" // namespace "+name)
genl
end