Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/thlorenz/namespace-cc

Namespaces C++ files in a directory (non-recursive)
https://github.com/thlorenz/namespace-cc

Last synced: 13 days ago
JSON representation

Namespaces C++ files in a directory (non-recursive)

Awesome Lists containing this project

README

        

# namespace-cc

Namespaces C++ files in a directory (non-recursive).

Usage: namespace-cc ''

## Installation

npm install namespace-cc

## Examples

**Original**

```cc
#ifndef RAPIDJSON_PARSER
#define RAPIDJSON_PARSER

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

#endif
```

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

**Result**

```cc
#ifndef RAPIDJSON_PARSER
#define RAPIDJSON_PARSER

namespace outer {
namespace inner {

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

}
}
#endif
```

## [API](https://thlorenz.github.io/namespace-cc)

### namespaceDirectory

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

**Parameters**

- `dir` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** the directory to process
- `namespaces` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/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