YAPF/bindings/cpp
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Nexoniarz d7f494a0c9 Language bindings, KDE thumbnails, yapf compare, in-memory encoding
- yapf_encode() / yapf_free_buffer(): encode to memory; yapf_save uses it
- yapf.c also compiles as C++
- `yapf compare`: size and decode speed of the original format vs YAPF,
  with a lossless check
- bindings with tested examples: C++ (header-only), C# (P/Invoke),
  Rust (crate, builds the C code), Go (cgo), Java (FFM API, Java 22+),
  Zig (@cImport), LuaJIT (FFI), TypeScript types for the JS port;
  Python now encodes in memory
- docs/LANGUAGES.md and examples/ with measured results
- KDE Dolphin thumbnail plugin (KF6, CMake)
- README: honest status for Photoshop / VS Code / Figma (not run in the
  apps yet) and macOS (cross-compiled only), platform table

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 14:39:56 +02:00
..
example.cpp Language bindings, KDE thumbnails, yapf compare, in-memory encoding 2026-10-03 14:39:56 +02:00
README.md Language bindings, KDE thumbnails, yapf compare, in-memory encoding 2026-10-03 14:39:56 +02:00
yapf.hpp Language bindings, KDE thumbnails, yapf compare, in-memory encoding 2026-10-03 14:39:56 +02:00

YAPF for C++

yapf.hpp is a header-only C++17 wrapper: RAII, exceptions, std::vector. Add ../../yapf.c to your project and include the header.

#include "yapf.hpp"

yapf::Image img = yapf::Image::load("texture.yapf");     // or Image::decode(bytes)
upload(img.width(), img.height(), img.channels(), img.pixels());

std::vector<uint8_t> file = yapf::Image(256, 256, 4, rgba).encode();

yapf.c compiles as C or as C++, so you can simply add it to a C++ project (Visual Studio, CMake, …).

Example: g++ -O2 -std=c++17 example.cpp -x c++ ../../yapf.c -o example -pthread && ./example