quicktype
quicktype copied to clipboard
ts to C++ class template argument renamed
This is minimal example:
temp.ts :
export class StateInfo<T> {
public state: T;'
public changeTime: number;
}
export enum xxx {
jam = "xx",
jest = "yy"
}
export enum www {
Disabled = 'asd',
Ok = 'qwe',
Error = 'zxc',
Maintenance = 'tyu',
}
export class foo {
public state: StateInfo<xxx>;
}
export class woo {
public test2: StateInfo<www>;
}
I execute command:
quicktype -s typescript -l c++ --namespace exampleNS -o results.hpp --include-location local-include --code-format with-getter-setter --hide-null-optional --no-boost --member-style camel-case --source-style multi-source --src temp.ts
and received this list of generated files:
Foo.hpp
Generators.hpp
helper.hpp
PurpleStateInfoT.hpp
results.hpp
StateInfoT.hpp
StateInfoWww.hpp
StateInfoXxx.hpp
Woo.hpp
Www.hpp
PurpleStateInfoT.hpp :
// To parse this JSON data, first install
//
// json.hpp https://github.com/nlohmann/json
//
// Then include this file, and then do
//
// PurpleStateInfoT.hpp data = nlohmann::json::parse(jsonString);
#pragma once
#include "json.hpp"
#include "helper.hpp"
namespace exampleNS {
using nlohmann::json;
enum class PurpleStateInfoT : int { XX, YY };
}
Enum xxx was renamed to PurpleStateInfoT. it's affects only first template argument class in the row. As you can see the second one is named properly. So generated files name depend on the order of classes definition
I expect to have same class name after translation