HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PDG_PathMap Class Reference

#include <PDG_PathMap.h>

Classes

struct  Entry
 

Public Types

enum  MatchType { eMatchContains, eMatchPrefix, eMatchSuffix }
 Enumeration of path map matching types. More...
 
using EntryArray = UT_Array< Entry >
 Array of path mapping entries. More...
 

Public Member Functions

 PDG_PathMap (int version)
 
bool reload (bool merge, UT_WorkBuffer &errors)
 Reloads the path map instance from the environment. More...
 
const UT_StringHoldertoString () const
 Returns a string representation of this path map. More...
 
bool save (UT_WorkBuffer &buffer) const
 Saves the path map to the specified work buffer, in JSON format. More...
 
bool load (const UT_StringHolder &path_map, bool update_vars, bool merge, UT_WorkBuffer &errors)
 Loads a path map from the input JSON string. More...
 
UT_StringHolder mapPath (const UT_StringHolder &path, const UT_StringHolder &zone) const
 
UT_StringHolder mapPath (const UT_StringHolder &path) const
 
const UT_StringHolderzone () const
 Returns the current zone for this path mapping instance. More...
 
void setZone (const UT_StringHolder &zone)
 Sets the zone for this path mapping instance. More...
 
const EntryArraymappings () const
 
void filteredMappings (EntryArray &entries, const UT_StringHolder &zone, const UT_StringHolder &scheduler) const
 Returns the mapping entries for a specific zone and/or scheduler. More...
 
void addPathMapping (const UT_StringHolder &zone, const UT_StringHolder &map_from, const UT_StringHolder &map_to, const UT_StringHolder &scheduler, MatchType match_type)
 Adds an entry to the path map. More...
 
void clearSchedulerMappings (const UT_StringHolder &scheduler)
 Clears path mapping entries for the specified scheduler path. More...
 
void clearAllMappings ()
 Clears all path mapping entries. More...
 
void commitPathMapping ()
 

Static Public Member Functions

static PDG_PathMapglobalMap ()
 Returns the shared global path mapping instance. More...
 

Static Public Attributes

static const UT_StringHolder theWinZone
 Default zone for Windows systems – WIN. More...
 
static const UT_StringHolder theMacZone
 Default zone for Mac systems – MAC. More...
 
static const UT_StringHolder theLinuxZone
 Default zone for Linux systems – LINUX. More...
 
static const UT_StringHolder theAllZone
 Special zone that matches with all platforms – *. More...
 
static const int theVersion
 Current PDG Path Map data version. More...
 
static const UT_StringHolder theAllSchedulerName
 Sepecial scheduler name that matches all schedulers. More...
 

Detailed Description

Definition at line 26 of file PDG_PathMap.h.

Member Typedef Documentation

Array of path mapping entries.

Definition at line 64 of file PDG_PathMap.h.

Member Enumeration Documentation

Enumeration of path map matching types.

Enumerator
eMatchContains 

The mapping can be matched anywhere in the input string. For example, "/path/" is a valid match in "H:/path/", "/mnt/path/" and "/path/subpath/".

eMatchPrefix 

The mapping is only valid as a prefix of the input string. For example, "/path/" is not a valid match for "H:/path/ nor "/mnt/path/", but is a valid match for "/path/subpath/".

eMatchSuffix 

The mapping is only valid as a suffix of the input string. For example, "/path/" is a valid match for "H:/path/ or "/mnt/path/", but is not a valid match for "/path/subpath/".

Definition at line 30 of file PDG_PathMap.h.

Constructor & Destructor Documentation

PDG_PathMap::PDG_PathMap ( int  version)

Member Function Documentation

void PDG_PathMap::addPathMapping ( const UT_StringHolder zone,
const UT_StringHolder map_from,
const UT_StringHolder map_to,
const UT_StringHolder scheduler,
MatchType  match_type 
)

Adds an entry to the path map.

void PDG_PathMap::clearAllMappings ( )

Clears all path mapping entries.

void PDG_PathMap::clearSchedulerMappings ( const UT_StringHolder scheduler)

Clears path mapping entries for the specified scheduler path.

void PDG_PathMap::commitPathMapping ( )

Updates the internal string representation and env var for the path mapping.

void PDG_PathMap::filteredMappings ( EntryArray entries,
const UT_StringHolder zone,
const UT_StringHolder scheduler 
) const

Returns the mapping entries for a specific zone and/or scheduler.

static PDG_PathMap& PDG_PathMap::globalMap ( )
static

Returns the shared global path mapping instance.

bool PDG_PathMap::load ( const UT_StringHolder path_map,
bool  update_vars,
bool  merge,
UT_WorkBuffer errors 
)

Loads a path map from the input JSON string.

UT_StringHolder PDG_PathMap::mapPath ( const UT_StringHolder path,
const UT_StringHolder zone 
) const

Applies the path mapping to the input path, using the desired mapping zone.

UT_StringHolder PDG_PathMap::mapPath ( const UT_StringHolder path) const
inline

Applies the path mapping using the mapping zone from the current platform.

Definition at line 109 of file PDG_PathMap.h.

const EntryArray& PDG_PathMap::mappings ( ) const
inline

Returns the array of path mapping entries currently stored in this path map.

Definition at line 126 of file PDG_PathMap.h.

bool PDG_PathMap::reload ( bool  merge,
UT_WorkBuffer errors 
)

Reloads the path map instance from the environment.

bool PDG_PathMap::save ( UT_WorkBuffer buffer) const

Saves the path map to the specified work buffer, in JSON format.

void PDG_PathMap::setZone ( const UT_StringHolder zone)
inline

Sets the zone for this path mapping instance.

Definition at line 118 of file PDG_PathMap.h.

const UT_StringHolder& PDG_PathMap::toString ( ) const

Returns a string representation of this path map.

const UT_StringHolder& PDG_PathMap::zone ( ) const
inline

Returns the current zone for this path mapping instance.

Definition at line 114 of file PDG_PathMap.h.

Member Data Documentation

const UT_StringHolder PDG_PathMap::theAllSchedulerName
static

Sepecial scheduler name that matches all schedulers.

Definition at line 82 of file PDG_PathMap.h.

const UT_StringHolder PDG_PathMap::theAllZone
static

Special zone that matches with all platforms – *.

Definition at line 76 of file PDG_PathMap.h.

const UT_StringHolder PDG_PathMap::theLinuxZone
static

Default zone for Linux systems – LINUX.

Definition at line 73 of file PDG_PathMap.h.

const UT_StringHolder PDG_PathMap::theMacZone
static

Default zone for Mac systems – MAC.

Definition at line 70 of file PDG_PathMap.h.

const int PDG_PathMap::theVersion
static

Current PDG Path Map data version.

Definition at line 79 of file PDG_PathMap.h.

const UT_StringHolder PDG_PathMap::theWinZone
static

Default zone for Windows systems – WIN.

Definition at line 67 of file PDG_PathMap.h.


The documentation for this class was generated from the following file: