Commit aca407bf authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

wbemprox: Return a status from table fillers and add an optional condition parameter.

parent 8f69a44b
......@@ -114,8 +114,6 @@ static inline BOOL is_strcmp( const struct complex_expr *expr )
(expr->left->type == EXPR_SVAL && expr->right->type == EXPR_PROPVAL));
}
static HRESULT eval_cond( const struct table *, UINT, const struct expr *, LONGLONG * );
static HRESULT eval_binary( const struct table *table, UINT row, const struct complex_expr *expr,
LONGLONG *val )
{
......@@ -211,8 +209,7 @@ static HRESULT eval_propval( const struct table *table, UINT row, const struct p
return get_value( table, row, column, val );
}
static HRESULT eval_cond( const struct table *table, UINT row, const struct expr *cond,
LONGLONG *val )
HRESULT eval_cond( const struct table *table, UINT row, const struct expr *cond, LONGLONG *val )
{
if (!cond)
{
......@@ -249,7 +246,7 @@ static HRESULT execute_view( struct view *view )
if (view->table->fill)
{
clear_table( view->table );
view->table->fill( view->table );
view->table->fill( view->table, view->cond );
}
if (!view->table->num_rows) return S_OK;
......
......@@ -344,7 +344,8 @@ struct table *grab_table( const WCHAR *name )
}
struct table *create_table( const WCHAR *name, UINT num_cols, const struct column *columns,
UINT num_rows, BYTE *data, void (*fill)(struct table *) )
UINT num_rows, BYTE *data,
enum fill_status (*fill)(struct table *, const struct expr *cond) )
{
struct table *table;
......
......@@ -41,6 +41,51 @@ enum param_direction
typedef HRESULT (class_method)(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **);
enum operator
{
OP_EQ = 1,
OP_AND = 2,
OP_OR = 3,
OP_GT = 4,
OP_LT = 5,
OP_LE = 6,
OP_GE = 7,
OP_NE = 8,
OP_ISNULL = 9,
OP_NOTNULL = 10,
OP_LIKE = 11
};
struct expr;
struct complex_expr
{
enum operator op;
struct expr *left;
struct expr *right;
};
enum expr_type
{
EXPR_COMPLEX = 1,
EXPR_UNARY = 2,
EXPR_PROPVAL = 3,
EXPR_SVAL = 4,
EXPR_IVAL = 5,
EXPR_BVAL = 6
};
struct expr
{
enum expr_type type;
union
{
struct complex_expr expr;
const struct property *propval;
const WCHAR *sval;
int ival;
} u;
};
struct column
{
const WCHAR *name;
......@@ -48,6 +93,13 @@ struct column
VARTYPE vartype; /* 0 for default mapping */
};
enum fill_status
{
FILL_STATUS_FAILED = -1,
FILL_STATUS_UNFILTERED,
FILL_STATUS_FILTERED
};
#define TABLE_FLAG_DYNAMIC 0x00000001
struct table
......@@ -57,7 +109,7 @@ struct table
const struct column *columns;
UINT num_rows;
BYTE *data;
void (*fill)(struct table *);
enum fill_status (*fill)(struct table *, const struct expr *cond);
UINT flags;
struct list entry;
LONG refs;
......@@ -95,51 +147,6 @@ struct record
struct table *table;
};
enum operator
{
OP_EQ = 1,
OP_AND = 2,
OP_OR = 3,
OP_GT = 4,
OP_LT = 5,
OP_LE = 6,
OP_GE = 7,
OP_NE = 8,
OP_ISNULL = 9,
OP_NOTNULL = 10,
OP_LIKE = 11
};
struct expr;
struct complex_expr
{
enum operator op;
struct expr *left;
struct expr *right;
};
enum expr_type
{
EXPR_COMPLEX = 1,
EXPR_UNARY = 2,
EXPR_PROPVAL = 3,
EXPR_SVAL = 4,
EXPR_IVAL = 5,
EXPR_BVAL = 6
};
struct expr
{
enum expr_type type;
union
{
struct complex_expr expr;
const struct property *propval;
const WCHAR *sval;
int ival;
} u;
};
struct view
{
const struct property *proplist;
......@@ -167,13 +174,14 @@ void init_table_list( void ) DECLSPEC_HIDDEN;
struct table *grab_table( const WCHAR * ) DECLSPEC_HIDDEN;
struct table *addref_table( struct table * ) DECLSPEC_HIDDEN;
void release_table( struct table * ) DECLSPEC_HIDDEN;
struct table *create_table( const WCHAR *, UINT, const struct column *, UINT,
BYTE *, void (*)(struct table *)) DECLSPEC_HIDDEN;
struct table *create_table( const WCHAR *, UINT, const struct column *, UINT, BYTE *,
enum fill_status (*)(struct table *, const struct expr *) ) DECLSPEC_HIDDEN;
BOOL add_table( struct table * ) DECLSPEC_HIDDEN;
void free_columns( struct column *, UINT ) DECLSPEC_HIDDEN;
void clear_table( struct table * ) DECLSPEC_HIDDEN;
void free_table( struct table * ) DECLSPEC_HIDDEN;
UINT get_type_size( CIMTYPE ) DECLSPEC_HIDDEN;
HRESULT eval_cond( const struct table *, UINT, const struct expr *, LONGLONG * ) DECLSPEC_HIDDEN;
HRESULT get_column_index( const struct table *, const WCHAR *, UINT * ) DECLSPEC_HIDDEN;
HRESULT get_value( const struct table *, UINT, UINT, LONGLONG * ) DECLSPEC_HIDDEN;
BSTR get_value_bstr( const struct table *, UINT, UINT ) DECLSPEC_HIDDEN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment