0

Different programs have different code styles: some might prefer camelCase, PascalCase or snake_case.

If you are working in a business environment, you might already have set guides on how you should write code. You also might have a strict taste and don't want to use another style because you don't like it. Or you are using two or more libraries that differ in code style but you want your code to be consistent.

Let there be two APIs / libraries given that you want to use, where both have different name casings.

API #1 which is for managing animals might look somewhat like this:

public class animal {

    public animal() {

    }

    private string name;

    public string get_name() {
        return name;
    }

    public void set_name(string name) {
        this.name = name;
    }

}

Meanwhile API #2 - which is a completely different library from API #1, they were never designed to work specifically with each other, as they are general purpose - might have code that looks something like this:

interface Sound {

    public void Play();

    public File file;
    public void GetFile();
    public void SetFile();

}

Now you surely don't want your animal sound player's code to have calls to APIs with different casings as it would make your code inconsistent.

Is there any automated tool out there which can generate a wrapper around an API, which contains functions that call other functions with the same name but with different casing?

It would generate methods similar to this:

public String GetName() {
    return get_name();
}

I would specifically need such a tool for C++, but I am genuinely interested if such a thing exists in other languages too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.