CppCrate 0.1
Public Types | Public Member Functions | Static Public Member Functions | List of all members
CppCrate::CrateDataType Class Reference

Public Types

enum  Type {
  Null = 0, NotSupported = 1, Byte = 2, Boolean = 3,
  String = 4, Ip = 5, Double = 6, Float = 7,
  Short = 8, Integer = 9, Long = 10, Timestamp = 11,
  Object = 12, GeoPoint = 13, GeoShape = 14, Array = 100,
  Set = 101
}
 

Public Member Functions

 CrateDataType (Type type=NotSupported, const std::string &definition=std::string())
 
const std::string & definition () const
 
void setDefinition (const std::string &definition)
 
void setType (int type)
 
void setType (Type type)
 
Type type () const
 

Static Public Member Functions

static Type convert (int type)
 

Detailed Description

The class CrateDataType provides information about a Crate table's column type of a query.

Member Enumeration Documentation

◆ Type

Describes the data type. The underlying integer corresponds to the one Crate is using: https://crate.io/docs/reference/protocols/http.html#column-types.

Enumerator
Null 

A null value.

NotSupported 

Unknown data type.

Byte 

A byte value (8-bit signed).

Boolean 

A boolean value.

String 

A string value.

Ip 

An IP value. (Returned as a string.)

Double 

A double value (64-bit IEEE 754 floating point).

Float 

A float value (32-bit IEEE 754 floating point).

Short 

A short value (16-bit signed).

Integer 

An integer value (32-bit signed).

Long 

A long value (64-bit signed).

Timestamp 

A timestamp value. (Returned as long.)

Object 

An JSON object.

GeoPoint 

A geographic point. (Returned as an array of two double values.)

GeoShape 

A geographic shape. (Returned as an object.)

Array 

An array value.

Set 

A set value.

Constructor & Destructor Documentation

◆ CrateDataType()

CppCrate::CrateDataType::CrateDataType ( CrateDataType::Type  type = NotSupported,
const std::string &  definition = std::string() 
)
explicit

Constructs a data type with the type type and its original definition definition.

Member Function Documentation

◆ convert()

CrateDataType::Type CppCrate::CrateDataType::convert ( int  type)
static

Returns the integer type converted into the type CrateDataType::Type. If type is not valid, CrateDataType::NotSupported is returned.

◆ definition()

const std::string & CppCrate::CrateDataType::definition ( ) const

Returns the original definition extracted from the key col_types.

◆ setDefinition()

void CppCrate::CrateDataType::setDefinition ( const std::string &  definition)

Sets the definition to definition.

◆ setType() [1/2]

void CppCrate::CrateDataType::setType ( int  type)

Sets the data type to type.

See also
convert()

◆ setType() [2/2]

void CppCrate::CrateDataType::setType ( CrateDataType::Type  type)

Sets the data type to type.

◆ type()

CrateDataType::Type CppCrate::CrateDataType::type ( ) const

Returns the data type.