Nebula
Loading...
Searching...
No Matches
assignregistry.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
13#include "core/refcounted.h"
14#include "io/assign.h"
15#include "io/uri.h"
16#include "util/hashtable.h"
18#include "core/singleton.h"
19
20//------------------------------------------------------------------------------
21namespace IO
22{
24{
27public:
31 virtual ~AssignRegistry();
32
34 void Setup();
36 void Discard();
38 bool IsValid() const;
39
41 void SetAssign(const Assign& assign);
43 bool HasAssign(const Util::String& assignName) const;
45 Util::String GetAssign(const Util::String& assignName) const;
47 void ClearAssign(const Util::String& assignName);
51 URI ResolveAssigns(const URI& uri) const;
53 Util::String ResolveAssignsInString(const Util::String& uriString) const;
54
55private:
57 void SetupSystemAssigns();
60
61 bool isValid;
64};
65
66} // namespace IO
67//------------------------------------------------------------------------------
The common base class of Nebula.
Definition refcounted.h:38
An assign associates an intuitive name with a real-world filesystem path.
Definition assign.h:19
Central registry for path assigns.
Definition assignregistry.h:24
bool HasAssign(const Util::String &assignName) const
return true if an assign exists
Definition assignregistry.cc:213
void SetAssign(const Assign &assign)
set a new assign
Definition assignregistry.cc:195
virtual ~AssignRegistry()
destructor
Definition assignregistry.cc:31
Util::HashTable< Util::String, Util::String > assignTable
Definition assignregistry.h:63
Util::String GetAssign(const Util::String &assignName) const
get an assign
Definition assignregistry.cc:226
void SetupProjectAssigns()
setup standard project assigns (e.g. msh:, model:, etc...)
Definition assignregistry.cc:132
AssignRegistry()
constructor
Definition assignregistry.cc:22
Threading::CriticalSection critSect
Definition assignregistry.h:62
__DeclareInterfaceSingleton(AssignRegistry)
void Discard()
discard the assign registry
Definition assignregistry.cc:60
bool IsValid() const
return true if the object has been setup
Definition assignregistry.cc:75
void Setup()
setup the assign registry (may only be called once from the main thread)
Definition assignregistry.cc:44
Util::Array< Assign > GetAllAssigns() const
return an array of all currently defined assigns
Definition assignregistry.cc:257
__DeclareClass(AssignRegistry)
URI ResolveAssigns(const URI &uri) const
resolve any assigns in an URI
Definition assignregistry.cc:280
void SetupSystemAssigns()
setup standard system assigns (e.g. home:, etc...)
Definition assignregistry.cc:84
bool isValid
Definition assignregistry.h:61
void ClearAssign(const Util::String &assignName)
clear an assign
Definition assignregistry.cc:242
Util::String ResolveAssignsInString(const Util::String &uriString) const
resolve any assigns in a string (must have URI form)
Definition assignregistry.cc:295
An URI object can split a Uniform Resource Identifier string into its components or build a string fr...
Definition uri.h:67
Critical section objects are used to protect a portion of code from parallel execution.
Nebula's dynamic array class.
Definition array.h:60
Organizes key/value pairs by a hash code.
Definition hashtable.h:42
Instances of wrapped stream classes.
Definition orientation.cc:10
Nebula's universal string class.
Definition string.h:50