Code Monkey home page Code Monkey logo

includeupdator's Introduction

IncludeUpdator

I have old C++ projects which still use the '.h' extension for the header files.
I can easily rename the files with a shell command.
But the source code must be updated too, namely the #include directives.
I decided to write a simple application in Elixir to do it for me.
It assumes that the files are already renamed and updates only '.hpp' and '.cpp' files.
An include directive is updated only if:

  • it uses quotation marks: #include "header.h"
  • begins with #include, ignoring whitespaces. (which means commented-out directives will be skipped)
  • includes a '.h' file
    Other source is left untouched.

Example

Before:

#include "some_header.h"
#include   "  another_header.h  "
//#include "untouched.h"
#include <functional>

int f();
double g();

After:

#include "some_header.hpp"
#include   "  another_header.hpp"
//#include "untouched.h"
#include <functional>

int f();
double g();

Usage:

git clone https://github.com/IDragnev/IncludeUpdator.git
cd IncludeUpdator
mix escript.build
./include_updator <root_dir>
or ./include_updator --help for usage help

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.