diff options
author | Alan Conway <aconway@apache.org> | 2007-08-01 16:50:33 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2007-08-01 16:50:33 +0000 |
commit | f0281e4654f49dd1b0e4607d6721553847e428a2 (patch) | |
tree | acc50e0425b88016d7ccaec6839c9d8e1af103aa /qpid/cpp/rubygen/cppgen.rb | |
parent | c6766aa1bf420a908acef1ea577755f8741c9d03 (diff) | |
download | qpid-python-f0281e4654f49dd1b0e4607d6721553847e428a2.tar.gz |
* src/generate.sh: Moved requirements test to configure.ac
* rubygen: Cleanup and improvements, template for cluster work.
* configure.ac:
- support for ruby code generator + cleanup.
- moved "can generate" tests to configure.ac
- removed redundant APR stuff.
* bootstrap: Remove codegen from bootstrap, all in config/make.
* src/Makefile.am (libqpidcommon_la_LIBADD):
- Ruby code generator.
- Improvements to existing generator rules.
- Removed APR stuff.
* configure.ac (CPPUNIT_CXXFLAGS): Removed APR stuff.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@561869 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/rubygen/cppgen.rb')
-rwxr-xr-x | qpid/cpp/rubygen/cppgen.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/qpid/cpp/rubygen/cppgen.rb b/qpid/cpp/rubygen/cppgen.rb index 3e3800c4cd..b5f4758411 100755 --- a/qpid/cpp/rubygen/cppgen.rb +++ b/qpid/cpp/rubygen/cppgen.rb @@ -105,6 +105,7 @@ class CppGen < Generator # Write a header file. def h_file(path) + path = (/\.h$/ === path ? path : path+".h") guard=path.upcase.tr('./-','_') file(path) { gen "#ifndef #{guard}\n" @@ -122,5 +123,29 @@ class CppGen < Generator yield end end + + def include(header) genl "#include \"#{header}\""; end + + def scope(open="{",close="}", &block) + genl open; indent(&block); genl close + end + + def namespace(name, &block) + names = name.split("::") + names.each { |n| genl "namespace #{n} {" } + yield + genl('}'*names.size+" // "+name) + end + + def struct_class(type, name, *bases, &block) + gen "#{type} #{name}" + gen ": #{bases.join(', ')}" unless bases.empty + genl "{" + yield + genl "};" + end + + def struct(name, *bases, &block) struc_class("struct", bases, &block); end + def class_(name, *bases, &block) struc_class("struct", bases, &block); end end |