Welcome to the "trac"-ing site of soap4r!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]

root/branches/1_5/lib/wsdl/soap/classNameCreator.rb

Revision 1954, 1.3 kB (checked in by nahi, 1 year ago)
  • mapping_registry was not generated propery for anonymous complexTypes which have the same NCname. closes #355.
Line 
1 # WSDL4R - Class name creator.
2 # Copyright (C) 2000-2007  NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
3
4 # This program is copyrighted free software by NAKAMURA, Hiroshi.  You can
5 # redistribute it and/or modify it under the same terms of Ruby's license;
6 # either the dual license version in 2003, or any later version.
7
8
9 require 'soap/mapping/typeMap'
10 require 'xsd/codegen/gensupport'
11
12
13 module WSDL
14 module SOAP
15
16
17 class ClassNameCreator
18   include XSD::CodeGen::GenSupport
19
20   def initialize
21     @classname = {}
22   end
23
24   def assign_name(qname, modulepath = nil)
25     key = [modulepath, qname]
26     unless @classname.key?(key)
27       if klass = ::SOAP::TypeMap[qname]
28         name =
29           ::SOAP::Mapping::DefaultRegistry.find_mapped_obj_class(klass).name
30       else
31         name = safeconstname(qname.name)
32         if modulepath
33           name = [modulepath, name].join('::')
34         end
35         while @classname.value?(name)
36           name += '_'
37         end
38         check_classname(name)
39       end
40       @classname[key] = name.freeze
41     end
42     @classname[key]
43   end
44
45   def check_classname(name)
46     if Object.constants.include?(name)
47       warn("created definition re-opens an existing toplevel class: #{name}.  consider to use --module_path option of wsdl2ruby.rb")
48     end
49   end
50 end
51
52
53 end
54 end
Note: See TracBrowser for help on using the browser.