|
Packit |
0021fb |
/*
|
|
Packit |
0021fb |
* This file is part of ltrace.
|
|
Packit |
0021fb |
* Copyright (C) 2011, 2012 Petr Machata, Red Hat Inc.
|
|
Packit |
0021fb |
*
|
|
Packit |
0021fb |
* This program is free software; you can redistribute it and/or
|
|
Packit |
0021fb |
* modify it under the terms of the GNU General Public License as
|
|
Packit |
0021fb |
* published by the Free Software Foundation; either version 2 of the
|
|
Packit |
0021fb |
* License, or (at your option) any later version.
|
|
Packit |
0021fb |
*
|
|
Packit |
0021fb |
* This program is distributed in the hope that it will be useful, but
|
|
Packit |
0021fb |
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
0021fb |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
0021fb |
* General Public License for more details.
|
|
Packit |
0021fb |
*
|
|
Packit |
0021fb |
* You should have received a copy of the GNU General Public License
|
|
Packit |
0021fb |
* along with this program; if not, write to the Free Software
|
|
Packit |
0021fb |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
|
Packit |
0021fb |
* 02110-1301 USA
|
|
Packit |
0021fb |
*/
|
|
Packit |
0021fb |
|
|
Packit |
0021fb |
#ifndef LENS_ENUM_H
|
|
Packit |
0021fb |
#define LENS_ENUM_H
|
|
Packit |
0021fb |
|
|
Packit |
0021fb |
#include "lens.h"
|
|
Packit |
0021fb |
#include "vect.h"
|
|
Packit |
0021fb |
|
|
Packit |
0021fb |
struct enum_lens {
|
|
Packit |
0021fb |
struct lens super;
|
|
Packit |
0021fb |
struct vect entries;
|
|
Packit |
0021fb |
};
|
|
Packit |
0021fb |
|
|
Packit |
0021fb |
/* Init enumeration LENS. */
|
|
Packit |
0021fb |
void lens_init_enum(struct enum_lens *lens);
|
|
Packit |
0021fb |
|
|
Packit |
0021fb |
/* Push another member of the enumeration, named KEY, with given
|
|
Packit |
0021fb |
* VALUE. If OWN_KEY, KEY is owned and released after the type is
|
|
Packit |
0021fb |
* destroyed. KEY is typed as const char *, but note that if OWN_KEY,
|
|
Packit |
0021fb |
* this value will be freed. If OWN_VALUE, then VALUE is owned and
|
|
Packit |
0021fb |
* destroyed by LENS. */
|
|
Packit |
0021fb |
int lens_enum_add(struct enum_lens *lens,
|
|
Packit |
0021fb |
const char *key, int own_key,
|
|
Packit |
0021fb |
struct value *value, int own_value);
|
|
Packit |
0021fb |
|
|
Packit |
0021fb |
/* Return number of enum elements of type INFO. */
|
|
Packit |
0021fb |
size_t lens_enum_size(struct enum_lens *lens);
|
|
Packit |
0021fb |
|
|
Packit |
0021fb |
#endif /* LENS_ENUM_H */
|