![]() |
![]() |
![]() |
libgebr Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
#define GEBR_IEXPR_ERROR GQuark gebr_iexpr_error_quark (void
); enum GebrIExprError; struct GebrIExprInterface; gboolean gebr_iexpr_set_var (GebrIExpr *self
,const gchar *name
,GebrGeoXmlParameterType type
,const gchar *value
,GError **error
); gboolean gebr_iexpr_is_valid (GebrIExpr *self
,const gchar *expr
,GError **error
); void gebr_iexpr_reset (GebrIExpr *self
); GList * gebr_iexpr_extract_vars (GebrIExpr *self
,const gchar *expr
); gboolean gebr_iexpr_eval (GebrIExpr *self
,const gchar *expr
,gchar **value
,GError **error
);
The GebrIExpr interface defines methods for creating and validating expressions. There are two kinds of expressions in GeBR: GebrArithmeticExpr and GebrStringExpr.
#define GEBR_IEXPR_ERROR (gebr_iexpr_error_quark())
Error domain for handling expressions. Errors in this domain will be from GebrIExprError enumeration.
typedef enum { GEBR_IEXPR_ERROR_INITIALIZE, GEBR_IEXPR_ERROR_EMPTY_EXPR, GEBR_IEXPR_ERROR_TOOBIG, GEBR_IEXPR_ERROR_RUNTIME, GEBR_IEXPR_ERROR_SYNTAX, GEBR_IEXPR_ERROR_UNDEF_VAR, GEBR_IEXPR_ERROR_UNDEF_REFERENCE, GEBR_IEXPR_ERROR_BAD_REFERENCE, GEBR_IEXPR_ERROR_INVAL_VAR, GEBR_IEXPR_ERROR_INVAL_TYPE, GEBR_IEXPR_ERROR_CYCLE, GEBR_IEXPR_ERROR_TYPE_MISMATCH, GEBR_IEXPR_ERROR_BAD_MOVE, GEBR_IEXPR_ERROR_PATH, } GebrIExprError;
Error codes returned by expression handling functions.
The validator failed to initialize. | |
The expression syntax is invalid. | |
An undefined variable was found. | |
Variable use another variable not well defined | |
An invalid variable name was found. | |
Variable type not supported. | |
The variable has cycle dependencies. | |
The numeric variable uses a string one. | |
struct GebrIExprInterface { GTypeInterface parent; gboolean (*set_var) (GebrIExpr *self, const gchar *name, GebrGeoXmlParameterType type, const gchar *value, GError **error); gboolean (*is_valid) (GebrIExpr *self, const gchar *expr, GError **error); void (*reset) (GebrIExpr *self); GList * (*extract_vars) (GebrIExpr *self, const gchar *expr); gboolean (*eval) (GebrIExpr *self, const gchar *expr, gchar **value, GError **error); };
gboolean gebr_iexpr_set_var (GebrIExpr *self
,const gchar *name
,GebrGeoXmlParameterType type
,const gchar *value
,GError **error
);
|
a GebrIExpr |
|
the name of the variable |
|
one of GebrGeoXmlParameterType |
|
the value of the variable |
|
return location for an GEBR_IEXPR_ERROR, or NULL
|
Returns : |
TRUE if variable was successfully set, FALSE otherwise. |
gboolean gebr_iexpr_is_valid (GebrIExpr *self
,const gchar *expr
,GError **error
);
|
a GebrIExpr |
|
the expression to check for validity |
|
return location for an GEBR_IEXPR_ERROR, or NULL
|
Returns : |
TRUE if expression is valid, FALSE otherwise. |
void gebr_iexpr_reset (GebrIExpr *self
);
Resets the state of this evaluator.
|
A GebrIExpr |
GList * gebr_iexpr_extract_vars (GebrIExpr *self
,const gchar *expr
);
Returns : |
A list of strings containing the variable names. You must free all strings and the list itself. |
gboolean gebr_iexpr_eval (GebrIExpr *self
,const gchar *expr
,gchar **value
,GError **error
);
|
a GebrIExpr |
|
expression to be evaluated. |
|
returns the value of the expression. |
|
return location for an GEBR_IEXPR_ERROR, or NULL
|
Returns : |
TRUE if expression is valid, FALSE otherwise. |