All Classes Namespaces Functions Variables Groups Pages
Qorize Functions

## Functions

string | Qorize::qorize (bool val, string name="var", bool newstyle=False)
| create code from the boolean value More...
string | Qorize::qorize (string val, string name="var", bool newstyle=False)
| create code from the string value More...
string | Qorize::qorize (int val, string name="var", bool newstyle=False)
| create code from the integer value More...
string | Qorize::qorize (float val, string name="var", bool newstyle=False)
| create code from the float value More...
string | Qorize::qorize (number val, string name="var", bool newstyle=False)
| create code from the number value More...
string | Qorize::qorize (date val, string name="var", bool newstyle=False)
| create code from the date value More...
string | Qorize::qorize (binary val, string name="var", bool newstyle=False)
| create code from the binary value More...
string | Qorize::qorize (list val, string name="var", bool newstyle=False)
| create code from the list value More...
string | Qorize::qorize (hash val, string name="var", bool newstyle=False)
| create code from the hash value More...
string | Qorize::qorize (any val, string name="var", bool newstyle=False)
| create code from the any value - fallback for NULL and NOTHINGS More...
string | Qorize::qorizeNamed (hash val, string name="var", bool newstyle=False)
| create code from the hash value - with one value per one line More...

## Detailed Description

## Function Documentation

string Qorize::qorize | ( | bool | val,
|  | string | name = `"var"`,
|  | bool | newstyle = `False`
| ) |  |

create code from the boolean value

Parameters

  val | an input value
  name | an optional name of the resulting variable
  newstyle | an optional argument. True when to use Qore::PO_NEW_STYLE syntax, False otherwise

Return values

  string | a generated code

string s = qorize(True);
# "bool var = True;"
string s = qorize(True, "foo", True);
# "bool foo = True;"

Exceptions

  QORIZE-ERROR | in case of error in code generator

string Qorize::qorize | ( | string | val,
|  | string | name = `"var"`,
|  | bool | newstyle = `False`
| ) |  |

create code from the string value

Parameters

  val | an input value
  name | an optional name of the resulting variable
  newstyle | an optional argument. True when to use Qore::PO_NEW_STYLE syntax, False otherwise

Return values

  string | a generated code

string s = qorize("lorem ipsum");
# "string var = \"lorem ipsum\";"
string s = qorize("lorem ipsum", "foo", True);
# "string foo = \"lorem ipsum\";"

Exceptions

  QORIZE-ERROR | in case of error in code generator

string Qorize::qorize | ( | int | val,
|  | string | name = `"var"`,
|  | bool | newstyle = `False`
| ) |  |

create code from the integer value

Parameters

  val | an input value
  name | an optional name of the resulting variable
  newstyle | an optional argument. True when to use Qore::PO_NEW_STYLE syntax, False otherwise

Return values

  string | a generated code

string s = qorize(1);
# "int var = 1;"
string s = qorize(1, "foo", True);
# "int foo = 1;"

Exceptions

  QORIZE-ERROR | in case of error in code generator

string Qorize::qorize | ( | float | val,
|  | string | name = `"var"`,
|  | bool | newstyle = `False`
| ) |  |

create code from the float value

Parameters

  val | an input value
  name | an optional name of the resulting variable
  newstyle | an optional argument. True when to use Qore::PO_NEW_STYLE syntax, False otherwise

Return values

  string | a generated code

string s = qorize(1.2);
# "float var = 1;"
string s = qorize(1.2, "foo", True);
# "float foo = 1;"

Exceptions

  QORIZE-ERROR | in case of error in code generator

string Qorize::qorize | ( | number | val,
|  | string | name = `"var"`,
|  | bool | newstyle = `False`
| ) |  |

create code from the number value

Parameters

  val | an input value
  name | an optional name of the resulting variable
  newstyle | an optional argument. True when to use Qore::PO_NEW_STYLE syntax, False otherwise

Return values

  string | a generated code

string s = qorize(123n);
# "number var = 123n;"
string s = qorize(123n, "foo", True);
# "number foo = 123n;"

Exceptions

  QORIZE-ERROR | in case of error in code generator

string Qorize::qorize | ( | date | val,
|  | string | name = `"var"`,
|  | bool | newstyle = `False`
| ) |  |

create code from the date value

Parameters

  val | an input value
  name | an optional name of the resulting variable
  newstyle | an optional argument. True when to use Qore::PO_NEW_STYLE syntax, False otherwise

Return values

  string | a generated code

string s = qorize(now());
# "date var = 2013-08-16T14:37:05.000;"
string s = qorize(now(), "foo", True);
# "date foo = 2013-08-16T14:37:05.000;"

Relative date values (1D, etc.) are converted to Short Relative Time Format

string s = qorize(3h);
# date d = PT3H;

Exceptions

  QORIZE-ERROR | in case of error in code generator

string Qorize::qorize | ( | binary | val,
|  | string | name = `"var"`,
|  | bool | newstyle = `False`
| ) |  |

create code from the binary value

Parameters

  val | an input value
  name | an optional name of the resulting variable
  newstyle | an optional argument. True when to use Qore::PO_NEW_STYLE syntax, False otherwise

Return values

  string | a generated code

Binary values are encoded in hexadecimal strings.

binary bin = ....; # binary value from file for example
string s = qorize(bin);
# "binary var = parseHexString(\"666f6f\");"
string s = qorize(bin, "foo", True);
# "binary foo = parseHexString(\"666f6f\");"

Exceptions

  QORIZE-ERROR | in case of error in code generator

string Qorize::qorize | ( | list | val,
|  | string | name = `"var"`,
|  | bool | newstyle = `False`
| ) |  |

create code from the list value

Parameters

  val | an input value
  name | an optional name of the resulting variable
  newstyle | an optional argument. True when to use Qore::PO_NEW_STYLE syntax, False otherwise

Return values

  string | a generated code

list l = (True, False, now(), 12, 12.1, ( 'a', 'b'), );
string s = qorize(l);
# "list var =
# (True,False,2013-08-16T15:06:29.000,12,12.1,
# ("a","b",),);"
string s = qorize(l, "foo", True);
# "list foo =
# (True,False,2013-08-16T15:06:29.000,12,12.1,
# ("a","b",),);"

Exceptions

  QORIZE-ERROR | in case of error in code generator

string Qorize::qorize | ( | hash | val,
|  | string | name = `"var"`,
|  | bool | newstyle = `False`
| ) |  |

create code from the hash value

Parameters

  val | an input value
  name | an optional name of the resulting variable
  newstyle | an optional argument. True when to use Qore::PO_NEW_STYLE syntax, False otherwise

Return values

  string | a generated code

hash h = (
"foo" : "bar",
"key1" : now(),
"key2" : 12,
"key3" : ( 1, 2, 3),
"key4" : ( "subkey1" : 1, "subkey2" : 2, ),
);
string s = qorize(h);
# "hash var =
# (
# "foo" : "bar",
# "key1" : 2013-08-16T15:10:30.000,
# "key2" : 12,
# "key3" :
# (1,2,3,),
# "key4" :
# (
# "subkey1" : 1,
# "subkey2" : 2,
# ),
# );"
string s = qorize(h, "foo", True);
# "hash foo =
# (
# "foo" : "bar",
# "key1" : 2013-08-16T15:10:30.000,
# "key2" : 12,
# "key3" :
# (1,2,3,),
# "key4" :
# (
# "subkey1" : 1,
# "subkey2" : 2,
# ),
# );"

Exceptions

  QORIZE-ERROR | in case of error in code generator

string Qorize::qorize | ( | any | val,
|  | string | name = `"var"`,
|  | bool | newstyle = `False`
| ) |  |

create code from the any value - fallback for NULL and NOTHINGS

Parameters

  val | an input value
  name | an optional name of the resulting variable
  newstyle | an optional argument. True when to use Qore::PO_NEW_STYLE syntax, False otherwise

Return values

  string | a generated code

any s = qorize(NULL);
# "any var = NULL;"
string s = qorize(NULL, "foo", True);
# "any foo = NULL;"

Exceptions

  QORIZE-ERROR | in case of error in code generator

string Qorize::qorizeNamed | ( | hash | val,
|  | string | name = `"var"`,
|  | bool | newstyle = `False`
| ) |  |

create code from the hash value - with one value per one line

Parameters

  val | an input value
  name | an optional name of the resulting variable
  newstyle | an optional argument. True when to use Qore::PO_NEW_STYLE syntax, False otherwise

Return values

  string | a generated code

hash h = (
"foo" : "bar",
"key1" : now(),
"key2" : 12,
"key3" : ( 1, 2, 3),
"key4" : ( "subkey1" : 1, "subkey2" : 2, ),
);
string s = qorizeNamed(h);
# "hash name;
# var."foo" = "bar";
# var."key1" = 2013-08-16T15:14:40.000;
# var."key2" = 12;
# var."key3" = (1,2,3,);
# var."key4"."subkey1" = 1;
# var."key4"."subkey2" = 2;
string s = qorizeNamed(h, "foo", True);
# "hash foo;
# foo."foo" = "bar";
# foo."key1" = 2013-08-16T15:14:40.000;
# foo."key2" = 12;
# foo."key3" = (1,2,3,);
# foo."key4"."subkey1" = 1;
# foo."key4"."subkey2" = 2;"

Exceptions

  QORIZE-ERROR | in case of error in code generator