cplus2ruby 1.1.2 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
 
3
3
  spec = Gem::Specification.new do |s|
4
4
  s.name = "cplus2ruby"
5
- s.version = "1.1.2"
5
+ s.version = "1.2.0"
6
6
  s.summary = "Gluing C++ and Ruby together in an OO manner"
7
7
  s.files = Dir['**/*']
8
8
  s.add_dependency('facets', '>= 2.3.0')
@@ -25,9 +25,10 @@ class Cplus2Ruby::CodeGenerator
25
25
  end
26
26
 
27
27
  def all_properties_of(klass)
28
- klass.local_annotations.each do |name, options|
29
- next if options[:class] != Cplus2Ruby::Property
30
- yield name, options
28
+ klass.local_annotations.sort_by {|name, options| options[:order] || 0}.
29
+ each do |name, options|
30
+ next if options[:class] != Cplus2Ruby::Property
31
+ yield name, options
31
32
  end
32
33
  end
33
34
 
@@ -50,7 +50,7 @@ class Cplus2Ruby::CppCodeGenerator < Cplus2Ruby::CodeGenerator
50
50
  def gen_free_or_mark_method(klass, kind)
51
51
  stmts = stmts_for_free_or_mark_method(klass, kind)
52
52
  return "" if stmts.empty?
53
- stmts << "super::__#{kind}__()"
53
+ stmts.unshift("super::__#{kind}__()")
54
54
  %[
55
55
  void #{klass.name}::__#{kind}__()
56
56
  {
@@ -14,12 +14,17 @@ class Cplus2Ruby::Model
14
14
  @order_cnt += 1
15
15
  end
16
16
 
17
+ def next_prop_cnt
18
+ @prop_cnt += 1
19
+ end
20
+
17
21
  def initialize
18
22
  @typing = Cplus2Ruby::Typing.new
19
23
  @code = ""
20
24
  @includes = []
21
25
  @settings = default_settings()
22
26
  @order_cnt = 0
27
+ @prop_cnt = 0
23
28
  end
24
29
 
25
30
  def finish!
@@ -140,7 +145,8 @@ end
140
145
  module Cplus2Ruby::Entity
141
146
  def property(name, type=Object, options={})
142
147
  raise ArgumentError if options[:type]
143
- options[:type] = type
148
+ options[:type] = type || Object
149
+ options[:order] = Cplus2Ruby.model.next_prop_cnt
144
150
  ann! name, Cplus2Ruby::Property, options
145
151
  end
146
152
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cplus2ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Neumann
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-04-01 00:00:00 +02:00
12
+ date: 2008-04-03 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -30,20 +30,20 @@ extensions: []
30
30
  extra_rdoc_files: []
31
31
 
32
32
  files:
33
- - cplus2ruby.gemspec
34
- - example.rb
35
- - README
33
+ - test
34
+ - test/test_mixin.rb
36
35
  - lib
37
36
  - lib/cplus2ruby.rb
38
37
  - lib/cplus2ruby
39
- - lib/cplus2ruby/model.rb
38
+ - lib/cplus2ruby/code_generator.rb
40
39
  - lib/cplus2ruby/cpp_code_generator.rb
41
40
  - lib/cplus2ruby/compiler.rb
42
41
  - lib/cplus2ruby/wrapper_code_generator.rb
43
42
  - lib/cplus2ruby/typing.rb
44
- - lib/cplus2ruby/code_generator.rb
45
- - test
46
- - test/test_mixin.rb
43
+ - lib/cplus2ruby/model.rb
44
+ - README
45
+ - example.rb
46
+ - cplus2ruby.gemspec
47
47
  has_rdoc: false
48
48
  homepage: http://www.ntecs.de/projects/cplus2ruby/
49
49
  post_install_message: