From ba4e07e3611616abcd7cf849857d628445b3dba5 Mon Sep 17 00:00:00 2001 From: malte_langkabel Date: Thu, 10 Aug 2017 15:29:07 +0200 Subject: [PATCH] data: extended tutorial to mention call/inheritance graphs * fixed section mentioning hatched elements in tutorial * mention call/inheritance graphs in tutorial * added new tut files to windows deployment package --- .../projects/tutorial/src/graph_tutorial_2.h | 3 +- .../projects/tutorial/src/graph_tutorial_3.h | 22 +++------ .../projects/tutorial/src/graph_tutorial_4.h | 6 +-- .../projects/tutorial/src/graph_tutorial_5.h | 37 ++++++++++++++ .../projects/tutorial/src/graph_tutorial_6.h | 49 +++++++++++++++++++ deployment/windows/wixSetup/appDataDir.wxs | 2 + 6 files changed, 101 insertions(+), 18 deletions(-) create mode 100644 bin/app/user/projects/tutorial/src/graph_tutorial_5.h create mode 100644 bin/app/user/projects/tutorial/src/graph_tutorial_6.h diff --git a/bin/app/user/projects/tutorial/src/graph_tutorial_2.h b/bin/app/user/projects/tutorial/src/graph_tutorial_2.h index 4c74d019..151c645a 100644 --- a/bin/app/user/projects/tutorial/src/graph_tutorial_2.h +++ b/bin/app/user/projects/tutorial/src/graph_tutorial_2.h @@ -4,6 +4,7 @@ #include "graph_tutorial_1.h" +#include "graph_tutorial_5.h" //------------------------------------------------------------------------------ // @@ -59,7 +60,7 @@ public: // click the edge? // //------------------------------------------------------------------------------ - static int this_last_member; + static ClickMeLater this_last_member; }; diff --git a/bin/app/user/projects/tutorial/src/graph_tutorial_3.h b/bin/app/user/projects/tutorial/src/graph_tutorial_3.h index be68775f..36be746e 100644 --- a/bin/app/user/projects/tutorial/src/graph_tutorial_3.h +++ b/bin/app/user/projects/tutorial/src/graph_tutorial_3.h @@ -10,29 +10,23 @@ class ProducerOfTheLastMember public: void in() { - ClassWithHiddenMembers::this_last_member++; + ClassWithHiddenMembers::this_last_member.produce(); } //------------------------------------------------------------------------------ // -// 7 - 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 have no -// definition anywhere in your source folder (like the "int" symbol on the -// right hand side of the graph). So if you click them, Sourcetrail will display -// all the relations for the element, but the code view won't show a -// definition. If you want to learn more about Sourcetrail, 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. +// 7 - ADVANCED TRAINING +// Now that we have covered all the basics of navigating code using the graph, +// I'd like to conclude this section of the tutorial by showing you a special +// feature. Activate "ClickMeLater" in the far right of the graph when you are +// ready. // //------------------------------------------------------------------------------ private: void the() { - if (ClassWithHiddenMembers::this_last_member <= 0); + if (ClassWithHiddenMembers::this_last_member.isPositive()) { the_central_hub(); } @@ -40,7 +34,7 @@ private: void codeview() { - ClassWithHiddenMembers::this_last_member *= 2; + ClassWithHiddenMembers::this_last_member.produce(); } }; diff --git a/bin/app/user/projects/tutorial/src/graph_tutorial_4.h b/bin/app/user/projects/tutorial/src/graph_tutorial_4.h index 39360246..a7b47487 100644 --- a/bin/app/user/projects/tutorial/src/graph_tutorial_4.h +++ b/bin/app/user/projects/tutorial/src/graph_tutorial_4.h @@ -11,12 +11,12 @@ class ConsumerOfTheLastMember public: void go() { - ClassWithHiddenMembers::this_last_member = 42; + ClassWithHiddenMembers::this_last_member.consume(); } void on() { - ClassWithHiddenMembers::this_last_member--; + ClassWithHiddenMembers::this_last_member.consume(); } //------------------------------------------------------------------------------ // @@ -32,7 +32,7 @@ public: //------------------------------------------------------------------------------ void reading() { - ClassWithHiddenMembers::this_last_member /= 2; + ClassWithHiddenMembers::this_last_member.consume(); } }; diff --git a/bin/app/user/projects/tutorial/src/graph_tutorial_5.h b/bin/app/user/projects/tutorial/src/graph_tutorial_5.h new file mode 100644 index 00000000..666db0e9 --- /dev/null +++ b/bin/app/user/projects/tutorial/src/graph_tutorial_5.h @@ -0,0 +1,37 @@ +#ifndef GRAPH_TUTORIAL_5_H +#define GRAPH_TUTORIAL_5_H + + + +#include "graph_tutorial_6.h" + +//------------------------------------------------------------------------------ +// +// 8 - EXPANDING THE SCOPE +// Showing only one level of dependencies in the graph works well if you want +// to get a quick overview on the parts of your codebase that are related to a +// certain symbol. So using the graph makes sure that you don't overlook any +// relation while planning to modify the source code. But sometimes that is not +// enough. +// Sometimes you are interested in a whole call graph for a certain function or +// you want to see the complete inheritance chain of a specific class and you +// want to expand the scope shown by the graph. +// Do you see the small icon on the upper left of the graph? Use it to show the +// depth graph controls and click the "show base hierarchy" button. +// +//------------------------------------------------------------------------------ + +class ClickMeLater: public JustMoveOn, public NothingToSeeHere +{ +public: + void produce() { value++; } + + void consume() { value--; } + + bool isPositive() { return value > 0; } + + int value; +}; + +#endif // GRAPH_TUTORIAL_5_H + diff --git a/bin/app/user/projects/tutorial/src/graph_tutorial_6.h b/bin/app/user/projects/tutorial/src/graph_tutorial_6.h new file mode 100644 index 00000000..bed0749b --- /dev/null +++ b/bin/app/user/projects/tutorial/src/graph_tutorial_6.h @@ -0,0 +1,49 @@ +#ifndef GRAPH_TUTORIAL_6_H +#define GRAPH_TUTORIAL_6_H + + +#include + +class BoringClass +{ +}; + + +//------------------------------------------------------------------------------ +// +// 9 - THAT'S IT +// Great work! You have found this previously hidden base class. Of course you +// can also use the depth graph controls to expand the all classes that derive +// from a selected symbol or, if the active symbol is a function or a method it +// allows you to display the caller or callee graph. +// 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 have no +// definition anywhere in your source folder (like the "string" symbol on the +// right hand side of the graph). So if you click them, Sourcetrail will +// display all the relations for the element, but the code view won't show a +// definition. If you want to learn more about Sourcetrail, use the graph to go +// back to the central hub. +// +//------------------------------------------------------------------------------ + +class click_me_to_continue +{ + void method(std::string s) + { + the_central_hub(); + } +}; + +class NothingToSeeHere: public BoringClass, public click_me_to_continue +{ +}; + +class JustMoveOn +{ +}; + + +#endif // GRAPH_TUTORIAL_6_H + diff --git a/deployment/windows/wixSetup/appDataDir.wxs b/deployment/windows/wixSetup/appDataDir.wxs index 2e5b25af..b63df39d 100644 --- a/deployment/windows/wixSetup/appDataDir.wxs +++ b/deployment/windows/wixSetup/appDataDir.wxs @@ -100,6 +100,8 @@ + +