From d938b926f83537be7fe7260ea0537345e25be979 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 12 Feb 2009 01:50:39 +0000 Subject: Merge various collections into single files, reduce rampant code duplication. git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@1925 a436a847-0d15-0410-975c-d299462d15a1 --- slv2/plugin.h | 2 +- slv2/pluginclasses.h | 83 ------------------------------------------------- slv2/plugins.h | 87 ---------------------------------------------------- slv2/pluginuis.h | 87 ---------------------------------------------------- slv2/port.h | 2 +- slv2/scalepoints.h | 73 ------------------------------------------- slv2/slv2.h | 7 ++--- slv2/types.h | 1 + slv2/values.h | 81 ------------------------------------------------ slv2/world.h | 3 +- 10 files changed, 6 insertions(+), 420 deletions(-) delete mode 100644 slv2/pluginclasses.h delete mode 100644 slv2/plugins.h delete mode 100644 slv2/pluginuis.h delete mode 100644 slv2/scalepoints.h delete mode 100644 slv2/values.h (limited to 'slv2') diff --git a/slv2/plugin.h b/slv2/plugin.h index 8980f2e..56509ea 100644 --- a/slv2/plugin.h +++ b/slv2/plugin.h @@ -27,7 +27,7 @@ extern "C" { #include #include "slv2/types.h" #include "slv2/port.h" -#include "slv2/values.h" +#include "slv2/collections.h" /** \defgroup slv2_data Plugin data access * diff --git a/slv2/pluginclasses.h b/slv2/pluginclasses.h deleted file mode 100644 index 7ad3455..0000000 --- a/slv2/pluginclasses.h +++ /dev/null @@ -1,83 +0,0 @@ -/* SLV2 - * Copyright (C) 2007 Dave Robillard - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef __SLV2_PLUGIN_CLASSES_H__ -#define __SLV2_PLUGIN_CLASSES_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "slv2/pluginclass.h" - -/** \addtogroup slv2_collections - * @{ - */ - - -/** Free an SLV2PluginClasses. - * Note that only certain plugin classes should be freed by the user - * (as specified by the documentation of the slv2 function which returned it). - */ -void slv2_plugin_classes_free(SLV2PluginClasses classes); - - -/** Get the number of plugins in the collection. - */ -unsigned -slv2_plugin_classes_size(SLV2PluginClasses classes); - - -/** Get a plugin class from the collection by URI. - * - * Return value is shared (stored in \a classes) and must not be freed or - * modified by the caller in any way. - * - * Time = O(log2(n)) - * - * \return NULL if plugin with \a url not found in \a classes. - */ -SLV2PluginClass -slv2_plugin_classes_get_by_uri(SLV2PluginClasses classes, - SLV2Value uri); - - -/** Get a plugin from the collection by index. - * - * \a index has no significance other than as an index into \a classes. - * Any \a index not less than slv2_plugin_classes_get_length(classes) will return NULL, - * so all plugin_classes in a classes can be enumerated by repeated calls - * to this function starting with \a index = 0. - * - * Time = O(1) - * - * \return NULL if \a index out of range. - */ -SLV2PluginClass -slv2_plugin_classes_get_at(SLV2PluginClasses classes, - unsigned index); - - -/** @} */ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* __SLV2_PLUGIN_CLASSES_H__ */ - diff --git a/slv2/plugins.h b/slv2/plugins.h deleted file mode 100644 index 095bdbb..0000000 --- a/slv2/plugins.h +++ /dev/null @@ -1,87 +0,0 @@ -/* SLV2 - * Copyright (C) 2007 Dave Robillard - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef __SLV2_PLUGINS_H__ -#define __SLV2_PLUGINS_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "slv2/types.h" -#include "slv2/plugin.h" - -/** \addtogroup slv2_collections - * @{ - */ - - -/** Free a plugin plugins. - * - * Freeing a plugin collection does not destroy the plugins it contains - * (plugins are owned by the world). \a plugins is invalid after this call. - */ -void -slv2_plugins_free(SLV2World world, - SLV2Plugins plugins); - - -/** Get the number of plugins in the collection. - */ -unsigned -slv2_plugins_size(SLV2Plugins plugins); - - -/** Get a plugin from the collection by URI. - * - * Return value is shared (stored in \a plugins) and must not be freed or - * modified by the caller in any way. - * - * Time = O(log2(n)) - * - * \return NULL if plugin with \a url not found in \a plugins. - */ -SLV2Plugin -slv2_plugins_get_by_uri(SLV2Plugins plugins, - SLV2Value uri); - - -/** Get a plugin from the plugins by index. - * - * \a index has no significance other than as an index into this plugins. - * Any \a index not less than slv2_plugins_get_length(plugins) will return NULL, - * so all plugins in a plugins can be enumerated by repeated calls - * to this function starting with \a index = 0. - * - * Time = O(1) - * - * \return NULL if \a index out of range. - */ -SLV2Plugin -slv2_plugins_get_at(SLV2Plugins plugins, - unsigned index); - - -/** @} */ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* __SLV2_PLUGINS_H__ */ - diff --git a/slv2/pluginuis.h b/slv2/pluginuis.h deleted file mode 100644 index 6df49a0..0000000 --- a/slv2/pluginuis.h +++ /dev/null @@ -1,87 +0,0 @@ -/* SLV2 - * Copyright (C) 2007 Dave Robillard - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef __SLV2_PLUGIN_UIS_H__ -#define __SLV2_PLUGIN_UIS_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "slv2/types.h" -#include "slv2/plugin.h" - -/** \addtogroup slv2_collections - * - * @{ - */ - - -/** Free a plugin list. - * - * Freeing a plugin list does not destroy the plugins it contains (plugins - * are owned by the world). \a list is invalid after this call. - */ -void -slv2_uis_free(SLV2UIs list); - - -/** Get the number of plugins in the list. - */ -unsigned -slv2_uis_size(SLV2UIs list); - - -/** Get a plugin from the list by URI. - * - * Return value is shared (stored in \a list) and must not be freed or - * modified by the caller in any way. - * - * Time = O(log2(n)) - * - * \return NULL if plugin with \a url not found in \a list. - */ -SLV2UI -slv2_uis_get_by_uri(SLV2UIs list, - SLV2Value uri); - - -/** Get a plugin from the list by index. - * - * \a index has no significance other than as an index into this list. - * Any \a index not less than slv2_list_get_length(list) will return NULL, - * so all plugins in a list can be enumerated by repeated calls - * to this function starting with \a index = 0. - * - * Time = O(1) - * - * \return NULL if \a index out of range. - */ -SLV2UI -slv2_uis_get_at(SLV2UIs list, - unsigned index); - - -/** @} */ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* __SLV2_PLUGIN_UIS_H__ */ - diff --git a/slv2/port.h b/slv2/port.h index be6e03b..498da54 100644 --- a/slv2/port.h +++ b/slv2/port.h @@ -26,7 +26,7 @@ extern "C" { #include "slv2/types.h" #include "slv2/plugin.h" #include "slv2/port.h" -#include "slv2/values.h" +#include "slv2/collections.h" /** \addtogroup slv2_data * @{ diff --git a/slv2/scalepoints.h b/slv2/scalepoints.h deleted file mode 100644 index fe1f121..0000000 --- a/slv2/scalepoints.h +++ /dev/null @@ -1,73 +0,0 @@ -/* SLV2 - * Copyright (C) 2007 Dave Robillard - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef __SLV2_SCALE_POINTS_H__ -#define __SLV2_SCALE_POINTS_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include "slv2/value.h" - -/** \defgroup slv2_collections Collections of scale_points/objects - * - * Ordered collections of typed scale_points which are fast for random - * access by index (i.e. a fancy array). - * - * @{ - */ - - -/** Allocate a new, empty SLV2ScalePoints - */ -SLV2ScalePoints -slv2_scale_points_new(); - - -/** Free an SLV2ScalePoints. - */ -void -slv2_scale_points_free(SLV2ScalePoints points); - - -/** Get the number of scale points in a collection. - */ -unsigned -slv2_scale_points_size(SLV2ScalePoints points); - - -/** Get the scale point at the given index in a collection. - * - * @return the element at \a index, or NULL if index is out of range. - * - * Time = O(1) - */ -SLV2ScalePoint -slv2_scale_points_get_at(SLV2ScalePoints points, unsigned index); - - -/** @} */ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* __SLV2_SCALE_POINTS_H__ */ - diff --git a/slv2/slv2.h b/slv2/slv2.h index a84165b..4381259 100644 --- a/slv2/slv2.h +++ b/slv2/slv2.h @@ -23,20 +23,17 @@ extern "C" { #endif +#include "slv2/collections.h" #include "slv2/plugin.h" #include "slv2/pluginclass.h" #include "slv2/plugininstance.h" -#include "slv2/plugins.h" #include "slv2/pluginui.h" #include "slv2/pluginuiinstance.h" -#include "slv2/pluginuis.h" #include "slv2/port.h" +#include "slv2/scalepoint.h" #include "slv2/types.h" #include "slv2/util.h" #include "slv2/value.h" -#include "slv2/values.h" -#include "slv2/scalepoint.h" -#include "slv2/scalepoints.h" #include "slv2/world.h" #ifdef __cplusplus diff --git a/slv2/types.h b/slv2/types.h index fa98940..d17568f 100644 --- a/slv2/types.h +++ b/slv2/types.h @@ -24,6 +24,7 @@ extern "C" { #endif #include +#include #define SLV2_NAMESPACE_LV2 "http://lv2plug.in/ns/lv2core#" #define SLV2_PORT_CLASS_PORT "http://lv2plug.in/ns/lv2core#Port" diff --git a/slv2/values.h b/slv2/values.h deleted file mode 100644 index b0ec3e3..0000000 --- a/slv2/values.h +++ /dev/null @@ -1,81 +0,0 @@ -/* SLV2 - * Copyright (C) 2007 Dave Robillard - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef __SLV2_VALUES_H__ -#define __SLV2_VALUES_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include "slv2/value.h" - -/** \defgroup slv2_collections Collections of values/objects - * - * Ordered collections of typed values which are fast for random - * access by index (i.e. a fancy array). - * - * @{ - */ - - -/** Allocate a new, empty SLV2Values - */ -SLV2Values -slv2_values_new(); - - -/** Free an SLV2Values. - */ -void -slv2_values_free(SLV2Values values); - - -/** Get the number of elements in a value collection. - */ -unsigned -slv2_values_size(SLV2Values values); - - -/** Get the value at a given index in the collection. - * - * @return the element at \a index, or NULL if index is out of range. - * - * Time = O(1) - */ -SLV2Value -slv2_values_get_at(SLV2Values values, unsigned index); - - -/** Return whether \a values contains \a value. - * - * Time = O(n) - */ -bool -slv2_values_contains(SLV2Values values, SLV2Value value); - - -/** @} */ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* __SLV2_VALUES_H__ */ - diff --git a/slv2/world.h b/slv2/world.h index 6028ca8..0e6106c 100644 --- a/slv2/world.h +++ b/slv2/world.h @@ -24,8 +24,7 @@ extern "C" { #endif #include -#include "slv2/plugins.h" -#include "slv2/pluginclasses.h" +#include "slv2/collections.h" /** \defgroup slv2_world Global library state * -- cgit v1.2.1