resources: Tutorial Project

* added tutorial project to coati projects.
* ignoring all .sqlite files for git.
This commit is contained in:
malte_langkabel
2015-11-13 18:55:10 +01:00
parent 3c2804797a
commit 7fce4cfae6
18 changed files with 617 additions and 5 deletions
+5 -5
View File
@@ -4,10 +4,9 @@
/bin/app/Debug/
/bin/app/Release/
/bin/app/data/log/
/bin/app/data/projects/
/bin/app/data/projects/ignored/
/bin/app/data/ApplicationSettings.xml
/bin/app/data/window_settings.ini
/bin/app/data/*.sqlite
/bin/lib/
@@ -16,11 +15,12 @@
/bin/test/data/log/
/bin/test/data/temp.xml
/bin/test/data/TestSettings.xml
/bin/test/data/*.sqlite
/setup/Linux/lib/*
.DS_Store
.idea
bin
obj
/ide_plugins/vs/vs2012/CoatiPlugin/CoatiPlugin/bin
/ide_plugins/vs/vs2012/CoatiPlugin/CoatiPlugin/obj
*.sqlite
@@ -0,0 +1,33 @@
#ifndef CODE_TUTORIAL_1_H
#define CODE_TUTORIAL_1_H
#include "utility.h"
//------------------------------------------------------------------------------
//
// THE CODE TUTORIAL
// As you already know the code view displays the snippets of code that are
// related to your currently active symbol. These snippets show the relevant
// lines in combination with some context.
// In case you discover something interesting as part of the snippet's context
// you can activate that symbol with a left-click. That way you dig deeper
// through your code base.
// Have you ever wondered what's the meaning of life, the universe and
// everything? Click the respective symbol to find out.
//
//------------------------------------------------------------------------------
class CodeTutorial
{
public:
CodeTutorial()
{
}
static int meaning_of_life_the_universe_and_everything;
};
#endif // CODE_TUTORIAL_1_H
@@ -0,0 +1,67 @@
#ifndef CODE_TUTORIAL_2_H
#define CODE_TUTORIAL_2_H
#include "code_tutorial_1.h"
//------------------------------------------------------------------------------
//
// MANAGING CONTEXT
// At this stage you see the whole file. For a shortcut to get here you also
// could have clicked the maximize button at the title bar of the box that
// contains this snippet. It is inactive now because the file is already shown
// as a whole. Before you start experimenting with the other buttons, remember
// that you can click the maximize buttons to get back here and continue
// reading.
// For the final part of this introduction please have a look at where the
// "unrelated_but_very_important()" function is used.
//
//------------------------------------------------------------------------------
void unrelated_but_very_important()
{
};
int calculate(int (*problem)())
{
return problem();
}
//------------------------------------------------------------------------------
//
// MORE CONTEXT
// Who would have expected such a simple question?
// Note that expanding the view didn't change the active symbol. You can
// proceed expanding the view until you hit the level of the file scope.
// So go ahead and find out what else is hidden inside this file!
//
//------------------------------------------------------------------------------
void deep_thought()
{
int (*the_question)() = [](){ return 6 * 7; };
//------------------------------------------------------------------------------
//
// CONTEXT
// We just talked about Coati providing context to the important lines of code.
// But it feels like something is missing here. What is "the_question"? And
// where does it come from?
//
// EXPANDING TO SCOPES
// Do you see first line of this snippet? It has no line number and says
// "deep_thought". Actually this is the name of the scope that encapsulates the
// snippet. By clicking that line you can tell Coati to expand the view to show
// the whole scope. Give it a try!
//
//------------------------------------------------------------------------------
int the_answer = calculate(the_question);
CodeTutorial::meaning_of_life_the_universe_and_everything = the_answer;
}
#endif // CODE_TUTORIAL_2_H
@@ -0,0 +1,57 @@
#ifndef CODE_TUTORIAL_3_H
#define CODE_TUTORIAL_3_H
#include "the_central_hub.h"
#include "code_tutorial_2.h"
//------------------------------------------------------------------------------
//
// SNIPPETS AND FILES
// It looks like this function is called in two different snippets. When two
// different snippets are located in the same file they share a common file
// view but each of them depicts the name of its own parent's scope.
// If you want to show the lines in between these two snippets you can either
// expand the upper snippet's scope to show the whole file or you can tell the
// lower snippet to reveal its scope.
// Try one of these approaches now.
//
//------------------------------------------------------------------------------
void function_with_snippets()
{
unrelated_but_very_important();
//------------------------------------------------------------------------------
//
// YOU FOUND THE HIDDEN COMMENT
// Well done! As you see Coati merged the two snippets from before because
// expanding a scope would have caused them to overlap. That's all for the code
// view.
//
// EDIT YOUR CODE
// In case you wondered if you can edit your code using Coati: You can't. Coati
// is designed for code exploration, not as a text editor or an IDE. But there
// is a chance that Coati can talk to your favourite editor (that you already
// know how to operate) via plugin. For more information about available
// plugins please take a look at the Coati User Manual.
//
// We hope you enjoyed this tutorial. You can follow the call below to get back
// to the central hub.
//
// P.S.
// You can also click the file name above to activate the file's node in case
// you want to explore your include hierarchy.
//
//------------------------------------------------------------------------------
the_central_hub();
unrelated_but_very_important();
};
#endif // CODE_TUTORIAL_3_H
@@ -0,0 +1,37 @@
#ifndef GRAPH_TUTORIAL_1_H
#define GRAPH_TUTORIAL_1_H
#include "utility.h"
//------------------------------------------------------------------------------
//
// THE GRAPH TUTORIAL
// In Coati's default window layout the graph is shown to the left, next to the
// code. It displays the structure of your project where all named symbols are
// nodes and all relations are edges. Like the code view it shows only the
// currently active symbol and all the incoming and outgoing dependencies.
//
// HOW DO I NAVIGATE THE GRAPH
// You can activate a new symbol by left-clicking on the node you are
// interested in. For example: to find out where the function
// "where_am_i_called()" is called get over to the graph and click that
// function's node.
//
//------------------------------------------------------------------------------
class GraphTutorial
{
public:
GraphTutorial()
{
}
static void where_am_i_called()
{
}
};
#endif // GRAPH_TUTORIAL_1_H
@@ -0,0 +1,66 @@
#ifndef GRAPH_TUTORIAL_2_H
#define GRAPH_TUTORIAL_2_H
#include "graph_tutorial_1.h"
//------------------------------------------------------------------------------
//
// WELL DONE
// You activated a node and both, the graph and the code view have been updated
// accordingly.
// Note that even though Coati provides a graph view it does not remove the
// need for reading code. The graph view is great for gaining a quick overview
// on relations and navigating code, but once you found something you are
// interested in you should still consider the code view to actually read up on
// all the important details.
//
// HIDDEN ELEMENTS
// In order not to flood you with information the graph is hiding a lot of
// elements. Do you see the "ClassWithHiddenMembers" for example? It actually
// contains more members than you currently see. Members that are not important
// for the current context are hidden. Nevertheless you can reveal by clicking
// the arrow next the the class name.
// Try that now.
//
//------------------------------------------------------------------------------
class ClassWithHiddenMembers
{
public:
void potential_caller()
{
GraphTutorial::where_am_i_called();
}
void now_you_see_all_contents_of_this_class()
{
}
void coati_uses_different_colors()
{
}
void to_distinguish_between_functions()
{
}
int and_variables;
int to_continue_click;
//------------------------------------------------------------------------------
//
// RELATIONS
// As you see in the graph, this member is accessed at quite some places
// throughout the code base. Lets say you wonder what code causes the edge
// between "reading" and "this_last_member" to appear. What will happen if you
// click the edge?
//
//------------------------------------------------------------------------------
static int this_last_member;
};
#endif // GRAPH_TUTORIAL_2_H
@@ -0,0 +1,38 @@
#ifndef GRAPH_TUTORIAL_3_H
#define GRAPH_TUTORIAL_3_H
#include "graph_tutorial_2.h"
class ProducerOfTheLastMember
{
public:
void go()
{
ClassWithHiddenMembers::this_last_member = 42;
}
void on()
{
ClassWithHiddenMembers::this_last_member++;
}
//------------------------------------------------------------------------------
//
// FOCUSING EDGES
// Even though Coati doesn't allow to activate an edge, you can still focus on
// edges. This doesn't change the currently active symbol (which would cause
// Coati to hide everything but the edge). Instead Coati just highlights the
// relation's location in the code and scrolls you there, so you don't lose
// context.
// Try to activate some more relation.
//
//------------------------------------------------------------------------------
void reading()
{
ClassWithHiddenMembers::this_last_member *= 2;
}
};
#endif // GRAPH_TUTORIAL_3_H
@@ -0,0 +1,48 @@
#ifndef GRAPH_TUTORIAL_4_H
#define GRAPH_TUTORIAL_4_H
#include "graph_tutorial_2.h"
#include "the_central_hub.h"
class ConsumerOfTheLastMember
{
public:
void in()
{
ClassWithHiddenMembers::this_last_member--;
}
//------------------------------------------------------------------------------
//
// THAT'S IT
// You completed the tutorial on the graph view. There is still more to learn
// but I guess you will figure it out on your own. One last thing: If you see
// an element with a hatched background please call us. It's a runaway!
// Just kidding. Those are elements that are used within your code, but without
// a definition anywhere in your source folder. So if you click them, Coati
// will display all the relations for the element, but the code view won't show
// a definition. If you want to learn more about Coati, go back to the central
// hub. It is called in the function below but you can also try to get there
// using only the graph.
//
//------------------------------------------------------------------------------
private:
void the()
{
if (ClassWithHiddenMembers::this_last_member <= 0);
{
the_central_hub();
}
}
void codeview()
{
ClassWithHiddenMembers::this_last_member /= 2;
}
};
#endif // GRAPH_TUTORIAL_4_H
@@ -0,0 +1,36 @@
#ifndef MAIN_H
#define MAIN_H
#include "my_first_step.h"
//------------------------------------------------------------------------------
//
// WHAT IS THIS?
// This is a tutorial and it is one of the fastest ways to get to know Coati.
//
// WHERE AM I?
// This is Coati's Code View and you are looking at the main function of this
// project's program.
//
// WHY AM I HERE?
// Every time you open up a project in Coati it will go through your project in
// search for a function called "main". In case this function is defined the
// corresponding symbol is activated. Otherwise Coati will just activate the
// first thing in your codebase it happens to stumble across.
//
// WHAT CAN I DO NOW?
// Left-click the "my_first_step()" function call inside the main function.
// Lets see what happens.
//
//------------------------------------------------------------------------------
int main()
{
my_first_step();
return 0;
}
#endif // MAIN_H
@@ -0,0 +1,34 @@
#ifndef MY_FIRST_STEP_H
#define MY_FIRST_STEP_H
#include "the_central_hub.h"
//------------------------------------------------------------------------------
//
// WHAT JUST HAPPENED?
// As I mentioned earlier, Coati knows the concept of an "active" symbol. You
// just changed the active symbol by clicking on the name of a function.
//
// OK, BUT WHAT IS AN ACTIVE SYMBOL?
// Coati doesn't show your entire code base on a single screen. Even for
// relatively small projects that would be pointless - trust me on that. So
// instead of showing everything at once, Coati keeps a strongly focused view
// on your code. This focus only includes the currently active symbol and its
// direct relations. Nothing more. By changing the active symbol as you just
// did, Coati allows you to jump through the code base on your own.
//
// I THINK I GOT IT!
// Now that you understand Coati's central concept you are ready to jump
// further by activating "the_central_hub()" of this tutorial.
//
//------------------------------------------------------------------------------
void my_first_step()
{
the_central_hub();
}
#endif // MY_FIRST_STEP_H
@@ -0,0 +1,30 @@
#ifndef SEARCH_TUTORIAL_1_H
#define SEARCH_TUTORIAL_1_H
#include "utility.h"
//------------------------------------------------------------------------------
//
// THE SEARCH TUTORIAL
// If you haven't messed up anything yet, you'll find the search bar to the
// upper left of Coati's user interface. Initially it shows the name of the
// currently active symbol.
// Use the shortcut "CTRL/CMD + F" to focus the search bar. You can also just
// click it. Try that now and enter the string "find_me_if_you_can" to search
// for the respective symbol. Press enter or click the magnification glass to
// execute the search.
//
//------------------------------------------------------------------------------
class SearchTutorial
{
public:
SearchTutorial()
{
}
};
#endif // SEARCH_TUTORIAL_1_H
@@ -0,0 +1,25 @@
#ifndef SEARCH_TUTORIAL_2_H
#define SEARCH_TUTORIAL_2_H
#include "utility.h"
//------------------------------------------------------------------------------
//
// THE AUTOCOMPLETION
// I hope you have been lazy enough to not enter the whole string from start to
// finish. So you already noticed Coati's autocompletion box.
// While you enter your search request Coati already tries to find a subset of
// matching symbols to help you get where you want pretty fast.
// But that's not all Coati does. Keep an eye on the search bar while entering
// the string "aux" and activate the symbol showing up.
//
//------------------------------------------------------------------------------
void finde_me_if_you_can()
{
}
#endif // SEARCH_TUTORIAL_2_H
@@ -0,0 +1,26 @@
#ifndef SEARCH_TUTORIAL_3_H
#define SEARCH_TUTORIAL_3_H
#include "utility.h"
//------------------------------------------------------------------------------
//
// FUZZY MATCHING
// While looking for matching symbols the search bar does not only consider
// strict matches to the entered substring. Instead it uses a more fuzzy
// approach. This is really helpful when you only have a rough idea of what the
// element you are really looking for is called.
// While showing the list of results the autocompletion also display the kind
// of each of the results to the very right.
// Try to activate the class with the name "NameConflict" next.
//
//------------------------------------------------------------------------------
void autocompletion_example()
{
}
#endif // SEARCH_TUTORIAL_3_H
@@ -0,0 +1,39 @@
#ifndef SEARCH_TUTORIAL_4_H
#define SEARCH_TUTORIAL_4_H
#include "utility.h"
//------------------------------------------------------------------------------
//
// WHAT ARE THE OTHER BUTTONS?
// Well done. Lets get over the other buttons left to the search bar really
// quick.
//
// UNDO AND REDO
// You can use the buttons to the very left to undo and redo your actions. This
// may seem odd since Coati doesn't include any features to actually change
// code. Instead Coati offers these buttons to help you navigate. So they
// really come in handy in case you ask yourself something like "How did I end
// up here?"
//
// REFRESH
// The next button allows you to refresh you project in case you changed some
// of your code. The second button toggels the auto-refresh option. When
// enabled Coati refreshes your project every time it's window gets focused.
//
// WHAT'S NEXT?
// Instead of the class activate the struct with the same name as before.
//
//------------------------------------------------------------------------------
namespace a
{
class NameConflict
{
};
}
#endif // SEARCH_TUTORIAL_4_H
@@ -0,0 +1,27 @@
#ifndef SEARCH_TUTORIAL_5_H
#define SEARCH_TUTORIAL_5_H
#include "utility.h"
//------------------------------------------------------------------------------
//
// CONGRATULATONS
// You have completed the challenge of search.
// Oh, I almost forgot: You can only find nodes such as symbols via the search
// bar. It doesn't allow you to find edges like calls or inheritance. At least
// not yet.
// Try to get back to the the central hub using the search bar!
//
//------------------------------------------------------------------------------
namespace b
{
struct NameConflict
{
};
}
#endif // SEARCH_TUTORIAL_5_H
@@ -0,0 +1,29 @@
#ifndef THE_CENTRAL_HUB_H
#define THE_CENTRAL_HUB_H
#include "code_tutorial_1.h"
#include "graph_tutorial_1.h"
#include "search_tutorial_1.h"
//------------------------------------------------------------------------------
//
// THE HUB
// This is the central hub of Coati's tutorial. From here you can embark on
// short trips to explore the different parts of Coati. Most important: You
// will get to know how all the different parts of Coati interact.
// The function below references all the available tutorials. So pick one and
// jump right to action.
//
//------------------------------------------------------------------------------
void the_central_hub()
{
SearchTutorial* the_challenge_of_search;
GraphTutorial* reading_the_map;
CodeTutorial* explore_the_details;
}
#endif // THE_CENTRAL_HUB_H
@@ -0,0 +1,8 @@
#ifndef UTILITY_H
#define UTILITY_H
typedef unsigned int uint;
#endif // UTILITY_H
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<config>
<source>
<extensions>
<header_extensions>.h</header_extensions>
<source_extensions>.cpp</source_extensions>
</extensions>
<source_paths>
<source_path>./src</source_path>
</source_paths>
</source>
</config>