Vuo  2.0.0
Macros | Typedefs | Enumerations | Functions

Description

Uniform Resource Locator.

Typedefs

typedef VuoText VuoUrl
 Uniform Resource Locator. More...
 

Enumerations

enum  VuoUrlNormalizeFlags { VuoUrlNormalize_default = 0x0, VuoUrlNormalize_forSaving = 0x1, VuoUrlNormalize_assumeHttp = 0x2 }
 Bitwise flags modifying URL normalization behavior. More...
 

Functions

VuoUrl VuoUrl_makeFromJson (struct json_object *js)
 Decodes the JSON object js, expected to contain a UTF-8 string, to create a new value. More...
 
struct json_objectVuoUrl_getJson (const VuoUrl value)
 Encodes value as a JSON object. More...
 
char * VuoUrl_getSummary (const VuoUrl value)
 Creates a new UTF-8 C string from value, or, if it's more than 50 Unicode characters long, creates an aposiopesis. More...
 
bool VuoUrl_getParts (const VuoUrl url, VuoText *scheme, VuoText *user, VuoText *host, VuoInteger *port, VuoText *path, VuoText *query, VuoText *fragment) VuoWarnUnusedResult
 Attempts to parse url and outputs its parts. More...
 
bool VuoUrl_getFileParts (const VuoUrl url, VuoText *path, VuoText *folder, VuoText *filename, VuoText *extension) VuoWarnUnusedResult
 Attempts to parse url as a file: URL, and outputs its parts. More...
 
bool VuoUrl_areEqual (const VuoText a, const VuoText b)
 Returns true if a == b. More...
 
bool VuoUrl_isLessThan (const VuoText a, const VuoText b)
 Returns true if a < b. More...
 
bool VuoUrl_isRelativePath (const VuoUrl url)
 Returns a boolean indicating whether the provided url is a relative file path. More...
 
VuoUrl VuoUrl_normalize (const VuoText url, enum VuoUrlNormalizeFlags flags)
 Resolves url (which could be an absolute URL, an absolute Unix file path, a relative Unix file path, or a user-relative Unix file path) into an absolute URL. More...
 
VuoText VuoUrl_getPosixPath (const VuoUrl url)
 If url uses the file: scheme, returns the corresponding (URL-decoded) POSIX path. More...
 
VuoText VuoUrl_escapePosixPath (const VuoText posixPath)
 URL-escapes characters in path to make it a valid IRI path. More...
 
VuoText VuoUrl_escapeUTF8 (const VuoText url)
 URL-escapes UTF-8 bytes greater than 0x7F. More...
 
bool VuoUrl_isBundle (const VuoUrl url)
 Returns true if the url refers to an OS X bundle folder. More...
 
VuoUrl VuoUrl_appendFileExtension (const char *filename, struct json_object *validExtensions)
 Given a filename and set of valid extensions, returns a new VuoUrl guaranteed to have the extension. More...
 
VuoText VuoUrl_decodeRFC3986 (const VuoUrl url)
 Decodes a RFC 3986 section 2.1 URI-encoded string. More...
 
VuoUrl VuoUrl_makeFromString (const char *str)
 Automatically generated function. More...
 
char * VuoUrl_getString (const VuoUrl value)
 Automatically generated function. More...
 
void VuoUrl_retain (VuoUrl value)
 Automatically generated function. More...
 
void VuoUrl_release (VuoUrl value)
 Automatically generated function. More...
 

Typedef Documentation

◆ VuoUrl

typedef VuoText VuoUrl

Uniform Resource Locator.

Definition at line 29 of file VuoUrl.h.

Enumeration Type Documentation

◆ VuoUrlNormalizeFlags

Bitwise flags modifying URL normalization behavior.

Enumerator
VuoUrlNormalize_default 

Standard normalization (none of the below flags set).

VuoUrlNormalize_forSaving 

For exported apps: if set, relative file paths will be resolved to Desktop instead of the app resources folder.

VuoUrlNormalize_assumeHttp 

If the URL doesn't have an explicit scheme: if unset, the file scheme is added. If set, the http scheme is added.

Definition at line 51 of file VuoUrl.h.

Function Documentation

◆ VuoUrl_appendFileExtension()

VuoUrl VuoUrl_appendFileExtension ( const char *  filename,
struct json_object validExtensions 
)

Given a filename and set of valid extensions, returns a new VuoUrl guaranteed to have the extension.

Definition at line 774 of file VuoUrl.c.

◆ VuoUrl_areEqual()

bool VuoUrl_areEqual ( const VuoText  a,
const VuoText  b 
)

Returns true if a == b.

Definition at line 238 of file VuoUrl.c.

◆ VuoUrl_decodeRFC3986()

VuoText VuoUrl_decodeRFC3986 ( const VuoUrl  url)

Decodes a RFC 3986 section 2.1 URI-encoded string.

For example, Hello%20world becomes Hello world.

Definition at line 651 of file VuoUrl.c.

◆ VuoUrl_escapePosixPath()

VuoText VuoUrl_escapePosixPath ( const VuoText  posixPath)

URL-escapes characters in path to make it a valid IRI path.

Definition at line 310 of file VuoUrl.c.

◆ VuoUrl_escapeUTF8()

VuoText VuoUrl_escapeUTF8 ( const VuoText  url)

URL-escapes UTF-8 bytes greater than 0x7F.

Definition at line 372 of file VuoUrl.c.

◆ VuoUrl_getFileParts()

bool VuoUrl_getFileParts ( const VuoUrl  url,
VuoText path,
VuoText folder,
VuoText filename,
VuoText extension 
)

Attempts to parse url as a file: URL, and outputs its parts.

Returns true if parsing succeeded (which implies all output parameters have been populated, though possibly with NULL or zero-length strings).

See also
VuoFileUtilities::splitPath

Definition at line 191 of file VuoUrl.c.

◆ VuoUrl_getJson()

struct json_object* VuoUrl_getJson ( const VuoUrl  value)

Encodes value as a JSON object.

Definition at line 61 of file VuoUrl.c.

◆ VuoUrl_getParts()

bool VuoUrl_getParts ( const VuoUrl  url,
VuoText scheme,
VuoText user,
VuoText host,
VuoInteger port,
VuoText path,
VuoText query,
VuoText fragment 
)

Attempts to parse url and outputs its parts.

Returns true if parsing succeeded (which implies all output parameters have been populated, though possibly with NULL or zero-length strings).

Definition at line 86 of file VuoUrl.c.

◆ VuoUrl_getPosixPath()

VuoText VuoUrl_getPosixPath ( const VuoUrl  url)

If url uses the file: scheme, returns the corresponding (URL-decoded) POSIX path.

If url does not use the file: scheme, returns NULL.

Definition at line 682 of file VuoUrl.c.

◆ VuoUrl_getString()

char* VuoUrl_getString ( const VuoUrl  value)

Automatically generated function.

◆ VuoUrl_getSummary()

char* VuoUrl_getSummary ( const VuoUrl  value)

Creates a new UTF-8 C string from value, or, if it's more than 50 Unicode characters long, creates an aposiopesis.

Definition at line 72 of file VuoUrl.c.

◆ VuoUrl_isBundle()

bool VuoUrl_isBundle ( const VuoUrl  url)

Returns true if the url refers to an OS X bundle folder.

This function mirrors the behavior of Finder — .app bundles return true (in Finder, double-clicking launches the app); .framework bundles return false (in Finder, double-clicking opens the folder).

Returns false if the URL is non-local or is local but doesn't exist.

Definition at line 736 of file VuoUrl.c.

◆ VuoUrl_isLessThan()

bool VuoUrl_isLessThan ( const VuoText  a,
const VuoText  b 
)

Returns true if a < b.

Definition at line 246 of file VuoUrl.c.

◆ VuoUrl_isRelativePath()

bool VuoUrl_isRelativePath ( const VuoUrl  url)

Returns a boolean indicating whether the provided url is a relative file path.

Definition at line 287 of file VuoUrl.c.

◆ VuoUrl_makeFromJson()

VuoUrl VuoUrl_makeFromJson ( struct json_object js)

Decodes the JSON object js, expected to contain a UTF-8 string, to create a new value.

Definition at line 42 of file VuoUrl.c.

◆ VuoUrl_makeFromString()

VuoUrl VuoUrl_makeFromString ( const char *  str)

Automatically generated function.

◆ VuoUrl_normalize()

VuoUrl VuoUrl_normalize ( const VuoText  url,
enum VuoUrlNormalizeFlags  flags 
)

Resolves url (which could be an absolute URL, an absolute Unix file path, a relative Unix file path, or a user-relative Unix file path) into an absolute URL.

If url contains a URL schema, this function assumes that all necessary characters are already URL-encoded. Otherwise, this function assumes that no characters in url are URL-encoded, and encodes the characters necessary to make it a valid URL.

If url is a Unix file path, and if all components of that path exist, this function attempts to resolve it into a canonical path by removing ".", "..", and extra slashes, and dereferencing symlinks.

If url is NULL, returns NULL.

If url is emptystring, returns a file URL for the current working path (or Desktop if VuoUrlNormalize_forSaving is set).

Additionally, this function maps Internationalized Resource Identifiers (IRIs) to URLs; that is, it percent-escapes UTF-8 bytes greater than 0x7F (RFC 3987). (However, currently, no Unicode normalization is performed.)

Definition at line 430 of file VuoUrl.c.

◆ VuoUrl_release()

void VuoUrl_release ( VuoUrl  value)

Automatically generated function.

◆ VuoUrl_retain()

void VuoUrl_retain ( VuoUrl  value)

Automatically generated function.