Nebula
Loading...
Searching...
No Matches
IO::URN Class Reference

#include <urn.h>

Detailed Description

A URN (Uniform Resource Name) is a URI (Uniform Resource Identifier) that uses the "urn" scheme.

URNs are intended to serve as persistent, location-independent resource identifiers and are defined in RFC 8141. A URN is typically used to identify a resource by name rather than by location, and is often used in contexts where the resource may not be directly accessible, such as in metadata or as a unique identifier for an asset.

Public Member Functions

 URN ()
 default constructor
 URN (const Util::String &s)
 init constructor
 URN (const char *s)
 init constructor
 URN (const char *nid, const Util::String &nss)
 Construct from components.
 URN (const char *nid, const char *nss)
 Construct from components.
 URN (const URN &rhs)
 copy constructor
void operator= (const URN &rhs)
 assignmnent operator
bool operator== (const URN &rhs) const
 equality operator
bool operator!= (const URN &rhs) const
 inequality operator
void Set (const Util::String &s)
 set complete URI string
const Util::StringAsString () const
 return as concatenated string
bool IsEmpty () const
 return true if the URN is empty
bool IsValid () const
 return true if the URN is not empty
void Clear ()
 clear the URN
void SetNamespace (const Util::String &s)
 set Namespace component
const Util::StringGetNamespace () const
 get Namespace component
void SetSpecific (const Util::String &s)
 set Specific component
const Util::StringGetSpecific () const
 get Specific component (can be empty)
void SetQuery (const Util::String &s)
 set query component
const Util::StringGetQuery () const
 get query component (can be empty)
void SetFragment (const Util::String &s)
 set fragment component
const Util::StringGetFragment () const
 get fragment component (can be empty)
const IO::URI ExportURI () const
 Convert to an export URI using file extension, mappings are setup with AddExportMapping.
const IO::URI WorkURI (const Util::StringAtom &root)
 Convert to a work URI using project folder and extension, mappings are setup with AddWorkMapping.

Static Public Member Functions

static void AddExportMapping (const Util::StringAtom &ns, const Util::StringAtom &extension)
 Add an export binding using namespace -> file extension to use with ExportURI.
static void AddWorkMapping (const Util::StringAtom &ns, const Util::StringAtom &extension)
 Add a work binding using namespace -> file extension to use with WorkURI.
static void SetWorkRoot (const Util::StringAtom &root)
 Set the work folder.

Private Member Functions

bool Split (const Util::String &s)
 split string into components
Util::String Build () const
 build string from components

Private Attributes

bool isEmpty
Util::String nid
Util::String nss
Util::String query
Util::String fragment
Util::String string

Static Private Attributes

static Util::Dictionary< Util::StringAtom, Util::StringAtomExportExtensions
static Util::Dictionary< Util::StringAtom, Util::StringAtomWorkExtensions
static Util::StringAtom WorkRoot

Constructor & Destructor Documentation

◆ URN() [1/6]

IO::URN::URN ( )
inline

default constructor

◆ URN() [2/6]

IO::URN::URN ( const Util::String & s)
inlineexplicit

init constructor

◆ URN() [3/6]

IO::URN::URN ( const char * s)
inlineexplicit

init constructor

◆ URN() [4/6]

IO::URN::URN ( const char * nid,
const Util::String & nss )
inlineexplicit

Construct from components.

◆ URN() [5/6]

IO::URN::URN ( const char * nid,
const char * nss )
inlineexplicit

Construct from components.

◆ URN() [6/6]

IO::URN::URN ( const URN & rhs)
inline

copy constructor

Member Function Documentation

◆ AddExportMapping()

void IO::URN::AddExportMapping ( const Util::StringAtom & ns,
const Util::StringAtom & extension )
inlinestatic

Add an export binding using namespace -> file extension to use with ExportURI.

◆ AddWorkMapping()

void IO::URN::AddWorkMapping ( const Util::StringAtom & ns,
const Util::StringAtom & extension )
inlinestatic

Add a work binding using namespace -> file extension to use with WorkURI.

◆ AsString()

const Util::String & IO::URN::AsString ( ) const
inline

return as concatenated string

◆ Build()

String IO::URN::Build ( ) const
private

build string from components

This builds an URI string from its components.

◆ Clear()

void IO::URN::Clear ( )
inline

clear the URN

◆ ExportURI()

const IO::URI IO::URN::ExportURI ( ) const
inline

Convert to an export URI using file extension, mappings are setup with AddExportMapping.

◆ GetFragment()

const Util::String & IO::URN::GetFragment ( ) const
inline

get fragment component (can be empty)

◆ GetNamespace()

const Util::String & IO::URN::GetNamespace ( ) const
inline

get Namespace component

◆ GetQuery()

const Util::String & IO::URN::GetQuery ( ) const
inline

get query component (can be empty)

◆ GetSpecific()

const Util::String & IO::URN::GetSpecific ( ) const
inline

get Specific component (can be empty)

◆ IsEmpty()

bool IO::URN::IsEmpty ( ) const
inline

return true if the URN is empty

◆ IsValid()

bool IO::URN::IsValid ( ) const
inline

return true if the URN is not empty

◆ operator!=()

bool IO::URN::operator!= ( const URN & rhs) const
inline

inequality operator

◆ operator=()

void IO::URN::operator= ( const URN & rhs)
inline

assignmnent operator

◆ operator==()

bool IO::URN::operator== ( const URN & rhs) const
inline

equality operator

◆ Set()

void IO::URN::Set ( const Util::String & s)
inline

set complete URI string

◆ SetFragment()

void IO::URN::SetFragment ( const Util::String & s)
inline

set fragment component

◆ SetNamespace()

void IO::URN::SetNamespace ( const Util::String & s)
inline

set Namespace component

◆ SetQuery()

void IO::URN::SetQuery ( const Util::String & s)
inline

set query component

◆ SetSpecific()

void IO::URN::SetSpecific ( const Util::String & s)
inline

set Specific component

◆ SetWorkRoot()

void IO::URN::SetWorkRoot ( const Util::StringAtom & root)
inlinestatic

Set the work folder.

◆ Split()

bool IO::URN::Split ( const Util::String & s)
private

split string into components

Resolve assigns and split URN string into its components.

◆ WorkURI()

const IO::URI IO::URN::WorkURI ( const Util::StringAtom & root)
inline

Convert to a work URI using project folder and extension, mappings are setup with AddWorkMapping.

Member Data Documentation

◆ ExportExtensions

Util::Dictionary< Util::StringAtom, Util::StringAtom > IO::URN::ExportExtensions
staticprivate

◆ fragment

Util::String IO::URN::fragment
private

◆ isEmpty

bool IO::URN::isEmpty
private

◆ nid

Util::String IO::URN::nid
private

◆ nss

Util::String IO::URN::nss
private

◆ query

Util::String IO::URN::query
private

◆ string

Util::String IO::URN::string
private

◆ WorkExtensions

Util::Dictionary< Util::StringAtom, Util::StringAtom > IO::URN::WorkExtensions
staticprivate

◆ WorkRoot

Util::StringAtom IO::URN::WorkRoot
staticprivate

The documentation for this class was generated from the following files:
  • /github/workspace/code/foundation/io/urn.h
  • /github/workspace/code/foundation/io/urn.cc