Generate c include header guards in atom

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

I m looking for an atom package that generates C++ include guards in .h/.hpp header files. The package should do something like taking an existing C++ header file and surround its contents with appropriate #ifndef #define #endif lines.

If the plugin offers some additional features, like auto-generating cpp and h files from a given class name, that would be great, too.

I m suprised I couldn t find a sensible plugin by googling for it. Are there any plugins around that match this description?

 Note: This is not a question seeking for opinions (/out-of-topic), but for material to base my further research for such a plugin on.  

Answers

Create a snippet insted! Opent your .atom folders and in the snippets.cson file paste this snippet!:

 .source.js :
   guards :
     prefix :  hd 
     body :  #ifndef "${1:*}"
#define "${1:*}"
${2}
#endif 
   console.error :
     prefix :  error 
     body :  console.error(${1:"crash"});$2 

You will then type hd, press tab and start creating a safe header ;) You can change the prefix anytime by editing the snippet

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/41660558/generate-c-include-header-guards-in-atom

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils