summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2007-08-09 14:39:07 +0000
committerAlan Conway <aconway@apache.org>2007-08-09 14:39:07 +0000
commitd2015d708bdb0c660cddd6969996c23daa6a5c49 (patch)
tree0b71b1447a45dca0b1e8c7f0f8d3d95d50de0faa /cpp
parent462fd7ae8c6ac92730ebc497a9140ecec0cc03d9 (diff)
downloadqpid-python-d2015d708bdb0c660cddd6969996c23daa6a5c49.tar.gz
Avoid clash with built-in ruby function Object.methods():n
- Renamed methods*() to amqp_methods, classes*() to amqp_classes. - Renamed CppGen.class_() to cpp_class. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@564225 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
-rwxr-xr-xcpp/rubygen/amqpgen.rb22
-rwxr-xr-xcpp/rubygen/cppgen.rb2
-rwxr-xr-xcpp/rubygen/samples/Operations.rb6
-rwxr-xr-xcpp/rubygen/templates/ClassBodyVariant.rb6
-rwxr-xr-xcpp/rubygen/templates/Proxy.rb18
-rw-r--r--cpp/rubygen/templates/Session.rb8
-rw-r--r--cpp/rubygen/templates/frame_body_lists.rb2
-rwxr-xr-xcpp/rubygen/templates/method_variants.rb12
8 files changed, 38 insertions, 38 deletions
diff --git a/cpp/rubygen/amqpgen.rb b/cpp/rubygen/amqpgen.rb
index ae8e4c5d1c..49f8c0061e 100755
--- a/cpp/rubygen/amqpgen.rb
+++ b/cpp/rubygen/amqpgen.rb
@@ -106,16 +106,16 @@ end
class AmqpClass < AmqpElement
def initialize(xml,amqp) super; end
def index() attributes["index"]; end
- def methods()
- @cache_methods ||= elements.collect("method") { |el|
+ def amqp_methods()
+ @cache_amqp_methods ||= elements.collect("method") { |el|
AmqpMethod.new(el,self)
}.sort_by_name
end
# chassis should be "client" or "server"
- def methods_on(chassis)
- @cache_methods_on ||= { }
- @cache_methods_on[chassis] ||= elements.collect("method/chassis[@name='#{chassis}']/..") { |m|
+ def amqp_methods_on(chassis)
+ @cache_amqp_methods_on ||= { }
+ @cache_amqp_methods_on[chassis] ||= elements.collect("method/chassis[@name='#{chassis}']/..") { |m|
AmqpMethod.new(m,self)
}.sort_by_name
end
@@ -139,17 +139,17 @@ class AmqpRoot < AmqpElement
attributes["major"]+"-"+attributes["minor"]
end
- def classes()
- @cache_classes ||= elements.collect("class") { |c| AmqpClass.new(c,self) }.sort_by_name
+ def amqp_classes()
+ @cache_amqp_classes ||= elements.collect("class") { |c| AmqpClass.new(c,self) }.sort_by_name
end
# Return all methods on all classes.
- def methods() classes.collect { |c| c.methods }.flatten; end
+ def amqp_methods() amqp_classes.collect { |c| c.amqp_methods }.flatten; end
# Return all methods on chassis for all classes.
- def methods_on(chassis)
- @cache_methods_on ||= { }
- @cache_methods_on[chassis] ||= classes.collect { |c| c.methods_on(chassis) }.flatten
+ def amqp_methods_on(chassis)
+ @cache_amqp_methods_on ||= { }
+ @cache_amqp_methods_on[chassis] ||= amqp_classes.collect { |c| c.amqp_methods_on(chassis) }.flatten
end
# Merge contents of elements.
diff --git a/cpp/rubygen/cppgen.rb b/cpp/rubygen/cppgen.rb
index 86783b4e14..8feaeb9ba5 100755
--- a/cpp/rubygen/cppgen.rb
+++ b/cpp/rubygen/cppgen.rb
@@ -162,7 +162,7 @@ class CppGen < Generator
end
def struct(name, *bases, &block) struct_class("struct", name, bases, &block); end
- def class_(name, *bases, &block) struct_class("class", name, bases, &block); end
+ def cpp_class(name, *bases, &block) struct_class("class", name, bases, &block); end
def typedef(type, name) genl "typedef #{type} #{name};\n" end
diff --git a/cpp/rubygen/samples/Operations.rb b/cpp/rubygen/samples/Operations.rb
index 1c245ca188..6b0a24a26c 100755
--- a/cpp/rubygen/samples/Operations.rb
+++ b/cpp/rubygen/samples/Operations.rb
@@ -31,7 +31,7 @@ class #{handlerclass} : Invocable {
virtual ~#{handlerclass}() {}
// Protocol methods
EOS
- c.methods_on(@chassis).each { |m| handler_method(m) }
+ c.amqp_methods_on(@chassis).each { |m| handler_method(m) }
gen <<EOS
}; // class #{handlerclass}
@@ -65,13 +65,13 @@ class #{@classname} {
// Inner classes
EOS
- indent { @amqp.classes.each { |c| handler_class(c) } }
+ indent { @amqp.amqp_classes.each { |c| handler_class(c) } }
gen <<EOS
// Method handler get methods
EOS
- indent { @amqp.classes.each { |c| handler_get(c) } }
+ indent { @amqp.amqp_classes.each { |c| handler_get(c) } }
gen <<EOS
}; /* class #{@classname} */
}
diff --git a/cpp/rubygen/templates/ClassBodyVariant.rb b/cpp/rubygen/templates/ClassBodyVariant.rb
index a1dada40a5..dce14c5652 100755
--- a/cpp/rubygen/templates/ClassBodyVariant.rb
+++ b/cpp/rubygen/templates/ClassBodyVariant.rb
@@ -10,18 +10,18 @@ class ClassBodyVariant < CppGen
def class_body(c)
h_file (c.body_name) {
- c.methods.each { |m| genl "#include \"#{m.body_name}.h\""; }
+ c.amqp_methods.each { |m| genl "#include \"#{m.body_name}.h\""; }
genl
genl "#include <boost/visitor.hpp>"
genl
gen "typedef boost::variant<"
- indent { genl c.methods().collect { |m| m.body_name }.join(",\n") }
+ indent { genl c.amqp_methods().collect { |m| m.body_name }.join(",\n") }
genl "> #{c.body_name};"
}
end
def generate()
- @amqp.classes.each{ |c| class_body c }
+ @amqp.amqp_classes.each{ |c| class_body c }
end
end
diff --git a/cpp/rubygen/templates/Proxy.rb b/cpp/rubygen/templates/Proxy.rb
index 16824b3083..40eaa2baa3 100755
--- a/cpp/rubygen/templates/Proxy.rb
+++ b/cpp/rubygen/templates/Proxy.rb
@@ -36,7 +36,7 @@ class ProxyGen < CppGen
// Protocol methods
EOS
- indent(2) { c.methods_on(@chassis).each { |m| inner_method_decl(m) } }
+ indent(2) { c.amqp_methods_on(@chassis).each { |m| inner_method_decl(m) } }
gen "\n }; // class #{cname}\n\n"
end
@@ -48,7 +48,7 @@ EOS
def inner_class_defn(c)
cname=c.cppname
gen "// ==================== class #{cname} ====================\n"
- c.methods_on(@chassis).each { |m| inner_method_defn(m, cname) }
+ c.amqp_methods_on(@chassis).each { |m| inner_method_defn(m, cname) }
end
def inner_method_defn(m,cname)
@@ -90,14 +90,14 @@ public:
// Inner class definitions
EOS
- @amqp.classes.each{ |c| inner_class_decl(c) }
+ @amqp.amqp_classes.each{ |c| inner_class_decl(c) }
gen " // Inner class instance get methods\n"
- @amqp.classes.each{ |c| get_decl(c) }
+ @amqp.amqp_classes.each{ |c| get_decl(c) }
gen <<EOS
private:
// Inner class instances
EOS
- indent { @amqp.classes.each{ |c| gen c.cppname+" "+proxy_member(c)+";\n" } }
+ indent { @amqp.amqp_classes.each{ |c| gen c.cppname+" "+proxy_member(c)+";\n" } }
gen <<EOS
}; /* class #{@classname} */
@@ -112,7 +112,7 @@ EOS
include "#{@classname}.h"
include "qpid/framing/ChannelAdapter.h"
include "qpid/framing/amqp_types_full.h"
- @amqp.methods_on(@chassis).each {
+ @amqp.amqp_methods_on(@chassis).each {
|m| include "qpid/framing/#{m.body_name}.h" }
gen <<EOS
namespace qpid {
@@ -121,15 +121,15 @@ namespace framing {
#{@classname}::#{@classname}(ChannelAdapter& ch) :
EOS
gen " Proxy(ch)"
- @amqp.classes.each { |c| gen ",\n "+proxy_member(c)+"(channel)" }
+ @amqp.amqp_classes.each { |c| gen ",\n "+proxy_member(c)+"(channel)" }
gen <<EOS
{}
// Inner class instance get methods
EOS
- @amqp.classes.each { |c| get_defn(c) }
+ @amqp.amqp_classes.each { |c| get_defn(c) }
gen " // Inner class implementation\n\n"
- @amqp.classes.each { |c| inner_class_defn(c) }
+ @amqp.amqp_classes.each { |c| inner_class_defn(c) }
genl "}} // namespae qpid::framing"
}
end
diff --git a/cpp/rubygen/templates/Session.rb b/cpp/rubygen/templates/Session.rb
index 5289a6af30..fd861b7a4e 100644
--- a/cpp/rubygen/templates/Session.rb
+++ b/cpp/rubygen/templates/Session.rb
@@ -24,7 +24,7 @@ class SessionGen < CppGen
end
def declare_class(c)
- c.methods_on(@chassis).each { |m| declare_method(m) }
+ c.amqp_methods_on(@chassis).each { |m| declare_method(m) }
end
def define_method (m)
@@ -55,7 +55,7 @@ class SessionGen < CppGen
end
def define_class(c)
- c.methods_on(@chassis).each { |m| define_method(m) }
+ c.amqp_methods_on(@chassis).each { |m| define_method(m) }
end
def generate()
@@ -92,7 +92,7 @@ public:
void close() { impl->close(); parent->released(impl); }
EOS
- indent { @amqp.classes.each { |c| declare_class(c) if !excludes.include?(c.name) } }
+ indent { @amqp.amqp_classes.each { |c| declare_class(c) if !excludes.include?(c.name) } }
gen <<EOS
}; /* class #{@classname} */
}
@@ -122,7 +122,7 @@ namespace client {
EOS
- @amqp.classes.each { |c| define_class(c) if !excludes.include?(c.name) }
+ @amqp.amqp_classes.each { |c| define_class(c) if !excludes.include?(c.name) }
gen <<EOS
}} // namespace qpid::client
diff --git a/cpp/rubygen/templates/frame_body_lists.rb b/cpp/rubygen/templates/frame_body_lists.rb
index 33c416fe84..25231e7e1a 100644
--- a/cpp/rubygen/templates/frame_body_lists.rb
+++ b/cpp/rubygen/templates/frame_body_lists.rb
@@ -15,7 +15,7 @@ class FrameBodyListsGen < CppGen
*/
EOS
gen "#define METHOD_BODIES() "
- @amqp.methods.each { |m| gen "\\\n (#{m.body_name}) " }
+ @amqp.amqp_methods.each { |m| gen "\\\n (#{m.body_name}) " }
gen <<EOS
diff --git a/cpp/rubygen/templates/method_variants.rb b/cpp/rubygen/templates/method_variants.rb
index 0787657089..886c7559bb 100755
--- a/cpp/rubygen/templates/method_variants.rb
+++ b/cpp/rubygen/templates/method_variants.rb
@@ -24,10 +24,10 @@ class AmqpCppModelGen < CppGen
def gen_class(c)
varname="#{c.name.caps}Variant"
- mtypes=c.methods.map { |m| m.body_name }
+ mtypes=c.amqp_methods.map { |m| m.body_name }
typedef(blank_variant(mtypes), varname)
genl
- pairs=c.methods.map { |m| [m.index.to_i,m.body_name] }
+ pairs=c.amqp_methods.map { |m| [m.index.to_i,m.body_name] }
gen_set_variant(varname, "MethodId", pairs,
"%d is not a valid method index in class #{c.name}")
mtypes.each { |t|
@@ -38,8 +38,8 @@ class AmqpCppModelGen < CppGen
def gen_all()
varname="MethodVariant"
- types=@amqp.classes.map { |c| "#{c.name.caps}Variant" }
- pairs=@amqp.classes.map { |c| [c.index.to_i,"#{c.name.caps}Variant"] }
+ types=@amqp.amqp_classes.map { |c| "#{c.name.caps}Variant" }
+ pairs=@amqp.amqp_classes.map { |c| [c.index.to_i,"#{c.name.caps}Variant"] }
typedef(blank_variant(types), varname)
genl
gen_set_variant(varname, "ClassId", pairs,
@@ -48,7 +48,7 @@ class AmqpCppModelGen < CppGen
def generate()
h_file("qpid/framing/method_variants.h") {
- @amqp.methods.each { |m| include "qpid/framing/#{m.body_name}.h"}
+ @amqp.amqp_methods.each { |m| include "qpid/framing/#{m.body_name}.h"}
include "qpid/framing/amqp_types.h"
include "qpid/QpidError.h"
include "qpid/framing/variant.h"
@@ -58,7 +58,7 @@ class AmqpCppModelGen < CppGen
genl "// Metafunction returns class variant containing method T."
genl "template <class T> struct ClassVariant {};"
genl
- @amqp.classes.each { |c| gen_class c }
+ @amqp.amqp_classes.each { |c| gen_class c }
}
namespace("qpid::framing") {
gen_all