Doxygen how to separate classes by path? - c++

So how exactly does one separate classes by path in Doxygen? I have tried with groups and sections,but for some reason, it would always combine classes with same name.
Current file structure is as following:
Trunk
|
+-> Client -> DemoClass.h
|
+-> Server -> DemoClass.h
|
+-> Shared -> OtherClass.h
Problem is I don't want a 1x DemoClass in doxygen that contains all the functions combined i want 2 seperate sections/class as in Server/DemoClass, Client/DemoClass.

This is a known limitation, see bullet 4 of http://www.doxygen.org/manual/trouble.html.
I recommend to make separate projects, one for the server and one for the client, as they can never be legally in one executable anyway, or use namespaces.
File names can be the same, that's not a problem.

Related

Scope of <Plug>(coc-references) don't search on entire project folder

Using coc.vim feature (coc-references) on the name of classA or any other one, it seems to search and find references only on local file ClassA.cpp, not on entire project folders' sources.
ProjecT-Root
SubfolderA/classA.cpp
SubfolderB/classB.cpp
classeC.cpp calling new classA
The command (coc-references) report me only classA.cpp occurrences.
I would like all references reported on entire project. If i use coc-references-used, it's the same.
Thank you
Nicolas
It's language server's issue, coc-references requests textDocument/references to language server, LS returns results and coc.nvim display them.

How can I access test methods from sub-directories [duplicate]

This question already has answers here:
Can I create shared test utilities?
(2 answers)
Closed 3 years ago.
My Go project code structure looks something like this.
project
|
+-- x_test.go
|
+-- sub-directory
| |
| +-- y_test.go
x_test.go has some struct and methods that are used only for test purposes.
These struct and methods are un-accessible in y_test.go.
Is there a way test files can be imported in sub-directories? I cannot move the file x_test.go to the sub-directory as it makes use of some interfaces defined in the root level directory.
The file y_test.go cannot be put at the root level as it is using some instances defined in sub-directory, and this would cause a cyclic dependency.
Is there a way I can make the methods and struct defined in x_test.go visible to y_test.go?
Everything works fine if I don't treat x_test.go as a test file. i.e, I rename it to just x.go
Is there a way I can make the methods and struct defined in x_test.go visible to y_test.go?
No.

How to tell Cppdepend a directory has multiple local copies

For certain project I want to make statistics like list of public methods and functions. Great option might be using CppDepend and it's build-in query language.
Our (legacy) project base has applications. Each application is in it's own directory, has project file and some subdirectories with sources. Certain subdirectories are shared in multiple applications (using svn:externals). My goal is count methods and functions in such shared directories only once.
For example if file my_file.h contains three functions and is checked out to three different local directories I still want to add only 3 to my statistic and not 9.
Is there a way to tell cpp what directories/files are checked out to multiple local directories to count them only once?
To avoid counting the same methods you can add the distinct filter to the cqlinq query like this:
from m in JustMyCode.Methods.Distinct(m=>m.FullName)
select m
So each method will be counted once, or you can improve the query to avoid filtering methods with the same signature but are not the same by adding a filter of the source file name
from m in JustMyCode.Methods.Distinct(m=>new {m.FullName,m.SourceDecl.SourceFile.FileName})
select m

Is it possible to auto-update the name of variables in two different directories

I use Webstorm to test Javascript code with the testing framework Mocha. I want to give my variables and functions names which facilitate an intuitive understanding of my code in the best possible way. As a consequence I often rename my variables and functions.
So if I in the same project have file1.js in a lib folder with the following content:
var foo = 'I am a variable';
and test_of_file1.js in a testfolder with the following content:
var foo = 'I am a variable';
and I use Webstorm's refactoring tool in file1.js to rename foo to boo I would like this change to take effect in both files. I do not use JsDoc to document the code or Git to track any changes (unsure if that is relevant). I have tried using refactoring, but it only takes effect in file1.js.
How can I make it take effect in both files?
You're mixing two concepts.
When you're renaming something (such as a file called in many other modules), Webstorm will refactor all files containing such references.
In your case, you're essentially "replacing" the name of the var. But the var foo in file 1 is NOT a reference to var foo in file 2. They'Re two completely different things.
Based on what you described above, you need to do a FIND & REPLACE operation on your project & test files.
But be careful, and make sure to review each find/replace operation.
The problem above is that you refactored (or find/replaced) only within the open file. That won't work. You'll need to select your project folder in the Project tab (should contain your project files and test files) and type: CTRL + SHIFT + R (might be different on windows) to do a project-wide Find/Replace.

Understanding "create a virtual filesystem which allows mapping of arbitrary directories" for FTP server project

Disclaimer: This is homework; I don't want a solution.
Also, no libraries outside c/c++ standard libraries are available.
I'm looking for a push in the right direction to understand what this portion of work from my assigned semester project (create a virtual FTP server) is even asking me to do:
The server allows to create a virtual filesystem. By a virtual filesystem, we mean a mapping of a served directory to the real directory on the filesystem. For example, the client tree will look like: /home/user1 maps to /mnt/x/home/user1 /www maps to /var/cache/www /home/user_list.txt maps to /var/ftpclient/user_list.txt The user will see /home/user1 directory and /www directory and the file /home/user_list.txt
I followed up with this question to my lecturer:
Are /home/user1 -> /mnt/x/home/user1 , /www -> /var/cache/www , and /var/cache/www/home/user_list.txt -> /var/ftpclient/user_list.txt the only directory mappings which need to be supported (so each user will have 2 directories and 1 file as shown automatically created for them)?
to which the following reply was given:
These mappings are just example settings. Your solution should be able
map anything to anything it similar way.
From my current understanding, I need to only allow users of my FTP server to access directories and files which are explicitly mapped (specified via the configuration file). This will probably mean a mapping of something like /home -> /home/users (so all users will see that they're in a pseudo root directory for FTP-ing stuff, e.g. user Bob sees /home/bob/.
Also, with which API do I need to work to support FTP commands like ls, cd, etc. which work with the real unerlying file system?
You are creating your own FTP server (or at least a portion thereof). It will need to solve the problem of /home/bob translates to /home/users/bob. I believe the way you are meant to do this is that if someone types cd /home/bob, you simply translate the passed in file-location to a function that takes the user-provided pat (in this case/home/bob) to it's "real" form (/home/users/bob) before it's passed to the chdir function that actually changes the directory. To make things like pwd and ls show the correct path, you will either need to "remember where you are" (bearing in mind that someone may want to do cd ../joe, cd ../tom/.././mats/../joe, or cd ..; cd joe to move to /home/joe, which should all [modulo my typos] translate to /home/users/joe but display as /home/joe - in other words, your cd will need to understand the current directory . and parent directory .. to move around), or have a "reverse translation" that takes /home/users/joe and comes up with /home/joe. It's my current thought that the latter is simpler, but I haven't solved EXACTLY this problem.
There are probably several solutions that you can follow, but a "match start of string" and working in absolute paths would work unless you want to do very complicated things and allow you don't need users to do REALLY complicated things, for example, if we have this mapping:
/home -> /mnt/x/home (e.g /home/bob becomes /mnt/x/home/bob)
/www -> /var/cache/www (e.g /www/index.html becomes /var/cache/www/index.html)
Now, if a user were to do:
cd /home/bob/../../www/ (could be worse with more . and .. mixed in)
then you need to actually understand where you are, and translate fix up ../.. into / again. [Of course, similar problems using a cd /home/bob then cd .. and cd www may pose similar problems].
I would clarify if that is actually required by your lecturer.
If it is not required, then match the start of anything starting with / (everything else, just pass to chdir without change)
The last question is the easiest: use the Boost Filesystem library, it has the types you'll need such as file paths.
For the first question, the idea is that GET /home/user_list.txt returns the contents of /var/ftpclient/user_list.txt. That means you first need to translate the virtual name into a real name (Some fanciness is possible here, but basically you want to check if any prefix of the virtual name appears in the translation table. Fanciness includes dealing with the case of names not found). Secondly, with the real name you want to open that file, read its contents, and return those to the client.