1 /* This file is part of the yazpp toolkit.
2 * Copyright (C) Index Data
3 * See the file LICENSE for details.
11 #include <yazpp/z-databases.h>
13 using namespace yazpp_1;
15 Yaz_Z_Databases::Yaz_Z_Databases()
17 nmem = nmem_create ();
22 Yaz_Z_Databases::~Yaz_Z_Databases()
27 void Yaz_Z_Databases::set (int num, const char **db)
31 m_list = (char **) nmem_malloc (nmem, num * sizeof(char*));
33 for (int i = 0; i<num; i++)
34 m_list[i] = nmem_strdup (nmem, db[i] ? db[i] : "Default");
37 void Yaz_Z_Databases::get (NMEM n, int *num, char ***db)
40 *db = (char **) nmem_malloc (n, m_num * sizeof(char*));
41 for (int i = 0; i < m_num; i++)
42 (*db)[i] = nmem_strdup (n, m_list[i]);
45 void Yaz_Z_Databases::get (ODR o, int *num, char ***db)
47 get (o->mem, num, db);
50 int Yaz_Z_Databases::match (Yaz_Z_Databases &db)
52 if (db.m_num != m_num)
54 for (int i = 0; i<m_num; i++)
55 if (strcmp (m_list[i], db.m_list[i]))
60 int Yaz_Z_Databases::match (int num, const char **db)
64 for (int i = 0; i<m_num; i++)
65 if (strcmp (m_list[i], db[i]))
72 * c-file-style: "Stroustrup"
73 * indent-tabs-mode: nil
75 * vim: shiftwidth=4 tabstop=8 expandtab