CppUmlClass 0.3.0 → 0.5.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 +4 -4
- data/lib/CppUmlClass/version.rb +1 -1
- data/lib/check_word.rb +6 -2
- data/lib/create_uml_class.rb +55 -55
- data/lib/css/index.css +11 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b11ad34c06240ad72f271823c30efae82d3aa7b0effd4fd54df08e36503620e
|
4
|
+
data.tar.gz: 6937f38c94cea4348fa207e5cea4808730adc1f6ac6562b43f7e306d47df4345
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e39c4b16f51bbffc4b4a0ae02600fa9376d41529147ec33d7962a4ca31a147936b5d7dd3bd6d509d943f31ff2388b113d096b58f5d20ff746fe07df036117335
|
7
|
+
data.tar.gz: 8cc6b000eb2e3397419c7e6f1ce4243aa77ed50d4a375fe8a3a1c19d36e0e093d0cd750eeaa2c065f2e45730b29a2815170db9fe113cd49b5f09fa889aa60e90
|
data/lib/CppUmlClass/version.rb
CHANGED
data/lib/check_word.rb
CHANGED
data/lib/create_uml_class.rb
CHANGED
@@ -120,11 +120,11 @@ def print_uml(out, out_list)
|
|
120
120
|
out.push "}"
|
121
121
|
# 継承リストの出力
|
122
122
|
o_list.inherit_list.each do |ih|
|
123
|
-
out.push "#{o_list.name} -[#blue]
|
123
|
+
out.push "#{o_list.name} -[#blue]--|> #{ih}"
|
124
124
|
end
|
125
125
|
# compo
|
126
126
|
o_list.composition_list.uniq.each do |co|
|
127
|
-
out.push "#{o_list.name} *-[#green]
|
127
|
+
out.push "#{o_list.name} *-[#green]-- #{co}"
|
128
128
|
end
|
129
129
|
elsif o_list.type == :module_end
|
130
130
|
# インスタンス変数がある場合はモジュール名と同じクラスを定義
|
@@ -145,11 +145,11 @@ def print_uml(out, out_list)
|
|
145
145
|
out.push "}"
|
146
146
|
# 継承リストの出力
|
147
147
|
o_list.inherit_list.each do |ih|
|
148
|
-
out.push "#{o_list.name} -[#blue]
|
148
|
+
out.push "#{o_list.name} -[#blue]--|> #{ih}"
|
149
149
|
end
|
150
150
|
# compo
|
151
151
|
o_list.composition_list.uniq.each do |co|
|
152
|
-
out.push "#{o_list.name} *-[#green]
|
152
|
+
out.push "#{o_list.name} *-[#green]-- #{co}"
|
153
153
|
end
|
154
154
|
end
|
155
155
|
out.push "}"
|
@@ -163,12 +163,12 @@ end
|
|
163
163
|
|
164
164
|
def composition_list_create(in_dir, out_list)
|
165
165
|
# composition_list
|
166
|
-
Dir.glob("#{in_dir}/**/*.{cpp,hpp}") do |file|
|
167
|
-
if file =~ Regexp.new(@config["exclude_path"])
|
168
|
-
puts "skip #{file}"
|
166
|
+
Dir.glob("#{in_dir}/**/*.{h,cpp,hpp}") do |file|
|
167
|
+
if @config["exclude_path"].to_s != "" and file =~ Regexp.new(@config["exclude_path"])
|
168
|
+
#puts "skip #{file}"
|
169
169
|
next
|
170
170
|
end
|
171
|
-
puts file
|
171
|
+
#puts file
|
172
172
|
# ソースコードの整形
|
173
173
|
buf = update_source(file)
|
174
174
|
# ソースを解析
|
@@ -177,16 +177,23 @@ def composition_list_create(in_dir, out_list)
|
|
177
177
|
buf.each_line do |line|
|
178
178
|
next if line =~ /^[\r\n]*$/ # 空行は対象外
|
179
179
|
next if line =~ /^#/ # #から始まる行は対象外
|
180
|
-
puts line
|
180
|
+
#puts "comp:#{line}"
|
181
181
|
|
182
182
|
# ブロックの開始/終了
|
183
183
|
if line.match(/\{/)
|
184
|
-
block_count +=
|
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 -=
|
191
|
+
block_count -= line.each_char.select { |c| c == "}" }.size
|
192
|
+
end_block = true
|
193
|
+
else
|
194
|
+
end_block = false
|
188
195
|
end
|
189
|
-
puts "block_count=#{block_count}"
|
196
|
+
#puts "comp:block_count=#{block_count}"
|
190
197
|
|
191
198
|
# classの開始
|
192
199
|
#if line =~ /^\s*(class)\s/ and File.extname(file) == ".h"
|
@@ -196,39 +203,30 @@ def composition_list_create(in_dir, out_list)
|
|
196
203
|
class_name = work.split(" : ")[0].to_s.chomp.match(/ [A-Za-z0-9_:]+/).to_s.split(" ")[0]
|
197
204
|
#base_name = work.split(" : ")[1].to_s.split(" ")[1].to_s.gsub(/<.*>/, "")
|
198
205
|
#puts "start class #{class_name}"
|
199
|
-
|
206
|
+
if class_name.to_s != ""
|
207
|
+
cstruct_list.push CStruct.new(:class_end, class_name, block_count, [], [], [], [])
|
208
|
+
end
|
200
209
|
end
|
201
|
-
|
202
210
|
# 関数の開始
|
203
211
|
#if line =~ /^\S+::\S+/
|
204
|
-
if line.gsub(/<.*>/, "") =~ /^\S.*(\S+)::(\S+).*\(.*{
|
212
|
+
if line.gsub(/<.*>/, "") =~ /^\S.*(\S+)::(\S+).*\(.*{/ and
|
205
213
|
(File.extname(file) == ".cpp" or File.extname(file) == ".hpp")
|
206
|
-
puts "method start"
|
207
|
-
#class_name = line.match(/(\w+)(?=<\w*,?\s*\w*>?::\w+\(\))/).to_s
|
208
|
-
#class_name = line.match(/(\w+)(?=::\S+\(\))/).to_s if class_name == ""
|
209
|
-
#class_name = line.match(/(\w+(?:::\w+)*)(?=::\w+\(.*\))/).to_s if class_name == ""
|
210
|
-
#class_name = class_name.split("::")[1] if class_name =~ /::/
|
211
214
|
line.gsub(/<.*>/, "").match(/(\w+)(?=\S+\()/) do |m|
|
212
|
-
puts "class_name=#{m}"
|
215
|
+
#puts "comp:class_name=#{m}"
|
213
216
|
cstruct_list.push CStruct.new(:method_start, m.to_s, block_count, [], [], [], [])
|
214
217
|
break
|
215
218
|
end
|
216
|
-
|
217
|
-
#puts "class_name=[#{class_name}]"
|
218
|
-
#if class_name != ""
|
219
|
-
# cstruct_list.push CStruct.new(:method_start, class_name, block_count, [], [], [], [])
|
220
|
-
# next
|
221
|
-
#end
|
222
219
|
end
|
223
220
|
|
224
221
|
if cstruct_list.size != 0
|
225
222
|
class_block_count = cstruct_list[-1].block_count
|
226
223
|
if block_count == (class_block_count - 1) # block_countが一致
|
227
224
|
# 関数の終了
|
228
|
-
puts "method end #{cstruct_list[-1].name}"
|
225
|
+
#puts "comp:method end #{cstruct_list[-1].name}"
|
229
226
|
cstruct_list.slice!(-1) # 最後の要素を削除
|
230
227
|
else
|
231
|
-
puts "
|
228
|
+
#puts "comp:#{File.basename(file)}:#{block_count}:line3=#{line}"
|
229
|
+
#puts "#{start_block} : #{end_block}"
|
232
230
|
my_class_name = cstruct_list[-1].name
|
233
231
|
my_cstruct = out_list.select { |m| m.name == my_class_name }[1]
|
234
232
|
#pp my_cstruct
|
@@ -237,13 +235,17 @@ def composition_list_create(in_dir, out_list)
|
|
237
235
|
out_list.each do |clist|
|
238
236
|
next if clist.name == my_cstruct.name
|
239
237
|
use_class_name = clist.name
|
240
|
-
puts "my_class_name=#{my_class_name} : use_class_name=#{use_class_name}"
|
238
|
+
#puts "my_class_name=#{my_class_name} : use_class_name=#{use_class_name}"
|
241
239
|
if check_word(line, use_class_name)
|
242
240
|
#if line.include?(use_class_name)
|
243
241
|
my_cstruct.composition_list.push use_class_name
|
244
242
|
end
|
245
243
|
end
|
246
244
|
end
|
245
|
+
if start_block and end_block # 1行関数
|
246
|
+
cstruct_list.slice!(-1) # 最後の要素を削除
|
247
|
+
#puts "cstruct size=#{cstruct_list.size}"
|
248
|
+
end
|
247
249
|
end
|
248
250
|
end
|
249
251
|
end
|
@@ -256,7 +258,7 @@ def create_uml_class(in_dir, out_file)
|
|
256
258
|
out = []
|
257
259
|
out.push "@startuml"
|
258
260
|
|
259
|
-
puts "in_dir = #{in_dir}"
|
261
|
+
#puts "in_dir = #{in_dir}"
|
260
262
|
main_composition_list = []
|
261
263
|
main_method_list = []
|
262
264
|
global_var = []
|
@@ -264,11 +266,11 @@ def create_uml_class(in_dir, out_file)
|
|
264
266
|
out_list = []
|
265
267
|
#Dir.glob("#{in_dir}/**/*.{cpp,hpp,h}") do |file|
|
266
268
|
Dir.glob("#{in_dir}/**/*.{h}") do |file|
|
267
|
-
if file =~ Regexp.new(@config["exclude_path"])
|
268
|
-
puts "skip #{file}"
|
269
|
+
if @config["exclude_path"].to_s != "" and file =~ Regexp.new(@config["exclude_path"])
|
270
|
+
#puts "skip #{file}"
|
269
271
|
next
|
270
272
|
end
|
271
|
-
puts file
|
273
|
+
#puts file
|
272
274
|
# ソースコードの整形
|
273
275
|
buf = update_source(file)
|
274
276
|
|
@@ -280,7 +282,7 @@ def create_uml_class(in_dir, out_file)
|
|
280
282
|
buf.each_line do |line|
|
281
283
|
next if line =~ /^[\r\n]*$/ # 空行は対象外
|
282
284
|
next if line =~ /^#/ # #から始まる行は対象外
|
283
|
-
puts line
|
285
|
+
#puts line
|
284
286
|
|
285
287
|
# ブロックの開始/終了
|
286
288
|
if line.match(/\{/)
|
@@ -292,8 +294,11 @@ def create_uml_class(in_dir, out_file)
|
|
292
294
|
# ブロックの終了
|
293
295
|
if line.match(/\}/)
|
294
296
|
block_count -= line.each_char.select { |c| c == "}" }.size
|
297
|
+
end_block = true
|
298
|
+
else
|
299
|
+
end_block = false
|
295
300
|
end
|
296
|
-
puts "block_count=#{block_count}"
|
301
|
+
#puts "block_count=#{block_count}"
|
297
302
|
|
298
303
|
# classの開始
|
299
304
|
#if line =~ /^\s*(class)\s/
|
@@ -305,23 +310,16 @@ def create_uml_class(in_dir, out_file)
|
|
305
310
|
work.split(" : ")[1].to_s.gsub(/(public |private |protected )/, "").to_s.gsub(/<.*>/, "").split(" ").each do |name|
|
306
311
|
base_name.push name if name =~ /\w+/
|
307
312
|
end
|
308
|
-
puts "start class [#{class_name}]"
|
309
|
-
if class_name == ""
|
313
|
+
#puts "start class [#{class_name}]"
|
314
|
+
if class_name.to_s == ""
|
310
315
|
puts file
|
311
|
-
|
316
|
+
next
|
312
317
|
end
|
313
|
-
#if out_list.size != 0 and out_list[-1].type == :class_start # classが連続している
|
314
|
-
# class_name = out_list[-1].name + "." + class_name
|
315
|
-
# out_list[-1].name = class_name
|
316
|
-
# cstruct_list[-1].name = class_name
|
317
|
-
#else
|
318
318
|
out_list.push CStruct.new(:class_start, class_name, block_count, [], [], [], [])
|
319
319
|
cstruct_list.push CStruct.new(:class_end, class_name, block_count, [], [], [], [])
|
320
|
-
#end
|
321
|
-
#pp line if class_name == ""
|
322
320
|
base_name.each do |name|
|
323
321
|
name.gsub!(/,/, "")
|
324
|
-
puts "base_name=#{name}"
|
322
|
+
#puts "base_name=#{name}"
|
325
323
|
cstruct_list[-1].inherit_list.push name
|
326
324
|
end
|
327
325
|
end
|
@@ -342,7 +340,7 @@ def create_uml_class(in_dir, out_file)
|
|
342
340
|
# 関数名を取り出す
|
343
341
|
method = line.split(" : ")[0].gsub(/^\s+/, "")
|
344
342
|
method = method.split(";")[0].split("{")[0]
|
345
|
-
puts "method=#{method}"
|
343
|
+
#puts "method=#{method}"
|
346
344
|
method_list = cstruct_list[-1].method_list
|
347
345
|
case method_type
|
348
346
|
when :public
|
@@ -357,7 +355,9 @@ def create_uml_class(in_dir, out_file)
|
|
357
355
|
|
358
356
|
# class変数
|
359
357
|
# 括弧を含まない、かつtemplateを含まない文字列
|
360
|
-
if cstruct_list.size != 0 and
|
358
|
+
if cstruct_list.size != 0 and
|
359
|
+
(block_count == cstruct_list[-1].block_count or
|
360
|
+
(end_block == true and block_count + 1 == cstruct_list[-1].block_count))
|
361
361
|
if line =~ /^[^(){}]*$/ and
|
362
362
|
line =~ /^((?!\/tmp\/).)*$/ and
|
363
363
|
line =~ /^((?!namespace).)*$/ and
|
@@ -365,7 +365,7 @@ def create_uml_class(in_dir, out_file)
|
|
365
365
|
line =~ /^((?!public:).)*$/ and
|
366
366
|
line =~ /^((?!private:).)*$/ and
|
367
367
|
line =~ /^((?!protected:).)*$/
|
368
|
-
puts "class member=#{line}"
|
368
|
+
#puts "class member=#{line}"
|
369
369
|
#val = line.split("=")[0].split(" ")[-1]
|
370
370
|
val = line.split("=")[0]
|
371
371
|
val = val.split(";")[0]
|
@@ -385,7 +385,7 @@ def create_uml_class(in_dir, out_file)
|
|
385
385
|
if cstruct_list.size != 0
|
386
386
|
class_block_count = cstruct_list[-1].block_count
|
387
387
|
if block_count == (class_block_count - 1) # block_countが一致
|
388
|
-
puts "class end #{cstruct_list[-1].name}"
|
388
|
+
#puts "class end #{cstruct_list[-1].name}"
|
389
389
|
out_list.push cstruct_list[-1]
|
390
390
|
cstruct_list.slice!(-1) # 最後の要素を削除
|
391
391
|
end
|
@@ -425,7 +425,7 @@ def create_uml_class(in_dir, out_file)
|
|
425
425
|
end
|
426
426
|
|
427
427
|
def search_func(file)
|
428
|
-
puts file
|
428
|
+
#puts file
|
429
429
|
# ソースコードの整形
|
430
430
|
buf = update_source(file)
|
431
431
|
# ソースを解析
|
@@ -434,9 +434,9 @@ def search_func(file)
|
|
434
434
|
next if line =~ /^#/ # #から始まる行は対象外
|
435
435
|
#puts line
|
436
436
|
if line.gsub(/<.*>/, "") =~ /^\S.*(\S+)::(\S+).*\(.*{$/
|
437
|
-
puts line.gsub!(/<.*>/, "")
|
437
|
+
#puts line.gsub!(/<.*>/, "")
|
438
438
|
line.match(/(\w+)(?=\S+\()/) do |m|
|
439
|
-
puts "class_name=#{m}"
|
439
|
+
#puts "class_name=#{m}"
|
440
440
|
end
|
441
441
|
end
|
442
442
|
end
|
@@ -447,7 +447,7 @@ if $0 == __FILE__
|
|
447
447
|
#exit
|
448
448
|
#buf = update_source(ARGV[0])
|
449
449
|
#puts buf
|
450
|
-
@config = { "exclude_path" => "
|
450
|
+
@config = { "exclude_path" => "" }
|
451
451
|
|
452
452
|
if true
|
453
453
|
puts create_uml_class(ARGV[0], ARGV[1])
|
data/lib/css/index.css
CHANGED
@@ -2,7 +2,7 @@ body {
|
|
2
2
|
color: #000000;
|
3
3
|
background-color: #cac3ec4f;
|
4
4
|
overflow: hidden;
|
5
|
-
font-size:
|
5
|
+
font-size: 14px;
|
6
6
|
}
|
7
7
|
|
8
8
|
hr {
|
@@ -49,7 +49,7 @@ textarea.long {
|
|
49
49
|
}
|
50
50
|
|
51
51
|
.ui-widget {
|
52
|
-
font-size:
|
52
|
+
font-size: 14px;
|
53
53
|
}
|
54
54
|
|
55
55
|
.ui-autocomplete {
|
@@ -88,25 +88,29 @@ textarea.long {
|
|
88
88
|
}
|
89
89
|
|
90
90
|
#setting_dialog {
|
91
|
-
color: #
|
91
|
+
color: #ffffff;
|
92
92
|
background-color: #000000;
|
93
|
+
font-size: 14px;
|
93
94
|
}
|
94
95
|
|
95
96
|
.setting_name {
|
96
97
|
width: 200px;
|
97
|
-
color: #
|
98
|
+
color: #ffffff;
|
98
99
|
background-color: #000000;
|
100
|
+
font-size: 14px;
|
99
101
|
}
|
100
102
|
|
101
103
|
.setting_value {
|
102
104
|
width: 300px;
|
103
|
-
color: #
|
105
|
+
color: #ffffff;
|
104
106
|
background-color: #000000;
|
107
|
+
font-size: 14px;
|
105
108
|
}
|
106
109
|
|
107
110
|
.setting_checkbox {
|
108
|
-
color: #
|
111
|
+
color: #ffffff;
|
109
112
|
background-color: #000000;
|
113
|
+
font-size: 14px;
|
110
114
|
}
|
111
115
|
|
112
116
|
ul.log {
|
@@ -130,7 +134,7 @@ input[type="search"]::-webkit-search-cancel-button {
|
|
130
134
|
list-style-type: none;
|
131
135
|
color: #393737;
|
132
136
|
padding: 0;
|
133
|
-
font-size:
|
137
|
+
font-size: 14px;
|
134
138
|
font-weight: bold;
|
135
139
|
}
|
136
140
|
|
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
|
+
version: 0.5.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-
|
11
|
+
date: 2025-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: browser_app_base
|