aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNao Pross <naopross@thearcway.org>2017-11-28 15:05:02 +0100
committerNao Pross <naopross@thearcway.org>2017-11-28 15:05:02 +0100
commit12e86e71ca36a58d7e2ed64f0454b65ed6f7eb56 (patch)
tree466f7d2756b0619921e2d9d061862c8443649ed3
parentUpdate header ifdefs to match and clean up comments (diff)
downloadOrbitingYeti-12e86e71ca36a58d7e2ed64f0454b65ed6f7eb56.tar.gz
OrbitingYeti-12e86e71ca36a58d7e2ed64f0454b65ed6f7eb56.zip
New data structure for Structogram and Statements
Diffstat (limited to '')
-rw-r--r--.cproject23
-rw-r--r--.settings/language.settings.xml4
-rw-r--r--.settings/org.eclipse.cdt.core.prefs164
-rw-r--r--.settings/org.eclipse.cdt.ui.prefs3
-rw-r--r--src/diagram/BranchStatement.cpp23
-rw-r--r--src/diagram/BranchStatement.hpp32
-rw-r--r--src/diagram/IteratorStatement.cpp25
-rw-r--r--src/diagram/IteratorStatement.hpp32
-rw-r--r--src/diagram/Scope.cpp77
-rw-r--r--src/diagram/Scope.hpp59
-rw-r--r--src/diagram/Statement.cpp17
-rw-r--r--src/diagram/Statement.hpp56
-rw-r--r--src/diagram/Structogram.cpp128
-rw-r--r--src/diagram/Structogram.hpp70
-rw-r--r--src/main.cpp20
-rw-r--r--src/ui/AsciiRenderer.cpp100
-rw-r--r--src/ui/AsciiRenderer.hpp37
-rw-r--r--src/ui/Window.cpp20
-rw-r--r--src/ui/Window.hpp9
19 files changed, 504 insertions, 395 deletions
diff --git a/.cproject b/.cproject
index 153dab5..cd710d3 100644
--- a/.cproject
+++ b/.cproject
@@ -9,6 +9,8 @@
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
@@ -16,11 +18,15 @@
<folderInfo id="cdt.managedbuild.config.gnu.exe.debug.843585591." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.1015131656" name="Linux GCC" nonInternalBuilderId="cdt.managedbuild.target.gnu.builder.exe.debug" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.debug.623837482" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/>
- <builder autoBuildTarget="all" buildPath="${workspace_loc:/OrbitingYeti}/Debug" cleanBuildTarget="clean" id="org.eclipse.cdt.build.core.internal.builder.1089911191" incrementalBuildTarget="all" managedBuildOn="true" name="CDT Internal Builder" superClass="org.eclipse.cdt.build.core.internal.builder"/>
+ <builder autoBuildTarget="all" buildPath="${workspace_loc:/OrbitingYeti}/Debug" cleanBuildTarget="clean" enableAutoBuild="false" enableCleanBuild="true" enabledIncrementalBuild="true" id="cdt.managedbuild.target.gnu.builder.exe.debug.536100041" incrementalBuildTarget="all" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="false" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.1299140126" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1698391423" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
<option id="gnu.cpp.compiler.exe.debug.option.optimization.level.1212687966" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.exe.debug.option.debugging.level.338161566" name="Debug Level" superClass="gnu.cpp.compiler.exe.debug.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
+ <option id="gnu.cpp.compiler.option.include.paths.1920459166" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
+ <listOptionValue builtIn="false" value="/usr/include/QtCore"/>
+ <listOptionValue builtIn="false" value="/usr/include/QtGui"/>
+ </option>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.625532656" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.1244401962" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.debug">
@@ -40,6 +46,19 @@
</tool>
</toolChain>
</folderInfo>
+ <folderInfo id="cdt.managedbuild.config.gnu.exe.debug.843585591.1666080169" name="/" resourcePath="src/ui">
+ <toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.81327856" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.debug" unusedChildren="">
+ <tool id="cdt.managedbuild.tool.gnu.archiver.base.202274387" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base.1299140126"/>
+ <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.619536697" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1698391423"/>
+ <tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.1955969425" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.1244401962"/>
+ <tool id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.1348719930" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug.1838111397"/>
+ <tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.1760334282" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.1222444446"/>
+ <tool id="cdt.managedbuild.tool.gnu.assembler.exe.debug.921133211" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.debug.1551897999"/>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry excluding="src/ui" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
+ </sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
@@ -111,7 +130,7 @@
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="Debug">
- <resource resourceType="PROJECT" workspacePath="/TitaniumLadybug"/>
+ <resource resourceType="PROJECT" workspacePath="/OrbitingYeti"/>
</configuration>
<configuration configurationName="Release">
<resource resourceType="PROJECT" workspacePath="/TitaniumLadybug"/>
diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml
index 2f107c6..e8985aa 100644
--- a/.settings/language.settings.xml
+++ b/.settings/language.settings.xml
@@ -5,7 +5,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
- <provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="600335701843768168" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
+ <provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-217317491240734574" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
@@ -16,7 +16,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
- <provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="600335701843768168" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
+ <provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-217317491240734574" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
diff --git a/.settings/org.eclipse.cdt.core.prefs b/.settings/org.eclipse.cdt.core.prefs
new file mode 100644
index 0000000..46df3d6
--- /dev/null
+++ b/.settings/org.eclipse.cdt.core.prefs
@@ -0,0 +1,164 @@
+eclipse.preferences.version=1
+org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.cdt.core.formatter.alignment_for_assignment=16
+org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration=80
+org.eclipse.cdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.cdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.cdt.core.formatter.alignment_for_conditional_expression=34
+org.eclipse.cdt.core.formatter.alignment_for_conditional_expression_chain=18
+org.eclipse.cdt.core.formatter.alignment_for_constructor_initializer_list=0
+org.eclipse.cdt.core.formatter.alignment_for_declarator_list=16
+org.eclipse.cdt.core.formatter.alignment_for_enumerator_list=48
+org.eclipse.cdt.core.formatter.alignment_for_expression_list=0
+org.eclipse.cdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.cdt.core.formatter.alignment_for_member_access=0
+org.eclipse.cdt.core.formatter.alignment_for_overloaded_left_shift_chain=16
+org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.cdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_namespace_declaration=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.cdt.core.formatter.comment.line_up_line_comment_in_blocks_on_first_column=false
+org.eclipse.cdt.core.formatter.comment.min_distance_between_code_and_line_comment=1
+org.eclipse.cdt.core.formatter.comment.never_indent_line_comments_on_first_column=true
+org.eclipse.cdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=true
+org.eclipse.cdt.core.formatter.compact_else_if=true
+org.eclipse.cdt.core.formatter.continuation_indentation=2
+org.eclipse.cdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.cdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.cdt.core.formatter.indent_access_specifier_compare_to_type_header=false
+org.eclipse.cdt.core.formatter.indent_access_specifier_extra_spaces=0
+org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_access_specifier=true
+org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_namespace_header=false
+org.eclipse.cdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.cdt.core.formatter.indent_declaration_compare_to_template_header=false
+org.eclipse.cdt.core.formatter.indent_empty_lines=false
+org.eclipse.cdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.cdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.cdt.core.formatter.indentation.size=4
+org.eclipse.cdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_after_template_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_colon_in_constructor_initializer_list=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_identifier_in_function_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.cdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.cdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_arguments=insert
+org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_parameters=insert
+org.eclipse.cdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.cdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.cdt.core.formatter.insert_space_after_colon_in_base_clause=insert
+org.eclipse.cdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.cdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.cdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_base_types=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_declarator_list=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_expression_list=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_arguments=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_parameters=insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_bracket=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_exception_specification=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.cdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.cdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.cdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_bracket=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_exception_specification=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_base_clause=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_base_types=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_declarator_list=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_expression_list=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_namespace_declaration=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_exception_specification=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.cdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.cdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_brackets=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_exception_specification=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.cdt.core.formatter.join_wrapped_lines=true
+org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.cdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.cdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.cdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.cdt.core.formatter.lineSplit=80
+org.eclipse.cdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.cdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.cdt.core.formatter.tabulation.char=tab
+org.eclipse.cdt.core.formatter.tabulation.size=4
+org.eclipse.cdt.core.formatter.use_tabs_only_for_leading_indentations=false
diff --git a/.settings/org.eclipse.cdt.ui.prefs b/.settings/org.eclipse.cdt.ui.prefs
new file mode 100644
index 0000000..d22a0e9
--- /dev/null
+++ b/.settings/org.eclipse.cdt.ui.prefs
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+formatter_profile=org.eclipse.cdt.ui.default.kandr_profile
+formatter_settings_version=1
diff --git a/src/diagram/BranchStatement.cpp b/src/diagram/BranchStatement.cpp
new file mode 100644
index 0000000..d960ef9
--- /dev/null
+++ b/src/diagram/BranchStatement.cpp
@@ -0,0 +1,23 @@
+/*
+ * BranchStatement.cpp
+ *
+ * Created on: Nov 28, 2017
+ * Author: naopross
+ */
+
+#include "BranchStatement.hpp"
+
+namespace samb {
+
+BranchStatement::BranchStatement(Type t, const std::string& condition, pointer next): Statement(t, condition, next) {
+ switch (t) {
+ case Statement::Type::DECISION:
+ case Statement::Type::SWITCH:
+ break;
+
+ default:
+ throw std::invalid_argument("BranchStatement can only be of type DECISION or SWITCH");
+ }
+}
+
+} /* namespace samb */
diff --git a/src/diagram/BranchStatement.hpp b/src/diagram/BranchStatement.hpp
new file mode 100644
index 0000000..dacf060
--- /dev/null
+++ b/src/diagram/BranchStatement.hpp
@@ -0,0 +1,32 @@
+/*
+ * BranchStatement.hpp
+ *
+ * Created on: Nov 28, 2017
+ * Author: naopross
+ */
+
+#ifndef SRC_DIAGRAM_BRANCHSTATEMENT_HPP_
+#define SRC_DIAGRAM_BRANCHSTATEMENT_HPP_
+
+#include "Statement.hpp"
+
+namespace samb {
+
+class BranchStatement: public Statement {
+public:
+ BranchStatement(Type t, const std::string& condition, pointer next);
+
+ const std::string& condition() const { return text(); }
+ void condition(const std::string& condition) { return text(condition); }
+
+ std::vector<std::string> branches();
+ std::size_t branchesCount();
+
+private:
+ std::map<std::string, pointer> m_branches;
+ std::size_t m_branchesCount = 0;
+};
+
+} /* namespace samb */
+
+#endif /* SRC_DIAGRAM_BRANCHSTATEMENT_HPP_ */
diff --git a/src/diagram/IteratorStatement.cpp b/src/diagram/IteratorStatement.cpp
new file mode 100644
index 0000000..efb5236
--- /dev/null
+++ b/src/diagram/IteratorStatement.cpp
@@ -0,0 +1,25 @@
+/*
+ * IteratorStatement.cpp
+ *
+ * Created on: Nov 28, 2017
+ * Author: naopross
+ */
+
+#include "IteratorStatement.hpp"
+
+namespace samb {
+
+IteratorStatement::IteratorStatement(Statement::Type t, const std::string& condition, Statement::pointer next)
+ : Statement(t, condition, next), m_inner("") {
+
+ switch (t) {
+ case Statement::Type::WHILE:
+ case Statement::Type::UNTIL:
+ break;
+
+ default:
+ throw std::invalid_argument("IteratorStatement can only be of type WHILE or UNTIL");
+ }
+}
+
+} /* namespace samb */
diff --git a/src/diagram/IteratorStatement.hpp b/src/diagram/IteratorStatement.hpp
new file mode 100644
index 0000000..82a40d9
--- /dev/null
+++ b/src/diagram/IteratorStatement.hpp
@@ -0,0 +1,32 @@
+/*
+ * IteratorStatement.hpp
+ *
+ * Created on: Nov 28, 2017
+ * Author: naopross
+ */
+
+#ifndef SRC_DIAGRAM_ITERATORSTATEMENT_HPP_
+#define SRC_DIAGRAM_ITERATORSTATEMENT_HPP_
+
+#include "Statement.hpp"
+#include "Scope.hpp"
+
+namespace samb {
+
+class IteratorStatement: public Statement {
+public:
+ IteratorStatement(Type t, const std::string& condition, pointer next);
+
+ /* accessors */
+ const Scope& inner() const { return m_inner; }
+
+ inline const std::string& condition() const { return text(); }
+ inline void condition(const std::string& condition) { return text(condition); }
+
+private:
+ Scope m_inner;
+};
+
+} /* namespace samb */
+
+#endif /* SRC_DIAGRAM_ITERATORSTATEMENT_HPP_ */
diff --git a/src/diagram/Scope.cpp b/src/diagram/Scope.cpp
new file mode 100644
index 0000000..335cd20
--- /dev/null
+++ b/src/diagram/Scope.cpp
@@ -0,0 +1,77 @@
+/*
+ * Created on: Nov 28, 2017
+ * Author: naopross
+ */
+
+#include "Scope.hpp"
+
+namespace samb {
+
+/* Scope::iterator */
+
+Scope::iterator::iterator(Statement::pointer statement): m_current(statement) {}
+Scope::iterator::~iterator() {}
+
+Scope::iterator& Scope::iterator::operator++() {
+ if (m_current->next() == nullptr) {
+ // TODO: remote throw
+ throw std::logic_error("Statement::iterator::operator++() m_current->next() is nullptr");
+ }
+
+ m_current = m_current->next();
+
+ return *this;
+}
+
+Scope::iterator& Scope::iterator::operator++(int) {
+ static Scope::iterator old(*this);
+
+ old = *this;
+ operator++();
+ return old;
+}
+
+Statement& Scope::iterator::operator*() const {
+ if (m_current == nullptr) {
+ throw std::logic_error("Statement::iterator::operator*() m_current is nullptr");
+ }
+
+ return *m_current;
+}
+
+Statement::pointer Scope::iterator::operator->() const {
+ return m_current;
+}
+
+
+/* Scope */
+
+Scope::Scope(std::string label): Statement(Statement::Type::SCOPE, label, nullptr), m_head(nullptr), m_tail(nullptr) {}
+Scope::Scope(std::string label, Statement::pointer first): Statement(Statement::Type::SCOPE, label, first), m_head(first), m_tail(first) {}
+
+Scope::~Scope() {}
+
+Scope::iterator Scope::insert_after(Scope::iterator it, Statement::pointer statement) {
+ if (statement == nullptr) {
+ throw std::invalid_argument("Statement::insert_after() cannot insert nullptr");
+ }
+
+ statement->next(it->next());
+ it->next(statement);
+
+ m_size++;
+
+ return it;
+}
+
+Scope::iterator Scope::erase_after(Scope::iterator it) {
+ if (it->next() == nullptr) {
+ return end();
+ }
+
+ it->next(it->next()->next());
+
+ return it;
+}
+
+} /* namespace samb */
diff --git a/src/diagram/Scope.hpp b/src/diagram/Scope.hpp
new file mode 100644
index 0000000..b1fe2f0
--- /dev/null
+++ b/src/diagram/Scope.hpp
@@ -0,0 +1,59 @@
+/*
+ * Created on: Nov 28, 2017
+ * Author: naopross
+ */
+
+#ifndef SRC_DIAGRAM_SCOPE_HPP_
+#define SRC_DIAGRAM_SCOPE_HPP_
+
+#include "Statement.hpp"
+
+namespace samb {
+
+/* The Scope is a forward-iterable object that contains statements.
+ * A scope is also a valid type of statement.
+ *
+ * The Scope object is used inside other complex types of statements such as
+ * BranchStatement or a IteratorStatement, to hold the statements within their
+ * scope.
+ */
+class Scope : public Statement {
+public:
+ class iterator {
+ public:
+ iterator(pointer statement);
+ ~iterator();
+
+ iterator& operator++();
+ iterator& operator++(int);
+
+ Statement& operator*() const;
+ Statement::pointer operator->() const;
+
+ private:
+ Statement::pointer m_current;
+ };
+
+ Scope(std::string label);
+ Scope(std::string label, Statement::pointer first);
+ ~Scope();
+
+ iterator insert_after(iterator it, Statement::pointer statement);
+ iterator erase_after(iterator it);
+
+ /* accessors */
+ std::size_t size() const { return m_size; }
+
+ /* iterator */
+ iterator begin() { return iterator(m_head); }
+ iterator end() { return iterator(m_tail); }
+
+private:
+ Statement::pointer m_head;
+ Statement::pointer m_tail;
+ std::size_t m_size = 0;
+};
+
+} /* namespace samb */
+
+#endif /* SRC_DIAGRAM_SCOPE_HPP_ */
diff --git a/src/diagram/Statement.cpp b/src/diagram/Statement.cpp
index 60be094..d708dd9 100644
--- a/src/diagram/Statement.cpp
+++ b/src/diagram/Statement.cpp
@@ -9,17 +9,14 @@
namespace samb {
-Statement::pointer Statement::makeStatement(Statement::Type t) {
- return std::make_shared<Statement>(Statement(t, "", nullptr, nullptr));
-}
-
-bool Statement::operator==(const Statement& other) {
- return (this->type == other.type) && (this->text == other.text) &&
- (this->next == other.next) && (this->scope == other.scope);
-}
+/* Statement */
+Statement::Statement(Type t, const std::string& text, Statement::pointer p): type(t), m_text(text), m_next(p) {}
-
-Statement::Statement(Type t, std::string txt, Statement::pointer p, Statement::pointer s): type(t), text(txt), next(p), scope(s) {}
Statement::~Statement() {}
+bool Statement::operator==(const Statement& other) const {
+ // comparison by pointers
+ return (this == &other);
+}
+
} /* namespace samb */
diff --git a/src/diagram/Statement.hpp b/src/diagram/Statement.hpp
index 1781a97..4eb3b4d 100644
--- a/src/diagram/Statement.hpp
+++ b/src/diagram/Statement.hpp
@@ -10,35 +10,28 @@
#include <string>
#include <memory>
+#include <vector>
+#include <map>
namespace samb {
-
/* Possible types of statement, according to the NS diagram paper
*
- * PROCESS,
- * DECISION,
- * SWITCH,
- * WHILE,
- * UNTIL,
- * SCOPE,
- * PARALLEL,
+ * PROCESS : a statement that does something
+ * DECISION : splits the program in 2 branches based on a condition
+ * SWITCH : splits the program in n branches depending on a value
+ * WHILE : repeat first loop
+ * UNTIL : repeat last loop
+ * SCOPE : simple scope to isolate variables
+ * PARALLEL : parallel operations
*/
-/* this struct is a link for linked list that stores the data in a tree-like
- * structure, BUT it is not a tree because it allows 2 or more nodes to point
- * at a single node
- *
- * Tree: Statements:
- * A - B - C - D A - B - C - D - G
- * \ \ /
- * E - F E - F
- *
- * Because a statements can be branching elements. (if / switch)
- *
- * This class is also a *Factory* to make statements.
+/* This struct is a statement (link) of the iterable object Scope
+ * (linked list), that is also a common interface for the various types of
+ * statements.
*/
-struct Statement {
+class Statement {
+public:
using pointer = std::shared_ptr<Statement>;
enum Type {
@@ -56,20 +49,25 @@ struct Statement {
* TODO: think of something more elegant to solve this
*/
END
- } type;
+ };
- std::string text;
+ const Type type;
- pointer next;
- pointer scope; // TODO: make iterator aware of scope
+ Statement(Type type, const std::string& text, pointer next);
+ virtual ~Statement();
- static Statement::pointer makeStatement(Type t);
+ bool operator==(const Statement& other) const;
- virtual ~Statement();
- bool operator==(const Statement& other);
+ /* accessors */
+ void next(pointer next) { m_next = next; }
+ pointer next() const { return m_next; }
+
+ void text(const std::string& text) { m_text = text; }
+ const std::string& text() const { return m_text; }
private:
- Statement(Type type, std::string txt, pointer next, pointer scope);
+ std::string m_text;
+ pointer m_next;
};
} /* namespace samb */
diff --git a/src/diagram/Structogram.cpp b/src/diagram/Structogram.cpp
deleted file mode 100644
index 0575748..0000000
--- a/src/diagram/Structogram.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Structogram.cpp
- *
- * Created on: Nov 14, 2017
- * Author: naopross
- */
-
-#include "../diagram/Structogram.hpp"
-#include <memory>
-#include <exception>
-
-
-namespace samb {
-
-/* iterator nested class */
-Structogram::iterator::iterator(Statement::pointer first) {
- m_current = first;
-}
-
-Structogram::iterator::~iterator() {}
-
-Structogram::iterator& Structogram::iterator::operator++() {
- if (m_current->next != nullptr) {
- m_current = m_current->next;
- }
-
- return *this;
-}
-
-Structogram::iterator& Structogram::iterator::operator++(int) {
- static iterator old(*this);
- old = *this;
-
- operator++();
- return old;
-}
-
-bool Structogram::iterator::operator==(const iterator& other) const {
- if (*this->m_current == *other.m_current) {
- return true;
- }
-
- return false;
-}
-
-bool Structogram::iterator::operator!=(const iterator& other) const {
- return !(other == *this);
-}
-
-Statement& Structogram::iterator::operator*() const {
- if (m_current == nullptr) {
- throw std::logic_error("structogram iterator: m_current is nullptr");
- }
-
- return *m_current;
-}
-
-Statement::pointer Structogram::iterator::operator->() const {
- return m_current;
-}
-
-
-/**
- * Structogram class methods
- */
-Structogram::Structogram(std::string title) {
-
- m_size = 0;
- m_title = title;
-
- m_head = Statement::makeStatement(Statement::Type::SCOPE);
- m_tail = Statement::makeStatement(Statement::Type::END);
-
- m_head->next = m_tail;
- m_head->text = m_title;
-}
-
-Structogram::~Structogram() {
- /* no need to destroy anything because of smart pointers */
-}
-
-std::size_t Structogram::size() const {
- return m_size;
-}
-
-Structogram::iterator Structogram::insert_after(Structogram::iterator it, Statement::pointer statement) {
-
- if (statement == nullptr) {
- throw std::invalid_argument("structogram: attempt to insert a null statement");
- }
-
- // TODO: update m_tail
-
- statement->next = it->next;
- it->next = statement;
- m_size++;
-
- return ++it;
-}
-
-Structogram::iterator Structogram::erase_after(iterator it) {
-
- // TODO: error handling IE return a std::pair<iterator, bool>
-
- /* the first statement (scope of the program) cannot be deleted */
- if ((*it) == *m_head) {
- return it;
- }
-
- if (it->next == nullptr) {
- return it;
- }
-
- it->next = it->next->next;
-
- return it;
-}
-
-/* iterator related methods */
-Structogram::iterator Structogram::begin() const {
- return iterator(m_head);
-}
-
-const Structogram::iterator Structogram::end() const {
- return iterator(m_tail);
-}
-
-} /* namespace structograms */
diff --git a/src/diagram/Structogram.hpp b/src/diagram/Structogram.hpp
index 7b036f0..05c2d4d 100644
--- a/src/diagram/Structogram.hpp
+++ b/src/diagram/Structogram.hpp
@@ -1,71 +1,17 @@
/*
- * Structogram.h
+ * Structogram.hpp
*
- * Created on: Nov 14, 2017
+ * Created on: Nov 28, 2017
* Author: naopross
*/
-#ifndef SRC_DIAGRAM_STRUCTOGRAM_H_
-#define SRC_DIAGRAM_STRUCTOGRAM_H_
+#ifndef SRC_DIAGRAM_STRUCTOGRAM_HPP_
+#define SRC_DIAGRAM_STRUCTOGRAM_HPP_
-#include <iostream>
-#include <list>
-
-#include "Statement.hpp"
+#include "Scope.hpp"
namespace samb {
+ typedef Scope Structogram;
+}
-/* A Structogram is a Nassi-Schneiderman diagram, in this implementation it is
- * simply and iterable object that holds statements.
- *
- * The first statement inside a structogram (m_head) is a SCOPE
- * statement that holds the entire program inside it.
- */
-class Structogram {
-public:
- /* forward only iterator */
- class iterator {
- public:
- iterator(Statement::pointer first);
- ~iterator();
-
- iterator& operator++();
- iterator& operator++(int);
-
- bool operator==(const iterator& other) const;
- bool operator!=(const iterator& other) const;
- Statement& operator*() const;
- Statement::pointer operator->() const;
-
- private:
- Statement::pointer m_current;
- };
-
- Structogram(std::string title);
- virtual ~Structogram();
-
- std::size_t size() const;
-
- // cannot be implemented because iter is forward only
-// iterator insert(iterator it, Statement::pointer statement);
-// iterator erase(iterator it);
-
- iterator insert_after(iterator it, Statement::pointer statement);
- iterator erase_after(iterator it);
-
- /* iterator */
- iterator begin() const;
- const iterator end() const;
- const Statement& operator[](const Statement& it) = delete;
-
-private:
- std::size_t m_size;
- std::string m_title;
-
- Statement::pointer m_head;
- Statement::pointer m_tail;
-};
-
-} /* namespace structograms */
-
-#endif /* SRC_DIAGRAM_STRUCTOGRAM_H_ */
+#endif /* SRC_DIAGRAM_STRUCTOGRAM_HPP_ */
diff --git a/src/main.cpp b/src/main.cpp
index 7f70de6..83bba4c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,30 +1,14 @@
#include "diagram/Structogram.hpp"
-#include "diagram/Statement.hpp"
-#include "ui/AsciiRenderer.hpp"
#include <iostream>
#include <memory>
+
using namespace samb;
int main(int argc, char *argv[]) {
- Structogram st("Demo");
- AsciiRenderer renderer(st, 60);
-
- Structogram::iterator it = st.begin();
-
- auto first = Statement::makeStatement(Statement::Type::PROCESS);
- first->text = "Hello World";
-
- auto second = Statement::makeStatement(Statement::Type::PROCESS);
- second->text = "Hello World Again!";
-
- st.insert_after(it, first);
- ++it;
-
- st.insert_after(it, second);
- renderer.render();
+ Structogram st("Example");
return 0;
}
diff --git a/src/ui/AsciiRenderer.cpp b/src/ui/AsciiRenderer.cpp
deleted file mode 100644
index d06dadb..0000000
--- a/src/ui/AsciiRenderer.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Renderer.cpp
- *
- * Created on: Nov 23, 2017
- * Author: naopross
- */
-
-#include "AsciiRenderer.hpp"
-
-#include <memory>
-
-namespace samb {
-
-AsciiRenderer::AsciiRenderer(Structogram& structogram, unsigned int width):
- m_structogram(structogram), m_width(width) {}
-
-AsciiRenderer::~AsciiRenderer() {}
-
-void AsciiRenderer::drawPadding(unsigned int amt) {
- while (amt--) {
- std::cout << " ";
- }
-}
-
-void AsciiRenderer::drawLine() const {
- for (unsigned int i = 0; i < m_width; i++) {
- std::cout << "-";
- }
-
- std::cout << std::endl;
-}
-
-void AsciiRenderer::drawText(std::string text, unsigned int width, std::string before, std::string after) const {
-
- if (width == 0) {
- width = m_width;
- }
-
- unsigned int textWidth = width - before.length() - after.length();
-
- std::cout << before;
- for (std::size_t i = 0; i < text.length(); i++) {
- if (i % textWidth == 0 && i != 0) {
- std::cout << after << "\n" << before;
- }
-
- std::cout << text[i];
- }
-
- std::cout << std::endl;
-}
-
-void AsciiRenderer::drawDecision(std::string condition, std::string trueText, std::string falseText, unsigned int width) const {
- if (width == 0) {
- width = m_width -2;
- }
-
- std::cout << "|";
-
-// drawPadding(width - condition.length());
-}
-
-void AsciiRenderer::render() {
-
- for (Structogram::iterator it = m_structogram.begin(); it != m_structogram.end(); ++it) {
-
- switch (it->type) {
- case Statement::Type::PROCESS:
- drawLine();
- drawText(it->text);
- drawLine();
- break;
-
- case Statement::Type::DECISION:
- break;
-
- case Statement::Type::SWITCH:
- break;
-
- case Statement::Type::SCOPE:
- std::cout << "Title: " << it->text << std::endl;
- break;
-
- case Statement::Type::WHILE:
- break;
-
- case Statement::Type::UNTIL:
- break;
-
- case Statement::Type::PARALLEL:
- break;
-
- case Statement::END:
- // do nothing
- break;
- }
- }
-}
-
-} /* namespace samb */
diff --git a/src/ui/AsciiRenderer.hpp b/src/ui/AsciiRenderer.hpp
deleted file mode 100644
index 76d6ff5..0000000
--- a/src/ui/AsciiRenderer.hpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Renderer.h
- *
- * Created on: Nov 23, 2017
- * Author: naopross
- */
-
-#ifndef SRC_UI_ASCIIRENDERER_HPP_
-#define SRC_UI_ASCIIRENDERER_HPP_
-
-#include "../diagram/Structogram.hpp"
-
-namespace samb {
-
-/* Sample renderer for debug,
- *
- * TODO: implement PdfRenderer, UiRenderer with a common interface
- */
-class AsciiRenderer {
-private:
- Structogram m_structogram;
- const unsigned int m_width;
-
- void drawPadding(unsigned int amt);
- void drawLine() const;
- void drawText(std::string text, unsigned int width = 0, std::string before = "|", std::string after = "|") const;
- void drawDecision(std::string condition, std::string trueText, std::string falseText, unsigned int width = 0) const;
-public:
- AsciiRenderer(Structogram& structogram, unsigned int width);
- ~AsciiRenderer();
-
- void render();
-};
-
-} /* namespace samb */
-
-#endif /* SRC_UI_ASCIIRENDERER_HPP_ */
diff --git a/src/ui/Window.cpp b/src/ui/Window.cpp
index 4572766..e3d5b52 100644
--- a/src/ui/Window.cpp
+++ b/src/ui/Window.cpp
@@ -7,15 +7,29 @@
#include "Window.hpp"
+#include <QVBoxLayout>
+#include <QHBoxLayout>
+#include <QApplication>
+
+
namespace samb {
-Window::Window() {
- // TODO Auto-generated constructor stub
+Window::Window(QWidget *parent): QWidget(parent) {
+ setWindowTitle("OrbitingYeti");
+
+ QVBoxLayout *vBox = new QVBoxLayout(this);
+ QHBoxLayout *hBox = new QHBoxLayout();
+ m_quitBtn = new QPushButton("Quit", this);
+ connect(m_quitBtn, SIGNAL(clicked()), qApp, SLOT(quit()));
+
+ hBox->addWidget(m_quitBtn, 0, Qt::AlignRight);
+ vBox->addStretch(1);
+ vBox->addLayout(hBox);
}
Window::~Window() {
- // TODO Auto-generated destructor stub
+
}
} /* namespace samb */
diff --git a/src/ui/Window.hpp b/src/ui/Window.hpp
index 5afad8c..9b04ebb 100644
--- a/src/ui/Window.hpp
+++ b/src/ui/Window.hpp
@@ -9,17 +9,18 @@
#define SRC_UI_WINDOW_HPP_
#include <QWidget>
+#include <QPushButton>
namespace samb {
class Window : public QWidget {
Q_OBJECT
public:
- Window();
- virtual ~Window();
+ explicit Window(QWidget *parent = 0);
+ ~Window();
-signals:
-public slots:
+private:
+ QPushButton *m_quitBtn;
};
} /* namespace samb */