Custom CQLinq extensions
For more flexibility, CppDepend proposes a powerful way to develop you custom CQlinq extensions using the API.A library CustomCQlinqExtensions could be found where CppDepend is installed, you have just to add your extensions, build the library and copy the dll generated in the lib directory. Below some uses case:
- Define easily your new metric by adding an extension method, extensions could be added to Application, Project, Type, Method and Field. for example this custom metric
Could be used in the cqlinq queries like this:
from m in Methods where m.MyMetric>20 select m
- You can also define an extension to reuse some logic of your queries. For example reuse a set of methods with some conditions:
The extension could be defined like this:
- You can also define an entire rule using an extension. And it could be used in the cqlinq queries like this:
The extension could be defined like this: