Metadata-Version: 2.1
Name: cppwriter
Version: 0.0.3
Summary: C++ code writer library
Author-email: Mikhael Khrustik <misha@myrt.co>
License: MIT
Keywords: cpp,arduino,c++
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE

# C++ writer [![Quality assurance](https://github.com/mishamyrt/cppwriter/actions/workflows/qa.yaml/badge.svg)](https://github.com/mishamyrt/cppwriter/actions/workflows/qa.yaml) [![PyPI version](https://badge.fury.io/py/cppwriter.svg)](https://badge.fury.io/py/cppwriter)

The library provides an iterative interface for generating C/C++ code from Python.

## Installation

```sh
pip install cppwriter
```

## Usage

```python
from cppwriter import FileBlock

file = FileBlock(indent_char="  ")
file.include("stdio.h", is_global=True)
file.line()
main = file.function("main", "int")
main.if_statement("PI > 4").line("return 1")
main.line("return 0")
print(str(file))
```

This will generate the following code:

```c
#include <stdio.h>

int main() {
  if (PI > 4) {
    return 1;
  }
  return 0;
}
```

## Relationship to cwriter

When I started making this library I didn't know about the existence of cwriter. I came across it while searching for a package name, but decided to give up and still finish my version.  
