|
yast2-core
|
#include "ycp/YCPBuiltinTerm.h"#include "ycp/YCPTerm.h"#include "ycp/YCPInteger.h"#include "ycp/YCPString.h"#include "ycp/StaticDeclaration.h"#include "ycp/y2log.h"Macros | |
| #define | ETC 0, NULL, constTypePtr(), NULL |
| #define | ETCf NULL, constTypePtr(), NULL |
Functions | |
| static YCPValue | t_size (const YCPTerm &term) |
| static YCPValue | t_add (const YCPTerm &term, const YCPValue &value) |
| static YCPValue | t_symbolof (const YCPTerm &term) |
| YCPValue | t_select (const YCPValue &term, const YCPValue &i, const YCPValue &def) |
| static YCPValue | t_toterm1 (const YCPValue &v) |
| static YCPValue | t_toterm2 (const YCPSymbol &s, const YCPList &l) |
| static YCPValue | t_remove (const YCPTerm &term, const YCPInteger &i) |
| static YCPValue | t_argsof (const YCPTerm &term) |
Variables | |
| StaticDeclaration | static_declarations |
| #define ETC 0, NULL, constTypePtr(), NULL |
Referenced by YCPBuiltinTerm::YCPBuiltinTerm().
| #define ETCf NULL, constTypePtr(), NULL |
Referenced by YCPBuiltinTerm::YCPBuiltinTerm().
add add-term Add value to term Adds the value VALUE to the term TERM and returns the newly created term. As always in YCP, TERM is not modified.
| term | TERM |
| any | VALUE |
VBox(Empty()), Label("a")) ->VBox (Empty (),Label ("a")) add (VBox(Empty()), "a") -> VBox (Empty (), "a")References YCPTerm::functionalAdd(), and YCPElement::isNull().
Referenced by YCPBuiltinTerm::YCPBuiltinTerm().
argsof Returns the arguments of a term.
| term | TERM |
argsof (fun(1, 2)) -> [1, 2] @usage argsof(TextEntry(id("text"), "Label", "value")) -> [id ("text"), "Label", "value"]
References YCPTerm::args(), and YCPElement::isNull().
Referenced by YCPBuiltinTerm::YCPBuiltinTerm().
|
static |
remove remove-term Remove item from term
Remove the i'th value from a term. The first value has the index 1 (!). (The index counting is for compatibility reasons with the 'old' remove which allowed 'remove(`term(1,2,3), 0) = [1,2,3]' Use 'argsof (term) -> list' for this kind of transformation.)
The yast2-core version < 2.17.16 returns nil if the index is invalid. This behavior has changed in version 2.17.16 to return unchanged term.
| term | TERM |
| integer | i |
fun(1, 2), 1) ->fun(2) remove (VBox(Label("a"), Label("b")), 2) ->VBox (`Label ("a"))References YCPTerm::args(), YCPElement::isNull(), YCPTerm::name(), YCPList::remove(), YCPList::size(), toString(), and ycp2error.
Referenced by YCPBuiltinTerm::YCPBuiltinTerm().
select (deprecated, use TERM[ITEM]:DEFAULT) select-term Select item from term Gets the i'th value of the term t. The first value has the index 0. The call select ([1, 2, 3], 1) thus returns
default if the index is invalid or the found value has a diffetent type that default. Functionality replaced with syntax: term a = VBox(VSpacing(2), Label("string"),VSpacing(2)); a[1]:Empty() ->Label ("string") a[9]:Empty() ->Empty ()| term | TERM |
| integer | ITEM |
| any | DEFAULT |
select (`hirn (true, false), 33, true) -> true
References YCPElement::isNull(), YCPList::size(), and YCPList::value().
Referenced by l_select(), and YCPBuiltinTerm::YCPBuiltinTerm().
size size-term Returns the number of arguments of the term TERM.
| term | TERM |
TERMsize (VBox(Empty(),Empty(),Empty())) -> 3
References YCPElement::isNull(), and YCPTerm::size().
Referenced by YCPBuiltinTerm::YCPBuiltinTerm().
symbolof Returns the symbol of the term TERM.
| term | TERM |
symbolof (hrombuch (18, false)) ->hrombuch symbolof (Label("string")) ->Label
References YCPElement::isNull(), and YCPTerm::name().
Referenced by YCPBuiltinTerm::YCPBuiltinTerm().
toterm toterm-any Converts a value to a term.
If the value can't be converted to a term, nilterm is returned.
| any | VALUE |
toterm ("VBox") -> VBox () @usage toterm (VBox) -> `VBox ()
References YCPElement::isNull(), YT_STRING, YT_SYMBOL, and YT_TERM.
Referenced by YCPBuiltinTerm::YCPBuiltinTerm().
toterm toterm-list Constructs a term from a symbol and a list.
Constructs a term from a symbol and a list. Thus complement to symbolof and argsof.
| symbol | s |
| list | l |
toterm (RadioButton, [id (test), "Test" ]) ->RadioButton (id (test), "Test")
References YCPTerm::add(), YCPElement::isNull(), YCPList::size(), and YCPList::value().
Referenced by YCPBuiltinTerm::YCPBuiltinTerm().
| StaticDeclaration static_declarations |
1.8.6