CppUmlClass 0.3.0 → 0.4.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 +40 -34
- 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: 5c8504de4c9118c846499f11af1ef896b3dc88ff8d4f00d3f6011e52a6b1a79f
|
4
|
+
data.tar.gz: 0d45624d9d2089800b0bd66cc9e58cdcd69409b903fdc7b84b01b1bac1211d6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 569cc2d319a77e8e914af09983071b55b1a6d429fa8dae0ed44127e8320b95402f8cacfca8ce0344d0d6d08fd2d615a0f25aeb8a522cf3dba50bf3394e9fdfad
|
7
|
+
data.tar.gz: 8440742f0a2628cdfccaf195d8a1ed3621ad2841eafdc0e3059f44649d0eb252f4472e8663a4141d891085e5e2e2c0cdd3e6015922e69141f0b2638740bd9571
|
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,7 +177,7 @@ 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(/\{/)
|
@@ -186,7 +186,7 @@ def composition_list_create(in_dir, out_list)
|
|
186
186
|
if line.match(/\}/)
|
187
187
|
block_count -= 1
|
188
188
|
end
|
189
|
-
puts "block_count=#{block_count}"
|
189
|
+
#puts "comp:block_count=#{block_count}"
|
190
190
|
|
191
191
|
# classの開始
|
192
192
|
#if line =~ /^\s*(class)\s/ and File.extname(file) == ".h"
|
@@ -196,20 +196,21 @@ def composition_list_create(in_dir, out_list)
|
|
196
196
|
class_name = work.split(" : ")[0].to_s.chomp.match(/ [A-Za-z0-9_:]+/).to_s.split(" ")[0]
|
197
197
|
#base_name = work.split(" : ")[1].to_s.split(" ")[1].to_s.gsub(/<.*>/, "")
|
198
198
|
#puts "start class #{class_name}"
|
199
|
-
|
199
|
+
if class_name.to_s != ""
|
200
|
+
cstruct_list.push CStruct.new(:class_end, class_name, block_count, [], [], [], [])
|
201
|
+
end
|
200
202
|
end
|
201
|
-
|
202
203
|
# 関数の開始
|
203
204
|
#if line =~ /^\S+::\S+/
|
204
205
|
if line.gsub(/<.*>/, "") =~ /^\S.*(\S+)::(\S+).*\(.*{$/ and
|
205
206
|
(File.extname(file) == ".cpp" or File.extname(file) == ".hpp")
|
206
|
-
puts "method start"
|
207
|
+
#puts "comp:method start"
|
207
208
|
#class_name = line.match(/(\w+)(?=<\w*,?\s*\w*>?::\w+\(\))/).to_s
|
208
209
|
#class_name = line.match(/(\w+)(?=::\S+\(\))/).to_s if class_name == ""
|
209
210
|
#class_name = line.match(/(\w+(?:::\w+)*)(?=::\w+\(.*\))/).to_s if class_name == ""
|
210
211
|
#class_name = class_name.split("::")[1] if class_name =~ /::/
|
211
212
|
line.gsub(/<.*>/, "").match(/(\w+)(?=\S+\()/) do |m|
|
212
|
-
puts "class_name=#{m}"
|
213
|
+
#puts "comp:class_name=#{m}"
|
213
214
|
cstruct_list.push CStruct.new(:method_start, m.to_s, block_count, [], [], [], [])
|
214
215
|
break
|
215
216
|
end
|
@@ -225,10 +226,10 @@ def composition_list_create(in_dir, out_list)
|
|
225
226
|
class_block_count = cstruct_list[-1].block_count
|
226
227
|
if block_count == (class_block_count - 1) # block_countが一致
|
227
228
|
# 関数の終了
|
228
|
-
puts "method end #{cstruct_list[-1].name}"
|
229
|
+
#puts "comp:method end #{cstruct_list[-1].name}"
|
229
230
|
cstruct_list.slice!(-1) # 最後の要素を削除
|
230
231
|
else
|
231
|
-
puts "
|
232
|
+
#puts "comp:#{File.basename(file)}:#{block_count}:line3=#{line}"
|
232
233
|
my_class_name = cstruct_list[-1].name
|
233
234
|
my_cstruct = out_list.select { |m| m.name == my_class_name }[1]
|
234
235
|
#pp my_cstruct
|
@@ -237,7 +238,7 @@ def composition_list_create(in_dir, out_list)
|
|
237
238
|
out_list.each do |clist|
|
238
239
|
next if clist.name == my_cstruct.name
|
239
240
|
use_class_name = clist.name
|
240
|
-
puts "my_class_name=#{my_class_name} : use_class_name=#{use_class_name}"
|
241
|
+
#puts "my_class_name=#{my_class_name} : use_class_name=#{use_class_name}"
|
241
242
|
if check_word(line, use_class_name)
|
242
243
|
#if line.include?(use_class_name)
|
243
244
|
my_cstruct.composition_list.push use_class_name
|
@@ -256,7 +257,7 @@ def create_uml_class(in_dir, out_file)
|
|
256
257
|
out = []
|
257
258
|
out.push "@startuml"
|
258
259
|
|
259
|
-
puts "in_dir = #{in_dir}"
|
260
|
+
#puts "in_dir = #{in_dir}"
|
260
261
|
main_composition_list = []
|
261
262
|
main_method_list = []
|
262
263
|
global_var = []
|
@@ -264,11 +265,11 @@ def create_uml_class(in_dir, out_file)
|
|
264
265
|
out_list = []
|
265
266
|
#Dir.glob("#{in_dir}/**/*.{cpp,hpp,h}") do |file|
|
266
267
|
Dir.glob("#{in_dir}/**/*.{h}") do |file|
|
267
|
-
if file =~ Regexp.new(@config["exclude_path"])
|
268
|
-
puts "skip #{file}"
|
268
|
+
if @config["exclude_path"].to_s != "" and file =~ Regexp.new(@config["exclude_path"])
|
269
|
+
#puts "skip #{file}"
|
269
270
|
next
|
270
271
|
end
|
271
|
-
puts file
|
272
|
+
#puts file
|
272
273
|
# ソースコードの整形
|
273
274
|
buf = update_source(file)
|
274
275
|
|
@@ -280,7 +281,7 @@ def create_uml_class(in_dir, out_file)
|
|
280
281
|
buf.each_line do |line|
|
281
282
|
next if line =~ /^[\r\n]*$/ # 空行は対象外
|
282
283
|
next if line =~ /^#/ # #から始まる行は対象外
|
283
|
-
puts line
|
284
|
+
#puts line
|
284
285
|
|
285
286
|
# ブロックの開始/終了
|
286
287
|
if line.match(/\{/)
|
@@ -292,8 +293,11 @@ def create_uml_class(in_dir, out_file)
|
|
292
293
|
# ブロックの終了
|
293
294
|
if line.match(/\}/)
|
294
295
|
block_count -= line.each_char.select { |c| c == "}" }.size
|
296
|
+
end_block = true
|
297
|
+
else
|
298
|
+
end_block = false
|
295
299
|
end
|
296
|
-
puts "block_count=#{block_count}"
|
300
|
+
#puts "block_count=#{block_count}"
|
297
301
|
|
298
302
|
# classの開始
|
299
303
|
#if line =~ /^\s*(class)\s/
|
@@ -305,10 +309,10 @@ def create_uml_class(in_dir, out_file)
|
|
305
309
|
work.split(" : ")[1].to_s.gsub(/(public |private |protected )/, "").to_s.gsub(/<.*>/, "").split(" ").each do |name|
|
306
310
|
base_name.push name if name =~ /\w+/
|
307
311
|
end
|
308
|
-
puts "start class [#{class_name}]"
|
309
|
-
if class_name == ""
|
312
|
+
#puts "start class [#{class_name}]"
|
313
|
+
if class_name.to_s == ""
|
310
314
|
puts file
|
311
|
-
|
315
|
+
next
|
312
316
|
end
|
313
317
|
#if out_list.size != 0 and out_list[-1].type == :class_start # classが連続している
|
314
318
|
# class_name = out_list[-1].name + "." + class_name
|
@@ -321,7 +325,7 @@ def create_uml_class(in_dir, out_file)
|
|
321
325
|
#pp line if class_name == ""
|
322
326
|
base_name.each do |name|
|
323
327
|
name.gsub!(/,/, "")
|
324
|
-
puts "base_name=#{name}"
|
328
|
+
#puts "base_name=#{name}"
|
325
329
|
cstruct_list[-1].inherit_list.push name
|
326
330
|
end
|
327
331
|
end
|
@@ -342,7 +346,7 @@ def create_uml_class(in_dir, out_file)
|
|
342
346
|
# 関数名を取り出す
|
343
347
|
method = line.split(" : ")[0].gsub(/^\s+/, "")
|
344
348
|
method = method.split(";")[0].split("{")[0]
|
345
|
-
puts "method=#{method}"
|
349
|
+
#puts "method=#{method}"
|
346
350
|
method_list = cstruct_list[-1].method_list
|
347
351
|
case method_type
|
348
352
|
when :public
|
@@ -357,7 +361,9 @@ def create_uml_class(in_dir, out_file)
|
|
357
361
|
|
358
362
|
# class変数
|
359
363
|
# 括弧を含まない、かつtemplateを含まない文字列
|
360
|
-
if cstruct_list.size != 0 and
|
364
|
+
if cstruct_list.size != 0 and
|
365
|
+
(block_count == cstruct_list[-1].block_count or
|
366
|
+
(end_block == true and block_count + 1 == cstruct_list[-1].block_count))
|
361
367
|
if line =~ /^[^(){}]*$/ and
|
362
368
|
line =~ /^((?!\/tmp\/).)*$/ and
|
363
369
|
line =~ /^((?!namespace).)*$/ and
|
@@ -365,7 +371,7 @@ def create_uml_class(in_dir, out_file)
|
|
365
371
|
line =~ /^((?!public:).)*$/ and
|
366
372
|
line =~ /^((?!private:).)*$/ and
|
367
373
|
line =~ /^((?!protected:).)*$/
|
368
|
-
puts "class member=#{line}"
|
374
|
+
#puts "class member=#{line}"
|
369
375
|
#val = line.split("=")[0].split(" ")[-1]
|
370
376
|
val = line.split("=")[0]
|
371
377
|
val = val.split(";")[0]
|
@@ -385,7 +391,7 @@ def create_uml_class(in_dir, out_file)
|
|
385
391
|
if cstruct_list.size != 0
|
386
392
|
class_block_count = cstruct_list[-1].block_count
|
387
393
|
if block_count == (class_block_count - 1) # block_countが一致
|
388
|
-
puts "class end #{cstruct_list[-1].name}"
|
394
|
+
#puts "class end #{cstruct_list[-1].name}"
|
389
395
|
out_list.push cstruct_list[-1]
|
390
396
|
cstruct_list.slice!(-1) # 最後の要素を削除
|
391
397
|
end
|
@@ -425,7 +431,7 @@ def create_uml_class(in_dir, out_file)
|
|
425
431
|
end
|
426
432
|
|
427
433
|
def search_func(file)
|
428
|
-
puts file
|
434
|
+
#puts file
|
429
435
|
# ソースコードの整形
|
430
436
|
buf = update_source(file)
|
431
437
|
# ソースを解析
|
@@ -434,9 +440,9 @@ def search_func(file)
|
|
434
440
|
next if line =~ /^#/ # #から始まる行は対象外
|
435
441
|
#puts line
|
436
442
|
if line.gsub(/<.*>/, "") =~ /^\S.*(\S+)::(\S+).*\(.*{$/
|
437
|
-
puts line.gsub!(/<.*>/, "")
|
443
|
+
#puts line.gsub!(/<.*>/, "")
|
438
444
|
line.match(/(\w+)(?=\S+\()/) do |m|
|
439
|
-
puts "class_name=#{m}"
|
445
|
+
#puts "class_name=#{m}"
|
440
446
|
end
|
441
447
|
end
|
442
448
|
end
|
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.4.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-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: browser_app_base
|