summaryrefslogtreecommitdiff
path: root/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
commit60434be9f8c48d05d1f7c1d406f93142d8c1dc44 (patch)
tree3a2cbcdc76b3414d6e775b85100ba5a5764e162e /cpp/rubygen/cppgen.rb
parent0375ee9a77888a4901dcb093af1683c953cfcb37 (diff)
downloadqpid-python-60434be9f8c48d05d1f7c1d406f93142d8c1dc44.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/qpid@630353 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/rubygen/cppgen.rb')
-rwxr-xr-xcpp/rubygen/cppgen.rb25
1 files changed, 23 insertions, 2 deletions
diff --git a/cpp/rubygen/cppgen.rb b/cpp/rubygen/cppgen.rb
index 60a653e18d..d3cdcca603 100755
--- a/cpp/rubygen/cppgen.rb
+++ b/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