C/C++ definition generator
Project description
cppgen
A command-line utility to generate boilerplate C/C++ code.
pip install --user cppgen
cppgen
Generates C/C++ definition files from header files.
Usage
usage: cppgen [-h] [--cpp CPP] [--ipp IPP] [-c {default,gnu,google}]
[-i {convention,space,tab}] [-t TABSIZE] [--no-todo]
FILE [FILE ...]
Generate definitions from headers
positional arguments:
FILE A header file
optional arguments:
-h, --help show this help message and exit
--cpp CPP Suffix for files containing function definitions
(default: .cpp)
--ipp IPP Suffix for files containing inline/template function
definitions (default: .ipp)
-c {default,gnu,google}, --convention {default,gnu,google}
Specify coding convention (default: default)
-i {convention,space,tab}, --indent {convention,space,tab}
Specify indentation character (default: follow
convention)
-t TABSIZE, --tabsize TABSIZE
Specify tab size (default: 0; follow convention)
--no-todo Do not insert todo comments
Example
Header:
// example.hpp
namespace example {
class Test {
public:
Test ();
~Test ();
int get ();
};
}
Run:
$ cppgen example.hpp
Generate: example.hpp -> example.cpp
And result (example.cpp
):
#include "example.hpp"
namespace example {
Test::Test () {
// TODO
}
Test::~Test () {
// TODO
}
int Test::get () {
// TODO
}
} /* namespace example */
hppgen
Generates a header file.
Usage
usage: hppgen [-h] [--suffix SUFFIX] [-f {snake_case,hyphen-case,lowercase,UPPERCASE,camelCase,PascalCase,CONST_CASE}] [-c {default,gnu,google}] [-i {convention,space,tab}] [-t TABSIZE] [TYPE] NAME
Generate a header
positional arguments:
TYPE Type: class, struct, or enum (default: class)
NAME (<NAMESPACE>::)*<NAME>
optional arguments:
-h, --help show this help message and exit
--suffix SUFFIX Suffix for the generated header file (default: .hpp)
-f {snake_case,hyphen-case,lowercase,UPPERCASE,camelCase,PascalCase,CONST_CASE}, --file-convention {snake_case,hyphen-case,lowercase,UPPERCASE,camelCase,PascalCase,CONST_CASE}
Specify file naming convention (default: snake_case)
-c {default,gnu,google}, --convention {default,gnu,google}
Specify coding convention (default: default)
-i {convention,space,tab}, --indent {convention,space,tab}
Specify indentation character (default: follow convention)
-t TABSIZE, --tabsize TABSIZE
Specify tab size (default: 0; follow convention)
Example
Run:
$ hppgen foo::Bar
Generate: foo/bar.hpp
And result (foo/bar.hpp
):
#ifndef FOO_BAR_HPP
#define FOO_BAR_HPP
namespace foo {
class Bar {
public:
Bar ();
~Bar ();
Bar (const Bar &other);
Bar (Bar &&other);
private:
};
} /* namespace foo */
#endif /* FOO_BAR_HPP */
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cppgen-2021.3.1.tar.gz
(8.7 kB
view details)
Built Distribution
cppgen-2021.3.1-py3-none-any.whl
(10.0 kB
view details)
File details
Details for the file cppgen-2021.3.1.tar.gz
.
File metadata
- Download URL: cppgen-2021.3.1.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.1.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43274952d581c2b6705870817d5ea5fcd1c012e54efc1782140a2fa32a2db8a3 |
|
MD5 | 290552146f5b0ac310eb57d8b7e04023 |
|
BLAKE2b-256 | 6447289b7ab3e728d9f2d5d6320e4e41e7c2775138324ad20a04d52e8af50d88 |
File details
Details for the file cppgen-2021.3.1-py3-none-any.whl
.
File metadata
- Download URL: cppgen-2021.3.1-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.1.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0620a3069920ab916ddd7c2a222d6f17bb9b464d076a94a80751ec1011f409a |
|
MD5 | 3299620021bf86f9966f020c72e9571a |
|
BLAKE2b-256 | e3023336a85480f900a6662b482d5b3f98e844c46cc2dff6d5bf30573470d3e5 |