summaryrefslogtreecommitdiff
path: root/qpid/cpp/rubygen/cppgen.rb
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2008-02-22 23:13:43 +0000
committerAlan Conway <aconway@apache.org>2008-02-22 23:13:43 +0000
commit162cbcc4766122da3b939ed9f9b979bd726cb175 (patch)
tree5907f23e78ef413d1fa66254c46dee283e9ddca9 /qpid/cpp/rubygen/cppgen.rb
parentad50f325f63c819de67af9ae7276aafc0238bc40 (diff)
downloadqpid-python-162cbcc4766122da3b939ed9f9b979bd726cb175.tar.gz
Fixed rubygen to skip unchanged generated files, prevents needless
rebuilding every time the code generator changes. Start of amqp 0-10 mapping, work in progress. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@630353 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/rubygen/cppgen.rb')
-rwxr-xr-xqpid/cpp/rubygen/cppgen.rb25
1 files changed, 23 insertions, 2 deletions
diff --git a/qpid/cpp/rubygen/cppgen.rb b/qpid/cpp/rubygen/cppgen.rb
index 60a653e18d..d3cdcca603 100755
--- a/qpid/cpp/rubygen/cppgen.rb
+++ b/qpid/cpp/rubygen/cppgen.rb
@@ -54,12 +54,23 @@ CppKeywords = Set.new(["and", "and_eq", "asm", "auto", "bitand",
CppMangle = CppKeywords+Set.new(["string"])
class String
- def cppsafe()
- CppMangle.include?(self) ? self+"_" : self
+ def cppsafe() CppMangle.include?(self) ? self+"_" : self; end
+ def amqp2cpp()
+ path=split(".")
+ name=path.pop
+ path.map! { |n| n.bars }
+ (path << name.caps).join("::")
end
end
# Hold information about a C++ type.
+#
+# preview - new mapping does not use CppType,
+# Each amqp type corresponds exactly by dotted name
+# to a type, domain or struct, which in turns
+# corresponds by name to a C++ type or typedef.
+# (see String.amqp2cpp)
+#
class CppType
def initialize(name) @name=@param=@ret=name; end
attr_reader :name, :param, :ret, :code
@@ -93,6 +104,16 @@ class CppType
def to_s() name; end;
end
+class AmqpElement
+ def cppfqname()
+ names=parent.dotted_name.split(".")
+ # Field children are moved up to method in C++b
+ prefix.pop if parent.is_a? AmqpField
+ prefix.push cppname
+ prefix.join("::")
+ end
+end
+
class AmqpField
def cppname() name.lcaps.cppsafe; end
def cpptype() domain.cpptype; end