1 /* This file is part of the yazpp toolkit.
2 * Copyright (C) 1998-2009 Index Data and Mike Taylor
3 * See the file LICENSE for details.
8 #include <yazpp/z-databases.h>
10 using namespace yazpp_1;
12 Yaz_Z_Databases::Yaz_Z_Databases()
14 nmem = nmem_create ();
19 Yaz_Z_Databases::~Yaz_Z_Databases()
24 void Yaz_Z_Databases::set (int num, const char **db)
28 m_list = (char **) nmem_malloc (nmem, num * sizeof(char*));
30 for (int i = 0; i<num; i++)
31 m_list[i] = nmem_strdup (nmem, db[i] ? db[i] : "Default");
34 void Yaz_Z_Databases::get (NMEM n, int *num, char ***db)
37 *db = (char **) nmem_malloc (n, m_num * sizeof(char*));
38 for (int i = 0; i < m_num; i++)
39 (*db)[i] = nmem_strdup (n, m_list[i]);
42 void Yaz_Z_Databases::get (ODR o, int *num, char ***db)
44 get (o->mem, num, db);
47 int Yaz_Z_Databases::match (Yaz_Z_Databases &db)
49 if (db.m_num != m_num)
51 for (int i = 0; i<m_num; i++)
52 if (strcmp (m_list[i], db.m_list[i]))
57 int Yaz_Z_Databases::match (int num, const char **db)
61 for (int i = 0; i<m_num; i++)
62 if (strcmp (m_list[i], db[i]))
69 * c-file-style: "Stroustrup"
70 * indent-tabs-mode: nil
72 * vim: shiftwidth=4 tabstop=8 expandtab