/* * This file is a part of Winix * and is distributed under the 2-Clause BSD licence. * Author: Tomasz Sowa */ /* * Copyright (c) 2012-2016, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * */ #include "templates.h" namespace Winix { namespace TemplatesFunctions { /* * return a value from a space * you can define you own ezc function e.g. my_space_value(Info &i) in such a way: * * void my_space_value(Info & i) * { * space_value(i, the_space_object_i_am_interested_in); * } * * and now you can call it from ezc template: * [my_space_value "foo"] -> looking for parameter "foo" in the global space of the_space_object_i_am_interest_in * [my_space_value "foo" "bar"] -> first looking for a space with "foo" name then looking for "bar" parameter * * * there is some built-in optimization made: * if you are looking for parameters from the same space e.g. * [my_space_value "foo" "foo2" "param1"] * [my_space_value "foo" "foo2" "param2"] * [my_space_value "foo" "foo2" "param3"] * after looking for param1 the address of foo2 space is cached in a local map (first we're looking for foo and then for foo2) * and when looking for param2 and param3 the address of foo2 is taken from the map * * */ void space_value(Info & i, pt::Space & space, bool escape = true); // !! IMPROVE ME // add // void space_list_tab_size(Info & i, pt::Space & space); void space_list_tab(Info & i, pt::Space & space); void space_list_tab_value(Info & i, pt::Space & space, const std::wstring & function_name); void space_list_tab_has_next(Info & i, pt::Space & space, const std::wstring & function_name); // !! IMPROVE ME // !! add space_tab (iteration through spaces) } // namespace TemplatesFunctions } // namespace Winix