ArrayType Class Reference

#include <Pt/Mcp/Type.h>

JSON array schema with one element type. More...

Inherits Type.

Public Types

enum  TypeId {
  Null = 0 ,
  Integer = 1 ,
  Number = 2 ,
  String = 3 ,
  Boolean = 4 ,
  Object = 5 ,
  Array = 6
}
 JSON Schema kind of a Type. More...

Public Member Functions

 ArrayType (const Type &items)
 Creates an array schema whose items have type items.
 ~ArrayType ()
 Destroys the array schema.
const Typeitems () const
 Returns the schema type of the array elements.
void toSchema (std::ostream &os, const std::string &description="") const override
 Writes this array as a JSON Schema object to os.
TypeId typeId () const
 Returns the JSON Schema kind of this type.

Detailed Description

ArrayType is a composed Type whose schema is a JSON array. The items type is the schema of every element. It is not owned; it must outlive this array type.

Member Enumeration Documentation

◆ TypeId

enum TypeId
inherited
Enumerator
Null 

JSON null.

Integer 

JSON integer.

Number 

JSON number.

String 

JSON string.

Boolean 

JSON boolean.

Object 

JSON object.

Array 

JSON array.