# KJSEmbed Types

## Introduction

KJSEmbed adds a number of custom types to those defined by ECMA in addition to the objects themselves. These types are used to pass complex datatypes between scripts and the C++ code that is hosting the script. This document describes the representations used to pass information in each direction.

It should be noted that currently only a single representation is available to scripts accessing native types. Scripts should not rely on this behaviour as the restriction may be removed in a future release of KJSEmbed so this, though the current script API will continue to be supported.

## Fundamental Types

### Numbers

- int -> Number
- uint -> Number
- float -> Number
- double -> Number
- Number -> int
- Number -> uint
- Number -> float
- Number -> double

### Strings

- TQString -> String
- TQCString -> String
- const char * -> String
- String -> TQString
- String -> TQCString
- String -> const char *

## Qt Object Types

### TQColor

Represents a color, possibly including an alpha channel.

- TQColor -> '#rrggbb'
- '#rrggbb' -> TQColor
- '#rrggbbaa' -> TQColor

### TQPoint

Represents a point.

- TQPoint -> [x,y]
- [x,y] -> TQPoint
- obj.x obj.y -> TQPoint

### TQSize

Represents a size.

- TQSize -> [w,h]
- [w,h] -> TQSize
- obj.w obj.h -> TQSize

### TQRect

Represents a rectangle.

- TQRect -> [x,y,w,h]
- [x,y,w,h] -> TQRect
- obj.x obj.y obj.w obj.h -> TQRect

### TQDate

Represents a date.

- TQDate -> ''

### TQTime

Represents a time.

- TQTime -> ''

### TQDateTime

Represents a date/time pair.

- TQDateTime -> ''

### TQKeySequence

Represents a sequence of keys, eg. it is used for accelerators.

- TQKeySequence -> ''

### TQFont

Represents a font.

- TQFont -> ''

## KDE Object Types

### KURL

Represents a URL.

- KURL -> ''
- '' -> KURL