0.1.0 • Published 7 years ago

namespace-cc v0.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

namespace-cc

Namespaces C++ files according to directory structure

Usage: namespace-cc <full-path-to-dir> '<space-separated-namespaced>'

Installation

npm install namespace-cc

Examples

Original

#ifndef RAPIDJSON_PARSER
#define RAPIDJSON_PARSER

class RapidJsonParser {
  public:
    RapidJsonParser(const char* json);
};

#endif

Run: namespace-cc ./mydir 'outer inner'

Result

#ifndef RAPIDJSON_PARSER
#define RAPIDJSON_PARSER

namespace outer {
namespace inner {

class RapidJsonParser {
  public:
    RapidJsonParser(const char* json);
};

}
}
#endif

API

namespaceDirectory

Namespaces all C++ files in the given directory. The files will be overwritten in place.

Parameters

  • dir string the directory to process
  • namespaces Array<string> the namespaces to enclose the definitions in, i.e. [ 'outer', 'inner' ]

Requirements

Node.js >= v8 (sorry, wanted to play with async/await).

License

MIT