Custom CQLinq extensions

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:
from m in CodeBase.FilteredMethod() select m

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:
warnif count >0 from m in CodeBase.MyCustomRule() select m

The extension could be defined like this:



CppDepend offers a wide range of features. It is often described as a Swiss Army Knife for C and C++ developers.

Start Free Trial