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
Related
I am working on a collection arranged in different folders w.r.t. different business component scenarios. Now some of the scenario folders might be alternative/redundant paths for the same workflow. Is it possible to somehow unmark/comment and mark/uncomment some of these alternate path folders in postman runner to get varying runs easily.
Ok, so one way is to arrange the collection folders in following way to facilitate the same:
- Main Collection
- Workflow1_Folder
- Workflow2_Folder
- Workflow3_Folder
- Workflow4_Folder
- UnmarkedWorkflows Collection
- Workflow2_Alternate_Folder - this will contain the steps that are alternate to ones on Main>Workflow2_Folder
- Workflow3_Alternate_Folder - this will contain the steps that are alternate to ones on Main>Workflow3_Folder
Only the Main folder needs to be run.
If/when required Workflow2_Alternate_Folder could be moved into Main folder from the UnmarkedWorkflows Collection followed by moving Workflow2_Folder to UnmarkedWorkflows Collection. Then Main collection could be run to test an alternate path for the same Use Case.
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.
I have a large C++ software application documented with doxygen. How can I set it up so that I can generate subdocuments for specific classes? The classes are documented with in-source commenting, their own .dox files, and images/ directory. I need to be able to generate a standalone pdf file specific to a single class.
I can use grouping to identify what will be included in that subdocument, but how do I generate output for a single group?
If you have a specific .dox file per requested output entity, then all you need to do is define in that file as input the files declaring and defining that class.
Say for example you want an output only for class MyClass which is declared in file myclass.hpp and whose implementation is in myclass.cpp, then in myclass.dox, just add this:
INPUT = ./myclass.cpp \
./myclass.hpp
Of course, you can have different paths for .cpp and .hpp. Or you can document more than one class.
Then, run doxygen on that myclass.dox file.
Also watch out for the output folder name. For the html output, the default name is html so you might want to rename it to avoid mixing up all the different outputs. For example, you might want to add in the dox file something like:
HTML_OUTPUT = html_myclass
Qt Creator has the Locator box, which allows you to easily find classes, methods, etc. Is there a way to use it to find class member variables, as well?
Using . <expr> will show member variables too, but that is only for searching inside the current file, not globally.
This the Locator:
By default, there is not such feature, but as said in the doc you can create a filter (I can't test it now, but I'll try this soon):
To create a locator filter:
In the locator, select Options > Configure to open the Locator options.
In the Filter Configuration dialog:
Name your filter.
Select at least one directory. The locator searches directories recursively.
Define the file pattern as a comma separated list. For example, to search all .h and .cpp files, enter *.h, *.cpp
Specify the prefix string.
To show only results matching this filter, select Limit to prefix.
Click OK.
QtCreator have no such feature - member variables are not good candidates for pivot points in search. If you want find usages of particular member, use "find symbol usages" (Ctrl+Shift+U when cursor is under symbol). If you want to find members of particular type, use usual search in regular expressions mode, something like:
\w+\s*\*\s*\w+\s*;
And limit scope to headers only (i.e use "*.h" file mask).
Have you tried using the 'Advanced...' option in the locator? You can change the scope of the search to the Current Project, All Projects, Files on the System, etc. I use this to even search for strings I use for debug output in my code.
I need to remove the first 4 characters of the names of over 100 files in a certain directory, can I do this with an obj-c program or a c ++ program and if so how?
Yes you can.
The NSFileManager class provides all the methods you need.
To get the contents of the directory use the contentsOfDirectoryAtPath method.
To rename the file you need to use the moveItemAtPath method.
Take a look at the class reference https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSFileManager_Class/Reference/Reference.html
Steps:
1. Get the names of the files in the dir.
2. Iterate all the files and use the moveItemAtPath to rename.