npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

aclovis

v0.1.1

Published

A library to generate C++ code in TypeScript

Downloads

10

Readme

aclovis

:warning: :construction: :construction: :construction: :warning:

Before exploring this project further, I am brand new to the world of JavaScript, Typescript, npm, and friends. This project works however, I don't guarantee that it follows best practices or is even packaged correctly.

This project is my learning ground for the JS world. So if you're a JS expert (or you just know the pain I'm going through by entering the JS world) and you have an unsolicited advice/tips, they are welcome and I'd highly appreciate it!

Welcome to aclovis! A library that allows you to programmatically generate C++ code (and maybe other languages in the future) from JavaScript or Typescript.

As mentioned in the beginning, this project is incredibly young and will likely be changing a lot. The fact that this project is starting at version 0.0.0 should be a sign of its stability. You have been warned!

Okay. But why tho?

For my BZFlag Plug-in Starter, I needed a way to programmatically generate C++ to help developers get started with writing plug-ins quickly. The initial version was written in a hurry and dubbed "CodeBuilder." It was time for me to properly learn JS and TS, so I decided to give the project another look and rewrite it.

Usage

For the most up to date examples and functionality, it is highly recommended that you look at the unit tests for the project.

import { CPPClass, CPPFormatter, CPPFunction, CPPVariable, CPPVisibility } from 'aclovis';

let cppclass = new CPPClass('PetThief');
let stealFxn = new CPPFunction('void', 'steal', [
    CPPVariable.createInt('owner'),
    CPPVariable.createInt('target', -1)
]);

stealFxn.setVirtual(true);
stealFxn.setParentClass(cppclass, CPPVisibility.Public);

let fmtr = new CPPFormatter({
    indentWithSpaces: true,
    indentSpaceCount: 4,
    bracesOnNewLine: true
});

let output = cppclass.writeHeaderBlock(fmtr, 0);

And here's what would be outputted when you write out the class.

class PetThief
{
    virtual void steal(int owner, int target = -1);
};

Future Plans

If I am able to pick up some better practices, I'll definitely expand this to be able to generate other languages. I attempted to write some generic interfaces that should be able to work across different languages but for right now, C++ is the main focus.

License

MIT