Skip to content

App for convert c++ code to diagrams (version 1.1.0.)

Notifications You must be signed in to change notification settings

DDmit04/DiagramConstructor

Repository files navigation

DiagramConstructor (1.1.0.)

Console С# application creating visio diagrams from C++ code.

See patch notes

How to use

  • For start app download /DiagramConstructor/bin/Release directory (or whole repo) and run DiagramConstructor.exe

  • Choose code to build diagram (you can copy all file):

Example1

  • Input cosen code in code converter which can be opened from app console:

Example2

  • convert it to one single line

Example3

  • write result file path (optional)

Example4

  • and input converted code in console

Example5

  • Look for .vsdx file in inputed file path or default documents folder of your PC.

Recomendation for better app work

  • You need licensed or cracked Visio (you can try run visioActivator.cmd in root of this repo with admin rights to get license).

  • Then simpler and cleaner the code you wrote, the easier it is to create a diagram.

  • Use only english words in code (even in comments).

  • Code to input in console must be converted (no spaces, tabs and line breaks):

- String code = "";
- if (test)
- {
- code = "test code";
- }
- app.RunApp(code);

+ Stringcode='';if(test){code='';}app.RunApp(code);
  • Use common "for" instead "foreach"
- foreach(SomeType value in array) {}

+ for(int i = 0; i < array.length; i++) {}
  • Use parentheses even for single line code blocks:
- if(a > 10)
-    a = 10;
- else
-    a = 0;

- for(int i = 0; i < 10; i++) 
-     count++;

+ if(a > 10)
+ {
+    a = 10;
+ }
+ else
+ {
+    a = 0;
+ }

+ for(int i = 0; i < 10; i++)
+ {
+     count++;
+ }
  • Don't use '{' , '}' and ';' chars in code as parts of strings;
- String myString = "if(a == 0) { int a = 10; }"; 
  • Don't use too complex "if" constructions
- if(a == 10) 
- {
-     if(b == 20)
-     {
-         if(c == 0)
-         {
-             c == 0;
-         }
-     }
-     else
-     {
-         b = 100;
-     }
- }
- else 
- {
-     a = 0;
- }
  • Use only standart "else if" form:
- if(a == 10)
- {
-     a--;
- }
- else 
- { 
-     if(a == 20)
-     {
-         a--;
-     }

+ if(a == 10)
+ {
+     a--;
+ }
+ else if(a == 20)
+ {
+     a--;
+ }

Unsupported

  • "Break" and "continue" - they will be placed as PROCESS blocks

  • "switch" - use "else if" instead of it

Example

From this code:

#include <iostream>

using namespace std;

main()
{
    int a = 10;
    for (int i = 0; i < a; i++)
    {
        if (a * 2 == 4)
        {
            cout << "some output";
        }
        else
        {
        cout << "othet output";
        }
    }
}

doSome(int a, int b)
{
    if(a > b)
    {
        while(a != b)
        {
            a--;
        }
    } 
    else
    {
        while (a != b)
        {
            b--;
        }
    }
    cout << "justice";
}

you can get this diagram:

Example6

Bugs and errors

Send all bugs and errors (with console screen, inputed code and result diagram) in "issues" section of this repository.

About

App for convert c++ code to diagrams (version 1.1.0.)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published