Mercurial > malikania
view libclient-js/malikania/js_line.hpp @ 43:fabbe1759cec
Misc: switch to mlk namespace, closes #589
author | David Demelier <markand@malikania.fr> |
---|---|
date | Tue, 29 Nov 2016 22:25:17 +0100 |
parents | a47a4477f347 |
children | 858621081b95 |
line wrap: on
line source
/* * js_line.hpp -- line description (JavaScript binding) * * Copyright (c) 2013-2016 Malikania Authors * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef MALIKANIA_JS_LINE_HPP #define MALIKANIA_JS_LINE_HPP /** * \file js_line.hpp * \brief JavaScript binding for line. * * lines are plain objects. * * ```` * { * x1: 10, * y1: 10, * x2: 50, * y2: 50 * } * ```` */ #include "duktape.hpp" #include "line.hpp" namespace mlk { /** * Get a line. * * \param ctx the context * \param index the index * \return the line */ line dukx_get_line(duk_context* ctx, duk_idx_t index); /** * Require a line. * * If value is not an object or any property is invalid, raise a JavaScript error. * * \param ctx the context * \param index the index * \return the line */ line dukx_require_line(duk_context* ctx, duk_idx_t index); /** * Like get but return def if the value at the given index is not an object. * * \param ctx the context * \param index the index * \param def the default value * \return the line */ line dukx_optional_line(duk_context* ctx, duk_idx_t index, line def); /** * Push the line as object. * * \param ctx the context * \param line the line */ void dukx_push_line(duk_context* ctx, const line &line); /** * Put the line properties into the object at the top of the stack. * * \param ctx the context * \param line the line */ void dukx_put_line(duk_context* ctx, const line &line); void dukx_load_line(duk_context* ctx); } // !mlk #endif // !MALIKANIA_JS_LINE_HPP