User forums > General (but related to Code::Blocks)

Class designer

<< < (3/4) > >>

oBFusCATed:

--- Quote from: Krice on July 29, 2019, 02:26:25 pm ---I don't understand why you would need C++? support for class a diagram tool. It doesn't need to do much, just find classes and their inheritance structure in the project.

--- End quote ---
Ignorance is bliss. 8)

Krice:

--- Quote from: oBFusCATed on July 29, 2019, 03:52:09 pm ---Ignorance is bliss.
--- End quote ---

I began to work on a tool that can give more information about classes. How hard it can be, right?

Krice:
The first step in my command line tool was to find source files from current directory. There is a new filesystem library in C++17 so I had to use VS for this, because in 17.12 C++14 is the latest. Filesystem is quite easy compared to anything else, you don't need a lot of code for that task:


--- Code: ---string const Files::extensions[]={".cpp", ".h", ".hpp"};

Files::Files()
{
fs::path dir{"."};
    for (auto entry : fs::directory_iterator(dir))
{
if (entry.is_regular_file())
{
if (Is_Source_Extension(entry.path().extension().string()))
files.push_back(entry.path().filename().string());
}
    }
}

bool Files::Is_Source_Extension(const string &source)
{
for (auto &it : extensions)
if (it==source) { return true; }

return false;
}

--- End code ---

How smooth is that, right?

sodev:

--- Quote from: Krice on July 29, 2019, 09:07:09 am ---Seems like an ancient tool.

--- End quote ---

It's only the de-facto standard tool to create documentation for at least c/c++-code.


--- Quote from: Krice on July 30, 2019, 02:44:42 pm ---The first step in my command line tool was to find source files from current directory. There is a new filesystem library in C++17 so I had to use VS for this, because in 17.12 C++14 is the latest. Filesystem is quite easy compared to anything else, you don't need a lot of code for that task:

--- End quote ---

You like to hear you talking? So much foobar, better get your facts straight. CodeBlocks isn't a compiler, it doesn't need to support anything. You can use CodeBlocks with VS 2019, latest Clang or GCC to get the newest experimental c++ features you like, all together with CodeBlocks.

So all you need to write a fully fledged CASE tool or at least modeler with bidirectional sync is some C++17? Great, so it won't take long until your plugin is ready and we can use it in CodeBlocks.

Krice:

--- Quote from: sodev on July 30, 2019, 03:21:14 pm ---CodeBlocks isn't a compiler, it doesn't need to support anything.
--- End quote ---

Oh I'm sorry. Let's make this simpler so you also can understand: the compiler that comes with 17.12 if you download it with the compiler.


--- Quote ---So all you need to write a fully fledged CASE tool or at least modeler with bidirectional
--- End quote ---

I don't have to do anything I don't want. In this.. well, case, I don't need to write a real parser, obviously. I only need to find out classes (and structs) from the source code. Can't be that hard I guess. I already have a plan to read the file until first open curly brace. Then backtrack to find class or struct keyword before first ';' (or closed curly brace?). I think it should work. Also, when reading a part, remove spaces and line feed characters to make it easier to parse. The difficult part will be inheritance relationships between classes. Or maybe they are not difficult, who knows.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version