mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-12-22 19:05:32 +02:00
b2/db.c: new function parts_dump to dump the whole parts database
This commit is contained in:
parent
be1277eb99
commit
22412764d9
20
b2/db.c
20
b2/db.c
@ -168,6 +168,9 @@ void part_add_stock(struct part *part, struct stock *s)
|
||||
}
|
||||
|
||||
|
||||
/* ----- Dumping ----------------------------------------------------------- */
|
||||
|
||||
|
||||
static void dump_stock(FILE *file, const struct stock *s)
|
||||
{
|
||||
const struct price *p;
|
||||
@ -199,6 +202,23 @@ void part_dump(FILE *file, const struct part *part)
|
||||
}
|
||||
|
||||
|
||||
static gboolean dump_prm_traverse(gpointer key, gpointer value, gpointer data)
|
||||
{
|
||||
struct part *p = key;
|
||||
FILE *file = data;
|
||||
|
||||
(void) value;
|
||||
part_dump(file, p);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
void parts_dump(FILE *file)
|
||||
{
|
||||
g_tree_foreach(tree, dump_prm_traverse, (void *) file);
|
||||
}
|
||||
|
||||
|
||||
/* ----- Currencies -------------------------------------------------------- */
|
||||
|
||||
|
||||
|
1
b2/db.h
1
b2/db.h
@ -98,6 +98,7 @@ void part_alias(struct part *a, struct part *b);
|
||||
void part_finalize(struct part *part, const struct action *act);
|
||||
void part_add_stock(struct part *part, struct stock *s);
|
||||
void part_dump(FILE *file, const struct part *part);
|
||||
void parts_dump(FILE *file);
|
||||
|
||||
const struct currency *currency_lookup(const char *name);
|
||||
double currency_convert(const struct currency *from, const struct currency *to,
|
||||
|
Loading…
Reference in New Issue
Block a user