Warning

qilang is still under active development and its API may not be backward-compatible in the future.

qilang IDL syntax

qilang allows you to specify interfaces and types, to generate them in the language you want (only C++ is supported at the moment). The qilang interface description language (IDL) files must have the .idl.qi extension.

Packages

When writing qilang, everything should be in a package which maps to a C++ namespace. The package you put a file in must match the tree hierarchy. For example, if you have:

myproject
└── org
    └── mycompany
        └── myfile.idl.qi

The first statement of your file must be the following package statement:

package org.mycompagny

Interface declaration

An object interface allows you to define the API of an object. Such an interface is defined by the list of functions, signals and properties it contains.

Interface are defined like this:

interface MyInterface
  // write your declarations here
end

Functions, signals and properties are declared as follows:

// a few functions
fn doSomething(arg1: int, arg2: MyOtherInterface) -> bool
fn doNothing() // this function returns nothing

// a signal
sig started(time: int)

// a property
prop count(value: int)

Enum declaration

Enums with constants are declared as follows:

enum MyEnum
  const ValueOk = 0
  const ErrorNotFound = 1
  const ErrorUnknown = 2
end

Structure declaration

Structure declarations are done as follows:

struct MyStruct
  runnning: bool
  name: str
end

Types

Refer to Type equivalences between languages for the list of qilang types and their equivalences.