Qorize.qm.dox.h
// -*- mode: c++; indent-tabs-mode: nil -*-
// @file Qorize.qm Qorize module definition
/* Qorize.qm Copyright 2013 - 2017 Qore Technologies s r.o.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
// minimum qore version
// assume local var scope, do not use "$" for vars, members, and method calls
/* Version History
* 2016-28-11 v 0.1.2 Tomas Mandys
+ open parenthesis at the same line
+ more compact output
+ indentation size
+ cutly or round parenthesis for hash
+ qorize() formatting improvement when a list contains list or hash
+ object support
+ qorize_named() supports hash, object, list, any
* 2016-06-29 v 0.1.1: Petr Vanek <petr@yarpen.cz>
+ qorize_val() implemented
+ new style is used as default for arguments
+ qorizeNamed() is deprecated now. Use qorize_named() instead
* 2015-11-11 v 0.1.0: Petr Vanek <petr@yarpen.cz>
+ improvements and bugfixes
* 2015-11-11 v 0.0.10: David Nichols <david@qore.org>
+ converted to new-style
* 2013-08-15 v 0.0.9: Petr Vanek <petr@yarpen.cz>
+ initial version
*/
namespace Qorize {
string qorize(bool val, string name = "var", bool newstyle = True);
string qorize(string val, string name = "var", bool newstyle = True);
string qorize(int val, string name = "var", bool newstyle = True);
string qorize(float val, string name = "var", bool newstyle = True);
string qorize(number val, string name = "var", bool newstyle = True);
string qorize(date val, string name = "var", bool newstyle = True);
string qorize(binary val, string name = "var", bool newstyle = True);
string qorize(list val, string name = "var", bool newstyle = True, int indentation = 2, bool curlyHash = True);
string qorize(hash val, string name = "var", bool newstyle = True, int indentation = 2, bool curlyHash = True);
string qorize(object val, string name = "var", bool newstyle = True, int indentation = 2, bool curlyHash = True);
string qorize_named(hash val, string name = "var", bool newstyle = True);
string qorize_named(object val, string name = "var", bool newstyle = True);
string qorize_named(list val, string name = "var", bool newstyle = True);
deprecated string qorizeNamed(hash val, string name = "var", bool newstyle = True);
string qorize_named(auto val, string name = "var", bool newstyle = True);
string qorize(auto val, string name = "var", bool newstyle = True);
string qorize_val(list val, int indentation = 2, bool curlyHash = True);
string qorize_val(hash val, int indentation = 2, bool curlyHash = True);
string qorize_val(auto val);
// a helper class holding all logic
class QorizeHelper {
public:
private :
auto container;
string code;
int level = 0;
bool newstyle;
int indentation;
bool curlyHash;
hash objectSignatures;
public:
static string checkVariableName(string name, auto val, bool newstyle);
static string escape(bool val);
static string escape(string val);
static string escape(int val);
static string escape(float val);
static string escape(number val);
static string escape(date val);
static string escape(binary val);
static string escape(object val);
static string escape(auto val);
constructor(auto n_container, bool n_newstyle = True, int n_indentation = 2, bool n_curlyHash = True);
string list();
string hash();
*string named(string name);
private:
processNamed(hash val, string prefixName);
public:
private:
processNamed(object val, string prefixName);
public:
private:
processNamed(list val, string prefixName);
public:
private:
processNamed(auto val, string prefixName);
public:
private:
process(list val);
public:
private:
process(hash val);
public:
private:
process(auto val);
public:
}; // class QorizeHelper
}; // namespace Qorize
date
date date(date dt)
Qorize::qorize_named
string qorize_named(hash val, string name="var", bool newstyle=True)
create code from the hash value - with one value per one line
True
const True
number
number number(softnumber n)
binary
binary binary()
list
list list(...)
Qorize::qorizeNamed
deprecated string qorizeNamed(hash val, string name="var", bool newstyle=True)
Deprecated, use qorize_named() instead.
Qorize::qorize
string qorize(bool val, string name="var", bool newstyle=True)
create code from the boolean value
Qorize
public Qorize namespace contains all relevant stuff for this module
Definition: Qorize.qm.dox.h:87
hash
hash hash(object obj)
Qorize::qorize_val
string qorize_val(list val, int indentation=2, bool curlyHash=True)
create code without any variable assignment (lvalue)