CppUmlClass 0.2.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 +7 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +132 -0
- data/CppUmlClass.gemspec +40 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +127 -0
- data/LICENSE +21 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +10 -0
- data/bin/console +11 -0
- data/bin/setup +8 -0
- data/exe/start_cpp_uml_class.rb +52 -0
- data/exe/start_cpp_uml_class.rbw +52 -0
- data/lib/.clang-format +226 -0
- data/lib/CppUmlClass/version.rb +5 -0
- data/lib/CppUmlClass.rb +8 -0
- data/lib/app_load.rb +2 -0
- data/lib/check_word.rb +19 -0
- data/lib/config/browser.json +6 -0
- data/lib/config/setting.json +26 -0
- data/lib/config.ru +107 -0
- data/lib/cpp_uml_class.rb +55 -0
- data/lib/create_uml_class.rb +459 -0
- data/lib/css/index.css +178 -0
- data/lib/html/index.html +80 -0
- data/lib/html/test.html +0 -0
- data/lib/js/main.js +466 -0
- data/lib/my_app_sample.rb +36 -0
- data/lib/server.rb +66 -0
- data/lib/server_app_base.rb +63 -0
- data/lib/start.rb +130 -0
- data/lib/wsserver.rb +145 -0
- data/sig/CppUmlClass.rbs +4 -0
- metadata +96 -0
data/lib/.clang-format
ADDED
@@ -0,0 +1,226 @@
|
|
1
|
+
---
|
2
|
+
Language: Cpp
|
3
|
+
# BasedOnStyle: Google
|
4
|
+
AccessModifierOffset: -1
|
5
|
+
AlignAfterOpenBracket: Align
|
6
|
+
AlignArrayOfStructures: None
|
7
|
+
AlignConsecutiveMacros: None
|
8
|
+
AlignConsecutiveAssignments: None
|
9
|
+
AlignConsecutiveBitFields: None
|
10
|
+
AlignConsecutiveDeclarations: None
|
11
|
+
AlignEscapedNewlines: Left
|
12
|
+
AlignOperands: Align
|
13
|
+
AlignTrailingComments: true
|
14
|
+
AllowAllArgumentsOnNextLine: true
|
15
|
+
AllowAllParametersOfDeclarationOnNextLine: true
|
16
|
+
AllowShortEnumsOnASingleLine: true
|
17
|
+
AllowShortBlocksOnASingleLine: Never
|
18
|
+
AllowShortCaseLabelsOnASingleLine: false
|
19
|
+
AllowShortFunctionsOnASingleLine: All
|
20
|
+
AllowShortLambdasOnASingleLine: All
|
21
|
+
AllowShortIfStatementsOnASingleLine: WithoutElse
|
22
|
+
AllowShortLoopsOnASingleLine: true
|
23
|
+
AlwaysBreakAfterDefinitionReturnType: None
|
24
|
+
AlwaysBreakAfterReturnType: None
|
25
|
+
AlwaysBreakBeforeMultilineStrings: true
|
26
|
+
AlwaysBreakTemplateDeclarations: Yes
|
27
|
+
AttributeMacros:
|
28
|
+
- __capability
|
29
|
+
BinPackArguments: true
|
30
|
+
BinPackParameters: true
|
31
|
+
BraceWrapping:
|
32
|
+
AfterCaseLabel: false
|
33
|
+
AfterClass: false
|
34
|
+
AfterControlStatement: Never
|
35
|
+
AfterEnum: false
|
36
|
+
AfterFunction: false
|
37
|
+
AfterNamespace: false
|
38
|
+
AfterObjCDeclaration: false
|
39
|
+
AfterStruct: false
|
40
|
+
AfterUnion: false
|
41
|
+
AfterExternBlock: false
|
42
|
+
BeforeCatch: false
|
43
|
+
BeforeElse: false
|
44
|
+
BeforeLambdaBody: false
|
45
|
+
BeforeWhile: false
|
46
|
+
IndentBraces: false
|
47
|
+
SplitEmptyFunction: true
|
48
|
+
SplitEmptyRecord: true
|
49
|
+
SplitEmptyNamespace: true
|
50
|
+
BreakBeforeBinaryOperators: None
|
51
|
+
BreakBeforeConceptDeclarations: true
|
52
|
+
BreakBeforeBraces: Attach
|
53
|
+
BreakBeforeInheritanceComma: false
|
54
|
+
BreakInheritanceList: BeforeColon
|
55
|
+
BreakBeforeTernaryOperators: true
|
56
|
+
BreakConstructorInitializersBeforeComma: false
|
57
|
+
BreakConstructorInitializers: BeforeColon
|
58
|
+
BreakAfterJavaFieldAnnotations: false
|
59
|
+
BreakStringLiterals: true
|
60
|
+
ColumnLimit: 9999
|
61
|
+
CommentPragmas: '^ IWYU pragma:'
|
62
|
+
QualifierAlignment: Leave
|
63
|
+
CompactNamespaces: false
|
64
|
+
ConstructorInitializerIndentWidth: 4
|
65
|
+
ContinuationIndentWidth: 4
|
66
|
+
Cpp11BracedListStyle: true
|
67
|
+
DeriveLineEnding: true
|
68
|
+
DerivePointerAlignment: true
|
69
|
+
DisableFormat: false
|
70
|
+
EmptyLineAfterAccessModifier: Never
|
71
|
+
EmptyLineBeforeAccessModifier: LogicalBlock
|
72
|
+
ExperimentalAutoDetectBinPacking: false
|
73
|
+
PackConstructorInitializers: NextLine
|
74
|
+
BasedOnStyle: ''
|
75
|
+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
76
|
+
AllowAllConstructorInitializersOnNextLine: true
|
77
|
+
FixNamespaceComments: true
|
78
|
+
ForEachMacros:
|
79
|
+
- foreach
|
80
|
+
- Q_FOREACH
|
81
|
+
- BOOST_FOREACH
|
82
|
+
IfMacros:
|
83
|
+
- KJ_IF_MAYBE
|
84
|
+
IncludeBlocks: Regroup
|
85
|
+
IncludeCategories:
|
86
|
+
- Regex: '^<ext/.*\.h>'
|
87
|
+
Priority: 2
|
88
|
+
SortPriority: 0
|
89
|
+
CaseSensitive: false
|
90
|
+
- Regex: '^<.*\.h>'
|
91
|
+
Priority: 1
|
92
|
+
SortPriority: 0
|
93
|
+
CaseSensitive: false
|
94
|
+
- Regex: '^<.*'
|
95
|
+
Priority: 2
|
96
|
+
SortPriority: 0
|
97
|
+
CaseSensitive: false
|
98
|
+
- Regex: '.*'
|
99
|
+
Priority: 3
|
100
|
+
SortPriority: 0
|
101
|
+
CaseSensitive: false
|
102
|
+
IncludeIsMainRegex: '([-_](test|unittest))?$'
|
103
|
+
IncludeIsMainSourceRegex: ''
|
104
|
+
IndentAccessModifiers: false
|
105
|
+
IndentCaseLabels: true
|
106
|
+
IndentCaseBlocks: false
|
107
|
+
IndentGotoLabels: true
|
108
|
+
IndentPPDirectives: None
|
109
|
+
IndentExternBlock: AfterExternBlock
|
110
|
+
IndentRequires: false
|
111
|
+
IndentWidth: 2
|
112
|
+
IndentWrappedFunctionNames: false
|
113
|
+
InsertTrailingCommas: None
|
114
|
+
JavaScriptQuotes: Leave
|
115
|
+
JavaScriptWrapImports: true
|
116
|
+
KeepEmptyLinesAtTheStartOfBlocks: false
|
117
|
+
LambdaBodyIndentation: Signature
|
118
|
+
MacroBlockBegin: ''
|
119
|
+
MacroBlockEnd: ''
|
120
|
+
MaxEmptyLinesToKeep: 1
|
121
|
+
NamespaceIndentation: None
|
122
|
+
ObjCBinPackProtocolList: Never
|
123
|
+
ObjCBlockIndentWidth: 2
|
124
|
+
ObjCBreakBeforeNestedBlockParam: true
|
125
|
+
ObjCSpaceAfterProperty: false
|
126
|
+
ObjCSpaceBeforeProtocolList: true
|
127
|
+
PenaltyBreakAssignment: 2
|
128
|
+
PenaltyBreakBeforeFirstCallParameter: 1
|
129
|
+
PenaltyBreakComment: 300
|
130
|
+
PenaltyBreakFirstLessLess: 120
|
131
|
+
PenaltyBreakOpenParenthesis: 0
|
132
|
+
PenaltyBreakString: 1000
|
133
|
+
PenaltyBreakTemplateDeclaration: 10
|
134
|
+
PenaltyExcessCharacter: 1000000
|
135
|
+
PenaltyReturnTypeOnItsOwnLine: 200
|
136
|
+
PenaltyIndentedWhitespace: 0
|
137
|
+
PointerAlignment: Left
|
138
|
+
PPIndentWidth: -1
|
139
|
+
RawStringFormats:
|
140
|
+
- Language: Cpp
|
141
|
+
Delimiters:
|
142
|
+
- cc
|
143
|
+
- CC
|
144
|
+
- cpp
|
145
|
+
- Cpp
|
146
|
+
- CPP
|
147
|
+
- 'c++'
|
148
|
+
- 'C++'
|
149
|
+
CanonicalDelimiter: ''
|
150
|
+
BasedOnStyle: google
|
151
|
+
- Language: TextProto
|
152
|
+
Delimiters:
|
153
|
+
- pb
|
154
|
+
- PB
|
155
|
+
- proto
|
156
|
+
- PROTO
|
157
|
+
EnclosingFunctions:
|
158
|
+
- EqualsProto
|
159
|
+
- EquivToProto
|
160
|
+
- PARSE_PARTIAL_TEXT_PROTO
|
161
|
+
- PARSE_TEST_PROTO
|
162
|
+
- PARSE_TEXT_PROTO
|
163
|
+
- ParseTextOrDie
|
164
|
+
- ParseTextProtoOrDie
|
165
|
+
- ParseTestProto
|
166
|
+
- ParsePartialTestProto
|
167
|
+
CanonicalDelimiter: pb
|
168
|
+
BasedOnStyle: google
|
169
|
+
ReferenceAlignment: Pointer
|
170
|
+
ReflowComments: true
|
171
|
+
RemoveBracesLLVM: false
|
172
|
+
SeparateDefinitionBlocks: Leave
|
173
|
+
ShortNamespaceLines: 1
|
174
|
+
SortIncludes: CaseSensitive
|
175
|
+
SortJavaStaticImport: Before
|
176
|
+
SortUsingDeclarations: true
|
177
|
+
SpaceAfterCStyleCast: false
|
178
|
+
SpaceAfterLogicalNot: false
|
179
|
+
SpaceAfterTemplateKeyword: true
|
180
|
+
SpaceBeforeAssignmentOperators: true
|
181
|
+
SpaceBeforeCaseColon: false
|
182
|
+
SpaceBeforeCpp11BracedList: false
|
183
|
+
SpaceBeforeCtorInitializerColon: true
|
184
|
+
SpaceBeforeInheritanceColon: true
|
185
|
+
SpaceBeforeParens: ControlStatements
|
186
|
+
SpaceBeforeParensOptions:
|
187
|
+
AfterControlStatements: true
|
188
|
+
AfterForeachMacros: true
|
189
|
+
AfterFunctionDefinitionName: false
|
190
|
+
AfterFunctionDeclarationName: false
|
191
|
+
AfterIfMacros: true
|
192
|
+
AfterOverloadedOperator: false
|
193
|
+
BeforeNonEmptyParentheses: false
|
194
|
+
SpaceAroundPointerQualifiers: Default
|
195
|
+
SpaceBeforeRangeBasedForLoopColon: true
|
196
|
+
SpaceInEmptyBlock: false
|
197
|
+
SpaceInEmptyParentheses: false
|
198
|
+
SpacesBeforeTrailingComments: 2
|
199
|
+
SpacesInAngles: Never
|
200
|
+
SpacesInConditionalStatement: false
|
201
|
+
SpacesInContainerLiterals: true
|
202
|
+
SpacesInCStyleCastParentheses: false
|
203
|
+
SpacesInLineCommentPrefix:
|
204
|
+
Minimum: 1
|
205
|
+
Maximum: -1
|
206
|
+
SpacesInParentheses: false
|
207
|
+
SpacesInSquareBrackets: false
|
208
|
+
SpaceBeforeSquareBrackets: false
|
209
|
+
BitFieldColonSpacing: Both
|
210
|
+
Standard: Auto
|
211
|
+
StatementAttributeLikeMacros:
|
212
|
+
- Q_EMIT
|
213
|
+
StatementMacros:
|
214
|
+
- Q_UNUSED
|
215
|
+
- QT_REQUIRE_VERSION
|
216
|
+
TabWidth: 8
|
217
|
+
UseCRLF: false
|
218
|
+
UseTab: Never
|
219
|
+
WhitespaceSensitiveMacros:
|
220
|
+
- STRINGIZE
|
221
|
+
- PP_STRINGIZE
|
222
|
+
- BOOST_PP_STRINGIZE
|
223
|
+
- NS_SWIFT_NAME
|
224
|
+
- CF_SWIFT_NAME
|
225
|
+
...
|
226
|
+
|
data/lib/CppUmlClass.rb
ADDED
data/lib/app_load.rb
ADDED
data/lib/check_word.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
def check_word(buf, check_word)
|
4
|
+
# 正規表現を使って単語を抽出する
|
5
|
+
words = buf.scan(/\b\w+\b/)
|
6
|
+
|
7
|
+
# 抽出した単語を表示する
|
8
|
+
words.each do |word|
|
9
|
+
#puts "#{word} == #{check_word}"
|
10
|
+
# 完全一致
|
11
|
+
return true if word == check_word
|
12
|
+
end
|
13
|
+
return false
|
14
|
+
end
|
15
|
+
|
16
|
+
if $0 == __FILE__
|
17
|
+
buf = File.read(ARGV[0])
|
18
|
+
check_word(buf, ARGV[1])
|
19
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
{
|
2
|
+
"version": 0.1,
|
3
|
+
"setting_list": [
|
4
|
+
{
|
5
|
+
"name": "plantuml",
|
6
|
+
"value": "plantuml -svg --charset UTF-8",
|
7
|
+
"type": "input",
|
8
|
+
"select": "",
|
9
|
+
"description": "PlantUMLコマンド"
|
10
|
+
},
|
11
|
+
{
|
12
|
+
"name": "editor",
|
13
|
+
"value": "code",
|
14
|
+
"type": "input",
|
15
|
+
"select": "",
|
16
|
+
"description": "UMLを開くエディタ"
|
17
|
+
},
|
18
|
+
{
|
19
|
+
"name": "exclude_path",
|
20
|
+
"value": "(/test/)",
|
21
|
+
"type": "input",
|
22
|
+
"select": "",
|
23
|
+
"description": "除外するパス(正規表現)"
|
24
|
+
}
|
25
|
+
]
|
26
|
+
}
|
data/lib/config.ru
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require "sinatra"
|
3
|
+
require "sinatra/contrib"
|
4
|
+
require "sinatra-websocket"
|
5
|
+
require "thin"
|
6
|
+
require "json"
|
7
|
+
|
8
|
+
require "./server"
|
9
|
+
require "./wsserver"
|
10
|
+
|
11
|
+
access_log = File.new("#{$home_dir}/logs/sinatra.log", "a+")
|
12
|
+
access_log.sync = true
|
13
|
+
use Rack::CommonLogger, access_log
|
14
|
+
|
15
|
+
get "/" do
|
16
|
+
File.read("html/index.html")
|
17
|
+
end
|
18
|
+
|
19
|
+
get "*.html" do |file|
|
20
|
+
content_type "text/html", :charset => "utf-8"
|
21
|
+
File.read "./html/#{file}.html"
|
22
|
+
end
|
23
|
+
|
24
|
+
get "/css/:name.css" do
|
25
|
+
content_type "text/css", :charset => "utf-8"
|
26
|
+
puts "css/#{params[:name]}.css"
|
27
|
+
File.read "css/#{params[:name]}.css"
|
28
|
+
end
|
29
|
+
|
30
|
+
get "/js/:name.js" do
|
31
|
+
content_type "text/javascript", :charset => "utf-8"
|
32
|
+
puts "js/#{params[:name]}.js"
|
33
|
+
File.read "js/#{params[:name]}.js"
|
34
|
+
end
|
35
|
+
|
36
|
+
get "/config/*.*" do |file, ext|
|
37
|
+
content_type "text/json", :charset => "utf-8"
|
38
|
+
puts "#{file}.#{ext}"
|
39
|
+
File.read "#{$home_dir}/config/#{file}.#{ext}"
|
40
|
+
end
|
41
|
+
|
42
|
+
post "/history/*.*" do |file, ext|
|
43
|
+
content_type "text/json", :charset => "utf-8"
|
44
|
+
puts "#{file}.#{ext}"
|
45
|
+
p = params[:param1]
|
46
|
+
begin
|
47
|
+
buf = File.read "#{$home_dir}/history/#{file}.#{ext}"
|
48
|
+
rescue
|
49
|
+
buf = ""
|
50
|
+
end
|
51
|
+
data = eval(buf)
|
52
|
+
if data != nil
|
53
|
+
if p != ""
|
54
|
+
JSON.generate data.find_all { |d| d =~ Regexp.new(p) }
|
55
|
+
else
|
56
|
+
JSON.generate data
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
get "/open_dialog" do
|
62
|
+
dialog_html = <<'EOS'
|
63
|
+
<!DOCTYPE html>
|
64
|
+
<html>
|
65
|
+
<head>
|
66
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
67
|
+
<title>Message Dialog</title>
|
68
|
+
<style type="text/css">
|
69
|
+
<!--
|
70
|
+
body {
|
71
|
+
color: #000000;
|
72
|
+
background-color: #ffffff;
|
73
|
+
overflow: hidden;
|
74
|
+
font-size: 12px;
|
75
|
+
}
|
76
|
+
-->
|
77
|
+
</style>
|
78
|
+
</head>
|
79
|
+
EOS
|
80
|
+
dialog_html += "<body>" + params["msg"] + "</body></html>"
|
81
|
+
end
|
82
|
+
|
83
|
+
map "/search" do
|
84
|
+
run Search
|
85
|
+
end
|
86
|
+
|
87
|
+
map "/wsserver" do
|
88
|
+
res = catch(:halt) do
|
89
|
+
run WsServer
|
90
|
+
end
|
91
|
+
puts res
|
92
|
+
end
|
93
|
+
|
94
|
+
configure do
|
95
|
+
set :DoNotReverseLookup, true
|
96
|
+
set :logging, true
|
97
|
+
set :default_encoding, "utf-8"
|
98
|
+
set :server, :thin
|
99
|
+
|
100
|
+
# Thread.start {
|
101
|
+
# }
|
102
|
+
|
103
|
+
end
|
104
|
+
|
105
|
+
#\ --port 38249
|
106
|
+
|
107
|
+
run Sinatra::Application
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require "server_app_base.rb"
|
3
|
+
require "kconv"
|
4
|
+
#require "create_uml_class.rb"
|
5
|
+
|
6
|
+
class CppUmlClass < AppMainBase
|
7
|
+
def start(argv)
|
8
|
+
super
|
9
|
+
begin
|
10
|
+
@abort = false
|
11
|
+
puts argv
|
12
|
+
in_dir = argv[0]
|
13
|
+
out_file = argv[1]
|
14
|
+
|
15
|
+
# 履歴の保存
|
16
|
+
add_history("history.json", in_dir)
|
17
|
+
add_history("out_history.json", out_file)
|
18
|
+
|
19
|
+
# Browserにメッセージ送信
|
20
|
+
app_send("app_start:")
|
21
|
+
|
22
|
+
out_svg = out_file.gsub(File.extname(out_file), "") + ".svg"
|
23
|
+
|
24
|
+
# uml作成
|
25
|
+
load "create_uml_class.rb"
|
26
|
+
|
27
|
+
uml = create_uml_class(in_dir, out_file)
|
28
|
+
|
29
|
+
File.open(out_file, "w") do |f|
|
30
|
+
f.puts uml
|
31
|
+
end
|
32
|
+
|
33
|
+
# PlantUMLの実行
|
34
|
+
FileUtils.rm_f out_svg
|
35
|
+
cmd = "#{@config["plantuml"]} #{out_file}"
|
36
|
+
puts cmd
|
37
|
+
system cmd
|
38
|
+
if File.exist? out_svg
|
39
|
+
yield File.read out_svg
|
40
|
+
else
|
41
|
+
yield "exec error"
|
42
|
+
yield cmd
|
43
|
+
end
|
44
|
+
rescue
|
45
|
+
puts $!
|
46
|
+
puts $@
|
47
|
+
yield $!.to_s.toutf8
|
48
|
+
yield $@.to_s.toutf8
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def stop()
|
53
|
+
super
|
54
|
+
end
|
55
|
+
end
|