CppUmlClass 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5c8504de4c9118c846499f11af1ef896b3dc88ff8d4f00d3f6011e52a6b1a79f
4
- data.tar.gz: 0d45624d9d2089800b0bd66cc9e58cdcd69409b903fdc7b84b01b1bac1211d6a
3
+ metadata.gz: a663be325a0c0bc0a2737ee6a80d28e36ceb82e797dd280c7a6dcd2e8622de1f
4
+ data.tar.gz: f52916b31de6c3bf8c9c2d1ae98d3c64863109a07d2bae0a792bc8dba26e9003
5
5
  SHA512:
6
- metadata.gz: 569cc2d319a77e8e914af09983071b55b1a6d429fa8dae0ed44127e8320b95402f8cacfca8ce0344d0d6d08fd2d615a0f25aeb8a522cf3dba50bf3394e9fdfad
7
- data.tar.gz: 8440742f0a2628cdfccaf195d8a1ed3621ad2841eafdc0e3059f44649d0eb252f4472e8663a4141d891085e5e2e2c0cdd3e6015922e69141f0b2638740bd9571
6
+ metadata.gz: f12f7c88cce03eb7ab4cbcdcf247c807fb5390d12dc7c7fae4e20bf0147da888a9b5f386e1e54d86e698694ef0adec9e63b2993779498dfe40ce425dd919aba0
7
+ data.tar.gz: ae7103faad064ddceacd6d5062c401f0d82e7d90a9be860d093bd6fc589735b7c5fca88816afcb4349d446746472638e10ba59093f075750f092325ade11cd8f
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CppUmlClass
4
- VERSION = "0.4.0"
4
+ VERSION = "0.6.0"
5
5
  end
@@ -181,10 +181,17 @@ def composition_list_create(in_dir, out_list)
181
181
 
182
182
  # ブロックの開始/終了
183
183
  if line.match(/\{/)
184
- block_count += 1
184
+ block_count += line.each_char.select { |c| c == "{" }.size
185
+ start_block = true
186
+ else
187
+ start_block = false
185
188
  end
189
+ # ブロックの終了
186
190
  if line.match(/\}/)
187
- block_count -= 1
191
+ block_count -= line.each_char.select { |c| c == "}" }.size
192
+ end_block = true
193
+ else
194
+ end_block = false
188
195
  end
189
196
  #puts "comp:block_count=#{block_count}"
190
197
 
@@ -202,34 +209,24 @@ def composition_list_create(in_dir, out_list)
202
209
  end
203
210
  # 関数の開始
204
211
  #if line =~ /^\S+::\S+/
205
- if line.gsub(/<.*>/, "") =~ /^\S.*(\S+)::(\S+).*\(.*{$/ and
212
+ if line.gsub(/<.*>/, "") =~ /^\S.*(\S+)::(\S+).*\(.*{/ and
206
213
  (File.extname(file) == ".cpp" or File.extname(file) == ".hpp")
207
- #puts "comp:method start"
208
- #class_name = line.match(/(\w+)(?=<\w*,?\s*\w*>?::\w+\(\))/).to_s
209
- #class_name = line.match(/(\w+)(?=::\S+\(\))/).to_s if class_name == ""
210
- #class_name = line.match(/(\w+(?:::\w+)*)(?=::\w+\(.*\))/).to_s if class_name == ""
211
- #class_name = class_name.split("::")[1] if class_name =~ /::/
212
214
  line.gsub(/<.*>/, "").match(/(\w+)(?=\S+\()/) do |m|
213
215
  #puts "comp:class_name=#{m}"
214
216
  cstruct_list.push CStruct.new(:method_start, m.to_s, block_count, [], [], [], [])
215
217
  break
216
218
  end
217
-
218
- #puts "class_name=[#{class_name}]"
219
- #if class_name != ""
220
- # cstruct_list.push CStruct.new(:method_start, class_name, block_count, [], [], [], [])
221
- # next
222
- #end
223
219
  end
224
220
 
225
221
  if cstruct_list.size != 0
226
222
  class_block_count = cstruct_list[-1].block_count
223
+ #puts "comp:#{File.basename(file)}:#{block_count}:line3=#{line}"
227
224
  if block_count == (class_block_count - 1) # block_countが一致
228
225
  # 関数の終了
229
- #puts "comp:method end #{cstruct_list[-1].name}"
226
+ #puts "comp:#{File.basename(file)}:comp:method end #{cstruct_list[-1].name}"
230
227
  cstruct_list.slice!(-1) # 最後の要素を削除
231
228
  else
232
- #puts "comp:#{File.basename(file)}:#{block_count}:line3=#{line}"
229
+ #puts "#{start_block} : #{end_block}"
233
230
  my_class_name = cstruct_list[-1].name
234
231
  my_cstruct = out_list.select { |m| m.name == my_class_name }[1]
235
232
  #pp my_cstruct
@@ -245,6 +242,12 @@ def composition_list_create(in_dir, out_list)
245
242
  end
246
243
  end
247
244
  end
245
+ if start_block and end_block # 1行関数
246
+ if block_count == (class_block_count - 1) # block_countが一致
247
+ cstruct_list.slice!(-1) # 最後の要素を削除
248
+ #puts "comp:#{File.basename(file)}:cstruct size=#{cstruct_list.size}"
249
+ end
250
+ end
248
251
  end
249
252
  end
250
253
  end
@@ -314,15 +317,8 @@ def create_uml_class(in_dir, out_file)
314
317
  puts file
315
318
  next
316
319
  end
317
- #if out_list.size != 0 and out_list[-1].type == :class_start # classが連続している
318
- # class_name = out_list[-1].name + "." + class_name
319
- # out_list[-1].name = class_name
320
- # cstruct_list[-1].name = class_name
321
- #else
322
320
  out_list.push CStruct.new(:class_start, class_name, block_count, [], [], [], [])
323
321
  cstruct_list.push CStruct.new(:class_end, class_name, block_count, [], [], [], [])
324
- #end
325
- #pp line if class_name == ""
326
322
  base_name.each do |name|
327
323
  name.gsub!(/,/, "")
328
324
  #puts "base_name=#{name}"
@@ -453,7 +449,7 @@ if $0 == __FILE__
453
449
  #exit
454
450
  #buf = update_source(ARGV[0])
455
451
  #puts buf
456
- @config = { "exclude_path" => "test" }
452
+ @config = { "exclude_path" => "" }
457
453
 
458
454
  if true
459
455
  puts create_uml_class(ARGV[0], ARGV[1])
data/lib/server.rb CHANGED
@@ -47,20 +47,23 @@ class Search < Sinatra::Base
47
47
  puts path
48
48
  Dir.glob(path, File::FNM_DOTMATCH).each do |file|
49
49
  data = {}
50
- if File.basename(file) == "."
51
- path = Pathname(File.expand_path(file))
52
- data["label"] = ".."
53
- data["label"] += "/" if path.parent == "/"
54
- data["value"] = path.parent.to_s
55
- res.push data
56
- next
57
- end
50
+ next if File.basename(file) == "."
58
51
  next if kind == "dir" and !File.directory?(file)
59
52
  data["label"] = File.basename(file)
60
53
  data["label"] += "/" if (File.directory?(file))
61
54
  data["value"] = File.expand_path(file)
62
55
  res.push data
63
56
  end
57
+ if 0 == res.select { |dir| dir["label"] == "../" }.size
58
+ data = {}
59
+ pp = Pathname(File.expand_path("#{dir}/#{file}"))
60
+ data["label"] = "../"
61
+ data["label"] += "/" if pp.parent == "/"
62
+ data["value"] = pp.parent.to_s
63
+ data["value"] = "/" if data["value"] =~ /^[\/]+$/
64
+ #puts "value = #{pp.parent.to_s}"
65
+ res.push data
66
+ end
64
67
  JSON.generate res.sort { |a, b| a["value"] <=> b["value"] }
65
68
  end
66
69
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: CppUmlClass
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masataka Kuwayama
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-03-09 00:00:00.000000000 Z
11
+ date: 2025-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: browser_app_base