I would like to generate a C++ program to a Class Diagram using MacOS.
I've tried Doxygen (that many suggested in other topics in stackoverflow), but I don't seem to get how it works.
Could you suggest an easier solution? Which is the friendliest to the user program that offers an automated reverse to Class Diagram?
(For example something like what NetBeans 6.5.1 does for Java programs)
If you are using eclipse as an IDE, you could try the answers to this post.
You could possibly try to avoid the doxygen GUI. From terminal, enter your source folder then type
$ doxygen -g #that generates the doxygen config file "doxyfile"
$ doxygen
The latter generates two folders for the HTML and PDF versions of the UML.
the work is done!
you can edit doxyfile to change settings.
I usually use Understand for C++ to generate UML or to re-factor code:
http://www.scitools.com/index.php
Related
I have a prebuild-event tool (written in Ruby) in my C++ toolchain, that generates additional C++ code from existing C++ source code. I would like to replace this tool with a faster generator and using clang would be the best option.
Is there a way to write a C++ application that parses C++ source code of a file, so I can implement this prebuild tool in Clang? I am looking for a keyword or page with how to start. Any help is highly appreciated!
Parsing C++ is not a simple thing. Compile-time trickery and implicit semantics make it incredibly hard. Because of this I would suggest going with Clang. Its developers made it possible to use Clang as a library. Check out this guide to see different interfaces Clang has. If you want real C++ experience you might want to choose LibTooling.
I want to warn you though that in order for any C/C++ parser to work as expected they absolutely need compilation options used by the real compiler. Without include directories or macro definitions the code can make little to no sense. Basically your build system should tell your custom tool how to compile each file. The simplest approach would be using compilation database. It is a go-to solution for many Clang-based tools. However, it looks like you're making it a part of your build system, so maybe incorporating your tool and using options directly from the build system can be not such of a burden for you.
I hope this information is helpful!
One of many nice features of java is that if I type javac x.java, it will compile the classes in x.java and any other classes mentioned in x, and recursively look for other required classes. I can then find the .class files, put them in a jar and I have a minimal executable for x. How would I do the same for c++? I expect I need to do it with cmake, but "minimal" does not seem to be in the modern vocabulary.
I am trying to get opencv4 running on a raspberry pi - lots of guides on the web; primarily targeting python and the rest don't work in my experience. OpenCV is classic bloatware and the solution is to automate the build process rather than simplify it.
I feel I ought to be able to start with a relevant example application and run, for example:
g++ facedetect.cpp
then (manually) compile the missing bits.
There are however missing .hpp files that are constructed by the cmake/make process and the only option seems to be to build the entire edifice first.
OpenCV4 is a CMake based project. No need to combine the classes and source files etc, that is what CMake is doing for you! You can just use this guide which has every step written out for you.
Up to now i tried Eclipse, KDevelop and Code::Blocks.
Code::Blocks (12.11) seems not to be able to display documentation at all.
Eclipse (4.3.2) is able to display the documentation of at least the standard libraries during code completion and on hover, but it looks like there is no way to generate or add custom documentation. By now I was able to use DoxygenCPPInfo to convert the xml documentation to a "Java Serialization Data" file, which is useable by libhover. But the documentation is only visible on hover, but not on code completion.
KDevelop (4.7) does only show the comment, which normally contains the documentation, on hover and a heavily shortened version on code completion.
Is there another IDE or something else I could do to benefit from in code documentation while writing new code?
DoxygenCPPInfo can be compiled using the following files from eclipse-linuxtools:
ClassInfo.java
FunctionInfo.java
LibHoverInfo.java
MemberInfo.java
TypedefInfo.java
DoxygenCPPInfo.java
The xml documentation needs to be in one file to be used with DoxygenCPPInfo. This can be done by using xsltproc with combine.xslt and index.xml as input files. The final output of DoxygenCPPInfo can be placed in workspace/.metadata/.plugins/org.eclipse.linuxtools.cdt.libhover/CPP/ and will be loaded on next start of eclipse using that workspace. The documentation is only shown on hover and not on code completion.
You want to document a function in one file and use that function in another file. While using that function you want to reference the documentation written earlier in a tooltip without having to compile the first file. This can be done easily in kdevelop ide. There are not much IDEs I have come across that provide such ease of cross-referencing. Eclipse lib-hover plugin for C but it is clunky and I have had trouble working with that earlier. Here is the link to kdevelop-handbook .
Documenting in doxygen style in kdevelop
Our teacher requires us to submit a makefile with our Homeworks. What exactly is the use of a makefile and how can I go about generating it through code blocks ?
These are Makefiles. They serve as a guide for the make utility to build one's project. You typically "generate" one by knowing its syntax and writing it using a code editor.
I have created an EMF model with extension .system which will generate the code for my work.
Now I can generate code using launch code generation action from Eclipse. But I want to generate the code by launching the code generation from a stand-alone program.
How do I achieve this?
Details: I have created a plugin from EMF model and have inlcluded in the Eclipse.
I will created .system files from out of my plugin and I can generate code from my plugins.
I have observed that when I click launch the code generation it is starting a LauchAction class from my plugin.
How do I start my LaunchAction class from a stand-alone Java program?
My aim is to run my created .system model and generate the code from a stand-alone Java program.
How do I achieve this?
You could call Eclipse from the command line. Something similar to this:
eclipse.exe -noSplash -data ${workspace_location} -model -edit -editor -tests -application org.eclipse.emf.codegen.ecore.Generator ${genmodel}
This command will start Eclipse silently and will generate mode code (-model), edit plug-in (-edit), editor plug-in (-editor), and the test plug-in (-tests). Leave out any of these parameters if they are not needed.
I don't know how to solve your problem, but I think it is doable. I think you have to look at the EMF source code to check how the code generation works.
Here are some starting points:
If you have PDE and the EMF tools, use use Import > Plug-ins and Fragments to get the EMF plugin into your Eclipse workspace.
Otherwise, clone and import the following Git repository:
https://git.eclipse.org/c/emf/org.eclipse.emf.git/
Have a look at the following file, maybe you can find what you need there:
plugins/org.eclipse.emf.codegen.ecore.ui/src/org/eclipse/emf/codegen/ecore/genmodel/handler/GenerateHandler.java
Otherwise, look in the org.eclipse.emf.codegen.ecore plugin.
Good luck! It's an interesting problem! Please report back here if you solve it!
EDIT: Ops, this question is 10 years old, I didn't notice!