summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar jonas <himself@jonasgunz.de> 2017-02-15 14:46:46 +0100
committerGravatar jonas <himself@jonasgunz.de> 2017-02-15 14:46:46 +0100
commitbc62c131c515b16d01d38cf964ba99d77b7d01cb (patch)
treed82b3bfb3866afae53ab697966f98b4a56448628
parent7df545ef9faa7f575e411a593d18fbb13c7e8e78 (diff)
downloadtree-bc62c131c515b16d01d38cf964ba99d77b7d01cb.tar.gz
+ Added cli interface
-rw-r--r--tree/.gitignore3
-rw-r--r--tree/.settings/language.settings.xml4
-rw-r--r--tree/Debug/makefile118
-rw-r--r--tree/Debug/sources.mk50
-rw-r--r--tree/Debug/src/subdir.mk42
-rw-r--r--tree/src/main.cpp63
6 files changed, 144 insertions, 136 deletions
diff --git a/tree/.gitignore b/tree/.gitignore
index f9db10c..1af532f 100644
--- a/tree/.gitignore
+++ b/tree/.gitignore
@@ -1,2 +1,3 @@
*.exe
-*.o \ No newline at end of file
+*.o
+/Debug/
diff --git a/tree/.settings/language.settings.xml b/tree/.settings/language.settings.xml
index afdea9b..0d521f3 100644
--- a/tree/.settings/language.settings.xml
+++ b/tree/.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.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-750291126613751836" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
+ <provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="903827296288134848" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross 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.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-750291126613751836" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
+ <provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="903827296288134848" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross 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/tree/Debug/makefile b/tree/Debug/makefile
index 707ea55..beab843 100644
--- a/tree/Debug/makefile
+++ b/tree/Debug/makefile
@@ -1,59 +1,59 @@
-################################################################################
-# Automatically-generated file. Do not edit!
-################################################################################
-
--include ../makefile.init
-
-RM := rm -rf
-
-# All of the sources participating in the build are defined here
--include sources.mk
--include src/subdir.mk
--include subdir.mk
--include objects.mk
-
-ifneq ($(MAKECMDGOALS),clean)
-ifneq ($(strip $(CC_DEPS)),)
--include $(CC_DEPS)
-endif
-ifneq ($(strip $(C++_DEPS)),)
--include $(C++_DEPS)
-endif
-ifneq ($(strip $(C_UPPER_DEPS)),)
--include $(C_UPPER_DEPS)
-endif
-ifneq ($(strip $(CXX_DEPS)),)
--include $(CXX_DEPS)
-endif
-ifneq ($(strip $(C_DEPS)),)
--include $(C_DEPS)
-endif
-ifneq ($(strip $(CPP_DEPS)),)
--include $(CPP_DEPS)
-endif
-endif
-
--include ../makefile.defs
-
-# Add inputs and outputs from these tool invocations to the build variables
-
-# All Target
-all: tree
-
-# Tool invocations
-tree: $(OBJS) $(USER_OBJS)
- @echo 'Building target: $@'
- @echo 'Invoking: Cross G++ Linker'
- g++ -o "tree" $(OBJS) $(USER_OBJS) $(LIBS)
- @echo 'Finished building target: $@'
- @echo ' '
-
-# Other Targets
-clean:
- -$(RM) $(CC_DEPS)$(C++_DEPS)$(EXECUTABLES)$(OBJS)$(C_UPPER_DEPS)$(CXX_DEPS)$(C_DEPS)$(CPP_DEPS) tree
- -@echo ' '
-
-.PHONY: all clean dependents
-.SECONDARY:
-
--include ../makefile.targets
+################################################################################
+# Automatically-generated file. Do not edit!
+################################################################################
+
+-include ../makefile.init
+
+RM := rm -rf
+
+# All of the sources participating in the build are defined here
+-include sources.mk
+-include src/subdir.mk
+-include subdir.mk
+-include objects.mk
+
+ifneq ($(MAKECMDGOALS),clean)
+ifneq ($(strip $(CC_DEPS)),)
+-include $(CC_DEPS)
+endif
+ifneq ($(strip $(C++_DEPS)),)
+-include $(C++_DEPS)
+endif
+ifneq ($(strip $(C_UPPER_DEPS)),)
+-include $(C_UPPER_DEPS)
+endif
+ifneq ($(strip $(CXX_DEPS)),)
+-include $(CXX_DEPS)
+endif
+ifneq ($(strip $(C_DEPS)),)
+-include $(C_DEPS)
+endif
+ifneq ($(strip $(CPP_DEPS)),)
+-include $(CPP_DEPS)
+endif
+endif
+
+-include ../makefile.defs
+
+# Add inputs and outputs from these tool invocations to the build variables
+
+# All Target
+all: tree
+
+# Tool invocations
+tree: $(OBJS) $(USER_OBJS)
+ @echo 'Building target: $@'
+ @echo 'Invoking: Cross G++ Linker'
+ g++ -o "tree" $(OBJS) $(USER_OBJS) $(LIBS)
+ @echo 'Finished building target: $@'
+ @echo ' '
+
+# Other Targets
+clean:
+ -$(RM) $(CC_DEPS)$(C++_DEPS)$(EXECUTABLES)$(OBJS)$(C_UPPER_DEPS)$(CXX_DEPS)$(C_DEPS)$(CPP_DEPS) tree
+ -@echo ' '
+
+.PHONY: all clean dependents
+.SECONDARY:
+
+-include ../makefile.targets
diff --git a/tree/Debug/sources.mk b/tree/Debug/sources.mk
index 2291deb..f9fe80f 100644
--- a/tree/Debug/sources.mk
+++ b/tree/Debug/sources.mk
@@ -1,27 +1,27 @@
-################################################################################
-# Automatically-generated file. Do not edit!
-################################################################################
-
-C_UPPER_SRCS :=
-CXX_SRCS :=
-C++_SRCS :=
-OBJ_SRCS :=
-CC_SRCS :=
-ASM_SRCS :=
-C_SRCS :=
-CPP_SRCS :=
-O_SRCS :=
-S_UPPER_SRCS :=
-CC_DEPS :=
-C++_DEPS :=
-EXECUTABLES :=
-OBJS :=
-C_UPPER_DEPS :=
-CXX_DEPS :=
-C_DEPS :=
-CPP_DEPS :=
-
-# Every subdirectory with source files must be described here
+################################################################################
+# Automatically-generated file. Do not edit!
+################################################################################
+
+C_UPPER_SRCS :=
+CXX_SRCS :=
+C++_SRCS :=
+OBJ_SRCS :=
+CC_SRCS :=
+ASM_SRCS :=
+C_SRCS :=
+CPP_SRCS :=
+O_SRCS :=
+S_UPPER_SRCS :=
+CC_DEPS :=
+C++_DEPS :=
+EXECUTABLES :=
+OBJS :=
+C_UPPER_DEPS :=
+CXX_DEPS :=
+C_DEPS :=
+CPP_DEPS :=
+
+# Every subdirectory with source files must be described here
SUBDIRS := \
src \
-
+
diff --git a/tree/Debug/src/subdir.mk b/tree/Debug/src/subdir.mk
index e0e45bf..24d177a 100644
--- a/tree/Debug/src/subdir.mk
+++ b/tree/Debug/src/subdir.mk
@@ -1,33 +1,33 @@
-################################################################################
-# Automatically-generated file. Do not edit!
-################################################################################
-
-# Add inputs and outputs from these tool invocations to the build variables
+################################################################################
+# Automatically-generated file. Do not edit!
+################################################################################
+
+# Add inputs and outputs from these tool invocations to the build variables
CPP_SRCS += \
../src/cData.cpp \
../src/cNode.cpp \
../src/cTree.cpp \
-../src/main.cpp
-
+../src/main.cpp
+
OBJS += \
./src/cData.o \
./src/cNode.o \
./src/cTree.o \
-./src/main.o
-
+./src/main.o
+
CPP_DEPS += \
./src/cData.d \
./src/cNode.d \
./src/cTree.d \
-./src/main.d
-
-
-# Each subdirectory must supply rules for building sources it contributes
-src/%.o: ../src/%.cpp
- @echo 'Building file: $<'
- @echo 'Invoking: Cross G++ Compiler'
- g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
- @echo 'Finished building: $<'
- @echo ' '
-
-
+./src/main.d
+
+
+# Each subdirectory must supply rules for building sources it contributes
+src/%.o: ../src/%.cpp
+ @echo 'Building file: $<'
+ @echo 'Invoking: Cross G++ Compiler'
+ g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
+ @echo 'Finished building: $<'
+ @echo ' '
+
+
diff --git a/tree/src/main.cpp b/tree/src/main.cpp
index d4c5ed3..10534f3 100644
--- a/tree/src/main.cpp
+++ b/tree/src/main.cpp
@@ -11,11 +11,10 @@
using namespace std;
-int main (void)
-{
- cTree* a = new cTree();
+cTree* a;
- cout << "Filling with data..." << endl;
+void fill()
+{
for (char b = ' '; b <= '~'; b++) //insert some data into tree
{
for(char c = ' '; c<= '~'; c++)
@@ -27,37 +26,45 @@ int main (void)
a->insert(ss.str());
}
}
+}
- //a->draw();
- cout << "size: "<< a->size() << endl << "Unbalance: " << a->gradeOfUnbalance() << endl << "Depth: " << a->depth() << endl;
- cout << "deleting element" << endl;
- a->remove((*a)[100]);
- cout << "Balancing..." << endl;
- a->draw();
- a->sort();
- cout << "size: "<< a->size() << endl << "Unbalance: " << a->gradeOfUnbalance() << endl << "Depth: " << a->depth() << endl;
- //
- cout << "-------------------" << endl;
- a->draw();
+int main (void)
+{
+ a = new cTree();
+ int iInputOption;
- /*for(unsigned int i = 0; i < a->size(); i++)
+ while (1)
{
- cout << (*a)[i]->getData() << ", ";
- }
- cout << endl;*/
+ cout << "[1] Fill with Data\n";
+ cout << "[2] Clear\n";
+ cout << "[3] Balance\n";
+ cout << "[4] Draw\n";
+ cout << "[5] Info\n";
+ cout << "> ";
+ cin >> iInputOption;
- /*while(1)
- {
- for (char i = ' '; i <= '~'; i ++)
+ switch(iInputOption)
{
- string s(&i);
- a->insert(&s[0]);
+ case 1:
+ cout << "Filling with Data.....";
+ fill();
+ cout << "OK\n";
+ break;
+ case 2:
+ a->clear();
+ break;
+ case 3:
+ a->sort();
+ break;
+ case 4:
+ a->draw();
+ break;
+ default:
+ cout << "Unrecognized Command\n";
+ break;
}
- a->sort();
- a->clear();
- }*/
-
+ }
delete a;
return 0;