Management of code snippets
Code::Blocks allows developers to store and retrieve frequently used code snippets. We have used DoxyBlocks plugin in our previous example to comment blocks suitable for generating documents. However we can also save a blank template as a code snippet and reuse it wherever needed.
Go to View | Code snippets menu option to show the CodeSnippets window.
Right-click on the
codesnippets
in the tree and select Add SubCategory menu option.Name it
doxygen
. Right-click on this doxygen category and click on the Add snippet menu option.Enter
Block comment
as Label and following code as the snippet text:\** \brief * */
Click on the OK button to save this snippet. CodeSnippets window will look similar to the following screenshot:
Now click on any place in the Code::Blocks editor window, right-click on this snippet and select Apply menu option. This snippet will now be pasted into the Editor window.
We can add code, bookmarks, text files as a code snippet. Code snippets are not project specific and works across all the projects.