Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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)
- Host: GitHub
- URL: https://github.com/thlorenz/namespace-cc
- Owner: thlorenz
- License: mit
- Created: 2017-09-27T19:42:41.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-09-27T22:31:22.000Z (over 7 years ago)
- Last Synced: 2024-12-10T08:26:42.599Z (about 1 month ago)
- Language: JavaScript
- Homepage: https://thlorenz.github.io/namespace-cc
- Size: 1.13 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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_PARSERclass RapidJsonParser {
public:
RapidJsonParser(const char* json);
};#endif
```**Run**: `namespace-cc ./mydir 'outer inner'`
**Result**
```cc
#ifndef RAPIDJSON_PARSER
#define RAPIDJSON_PARSERnamespace 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