Example #1
0
// ----------------------------------------------------------------------------
// TLFunction::addContext
//
// Adds a [context] of the function from a parsed ZScript function [func]
// ----------------------------------------------------------------------------
void TLFunction::addContext(
	const string&            context,
	const ZScript::Function& func,
	bool                     custom,
	string                   desc,
	string                   dep_f)
{
	contexts_.push_back(Context{ context, {} });
	auto& ctx = contexts_.back();

	ctx.return_type  = func.returnType();
	ctx.description  = desc;
	ctx.deprecated_v = func.deprecated();
	ctx.deprecated_f = dep_f;
	ctx.custom       = custom;

	if (func.isVirtual())
		ctx.qualifiers += "virtual ";
	if (func.native())
		ctx.qualifiers += "native ";

	if (func.parameters().empty())
		ctx.params.push_back({ "void", "", "", false });
	else
		for (auto& p : func.parameters())
			ctx.params.push_back({ p.type, p.name, p.default_value, !p.default_value.empty() });
}
Example #2
0
// -----------------------------------------------------------------------------
// Adds a [context] of the function from a parsed ZScript function [func]
// -----------------------------------------------------------------------------
void TLFunction::addContext(
	string_view              context,
	const ZScript::Function& func,
	bool                     custom,
	string_view              desc,
	string_view              dep_f)
{
	contexts_.emplace_back(context, func.returnType(), desc, func.deprecated(), dep_f, custom);
	auto& ctx = contexts_.back();

	if (func.isVirtual())
		ctx.qualifiers += "virtual ";
	if (func.native())
		ctx.qualifiers += "native ";

	if (func.parameters().empty())
		ctx.params.push_back({ "void", "", "", false });
	else
		for (auto& p : func.parameters())
			ctx.params.push_back({ p.type, p.name, p.default_value, !p.default_value.empty() });
}