Skip to content

pmq20/magic_pragma

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Magic pragma

Magic Pragma is a little tool that allows you to quickly add the “#pragma once” that indicate header file should only be included once, which is a common task for C++ programmers, for an entire directory structure.

Manuel Ryan originally wrote the magic_encoding(github.com/m-ryan/magic_encoding) gem to get rid of “invalid multibyte char (US-ASCII)” error of ruby. I thought, hey! This little tool should also be useful to C++ programmers like me! So I forked it, changed it, used it on my C++ projects. Hope you don’t mind Ryan :)

Installation

gem install magic_pragma

Usage

you can call the tool from the console with default parameters like so

magic_pragma

this will prepend every “.h” and “.hpp” file in the working directory (recursively) with the following line :

#pragma once

Notes :

  • existing #pragma once are replaced

  • the rest of the file remains unchanged

you can pass options to the tool to specify the desired pragma (other than ‘once’) and the path where you want the tool to run, for example :

magic_pragma auto_inline /path/to/cpp/project

Thanks goes to Manuel Ryan for the original work.

About

Easily add "#pragma once" to multiple ".h" and ".hpp" header files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%