LineGraph: z axis for lo and hi pass handles
[calf.git] / src / calf / lv2_urid.h
blobb4be712d5a0056127f244d62e05047fb950cb2b2
1 /*
2 Copyright 2008-2012 David Robillard <http://drobilla.net>
3 Copyright 2011 Gabriel M. Beddingfield <gabrbedd@gmail.com>
5 Permission to use, copy, modify, and/or distribute this software for any
6 purpose with or without fee is hereby granted, provided that the above
7 copyright notice and this permission notice appear in all copies.
9 THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 /**
19 @file urid.h
20 C header for the LV2 URID extension <http://lv2plug.in/ns/ext/urid>
23 #ifndef LV2_URID_H
24 #define LV2_URID_H
26 #define LV2_URID_URI "http://lv2plug.in/ns/ext/urid"
27 #define LV2_URID_PREFIX LV2_URID_URI "#"
29 #define LV2_URID__map LV2_URID_PREFIX "map"
30 #define LV2_URID__unmap LV2_URID_PREFIX "unmap"
32 /* Legacy defines */
33 #define LV2_URID_MAP_URI LV2_URID__map
34 #define LV2_URID_UNMAP_URI LV2_URID__unmap
36 #include <stdint.h>
38 /**
39 Opaque pointer to host data for LV2_URID_Map.
41 typedef void* LV2_URID_Map_Handle;
43 /**
44 Opaque pointer to host data for LV2_URID_Unmap.
46 typedef void* LV2_URID_Unmap_Handle;
48 /**
49 URI mapped to an integer.
51 typedef uint32_t LV2_URID;
53 /**
54 URID Map Feature (LV2_URID__map)
56 typedef struct _LV2_URID_Map {
57 /**
58 Opaque pointer to host data.
60 This MUST be passed to map_uri() whenever it is called.
61 Otherwise, it must not be interpreted in any way.
63 LV2_URID_Map_Handle handle;
65 /**
66 Get the numeric ID of a URI.
68 If the ID does not already exist, it will be created.
70 This function is referentially transparent; any number of calls with the
71 same arguments is guaranteed to return the same value over the life of a
72 plugin instance. Note, however, that several URIs MAY resolve to the
73 same ID if the host considers those URIs equivalent.
75 This function is not necessarily very fast or RT-safe: plugins SHOULD
76 cache any IDs they might need in performance critical situations.
78 The return value 0 is reserved and indicates that an ID for that URI
79 could not be created for whatever reason. However, hosts SHOULD NOT
80 return 0 from this function in non-exceptional circumstances (i.e. the
81 URI map SHOULD be dynamic).
83 @param handle Must be the callback_data member of this struct.
84 @param uri The URI to be mapped to an integer ID.
86 LV2_URID (*map)(LV2_URID_Map_Handle handle,
87 const char* uri);
88 } LV2_URID_Map;
90 /**
91 URI Unmap Feature (LV2_URID__unmap)
93 typedef struct _LV2_URID_Unmap {
94 /**
95 Opaque pointer to host data.
97 This MUST be passed to unmap() whenever it is called.
98 Otherwise, it must not be interpreted in any way.
100 LV2_URID_Unmap_Handle handle;
103 Get the URI for a previously mapped numeric ID.
105 Returns NULL if @p urid is not yet mapped. Otherwise, the corresponding
106 URI is returned in a canonical form. This MAY not be the exact same
107 string that was originally passed to LV2_URID_Map::map(), but it MUST be
108 an identical URI according to the URI syntax specification (RFC3986). A
109 non-NULL return for a given @p urid will always be the same for the life
110 of the plugin. Plugins that intend to perform string comparison on
111 unmapped URIs SHOULD first canonicalise URI strings with a call to
112 map_uri() followed by a call to unmap_uri().
114 @param handle Must be the callback_data member of this struct.
115 @param urid The ID to be mapped back to the URI string.
117 const char* (*unmap)(LV2_URID_Unmap_Handle handle,
118 LV2_URID urid);
119 } LV2_URID_Unmap;
121 #endif /* LV2_URID_H */