1 /* 2 Copyright 2008-2016 David Robillard <http://drobilla.net> 3 Copyright 2011 Gabriel M. Beddingfield <gabrbedd@gmail.com> 4 Copyright 2018 Ethan Reker <http://cutthroughrecordings.com> 5 6 Permission to use, copy, modify, and/or distribute this software for any 7 purpose with or without fee is hereby granted, provided that the above 8 copyright notice and this permission notice appear in all copies. 9 10 THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 */ 18 module dplug.lv2.urid; 19 20 version(LV2): 21 22 /** 23 @defgroup urid URID 24 25 Features for mapping URIs to and from integers, see 26 <http://lv2plug.in/ns/ext/urid> for details. 27 28 @{ 29 */ 30 31 enum LV2_URID_URI = "http://lv2plug.in/ns/ext/urid"; ///< http://lv2plug.in/ns/ext/urid 32 enum LV2_URID_PREFIX = LV2_URID_URI ~ "#"; ///< http://lv2plug.in/ns/ext/urid# 33 34 enum LV2_URID__map = LV2_URID_PREFIX ~ "map"; ///< http://lv2plug.in/ns/ext/urid#map 35 enum LV2_URID__unmap = LV2_URID_PREFIX ~ "unmap"; ///< http://lv2plug.in/ns/ext/urid#unmap 36 37 enum LV2_URID_MAP_URI = LV2_URID__map; ///< Legacy 38 enum LV2_URID_UNMAP_URI = LV2_URID__unmap; ///< Legacy 39 40 import core.stdc.stdint; 41 42 43 /** 44 Opaque pointer to host data for LV2_URID_Map. 45 */ 46 alias LV2_URID_Map_Handle = void*; 47 48 /** 49 Opaque pointer to host data for LV2_URID_Unmap. 50 */ 51 alias LV2_URID_Unmap_Handle = void*; 52 53 /** 54 URI mapped to an integer. 55 */ 56 alias LV2_URID = uint32_t; 57 58 /** 59 URID Map Feature (LV2_URID__map) 60 */ 61 struct LV2_URID_Map 62 { 63 nothrow: 64 @nogc: 65 extern(C): 66 /** 67 Opaque pointer to host data. 68 69 This MUST be passed to map_uri() whenever it is called. 70 Otherwise, it must not be interpreted in any way. 71 */ 72 LV2_URID_Map_Handle handle; 73 74 /** 75 Get the numeric ID of a URI. 76 77 If the ID does not already exist, it will be created. 78 79 This function is referentially transparent; any number of calls with the 80 same arguments is guaranteed to return the same value over the life of a 81 plugin instance. Note, however, that several URIs MAY resolve to the 82 same ID if the host considers those URIs equivalent. 83 84 This function is not necessarily very fast or RT-safe: plugins SHOULD 85 cache any IDs they might need in performance critical situations. 86 87 The return value 0 is reserved and indicates that an ID for that URI 88 could not be created for whatever reason. However, hosts SHOULD NOT 89 return 0 from this function in non-exceptional circumstances (i.e. the 90 URI map SHOULD be dynamic). 91 92 @param handle Must be the callback_data member of this struct. 93 @param uri The URI to be mapped to an integer ID. 94 */ 95 LV2_URID function(LV2_URID_Map_Handle handle, const(char)* uri) map; 96 }