FileSystemPathBuilder Struct Reference

Helps to build a path via format strings: All format strings are of the form '{[^{}]+}' If the resulting path should contain the characters '{' or '}', they have to be replaced with '{LEFT CURLY}' and '{RIGHT CURLY}'. More...

#include <ArmarXCore/core/util/FileSystemPathBuilder.h>

Classes

struct  FormatStringOption
 Replacer for a pattern. More...
 
struct  RegisterFormatStringOption
 

Public Member Functions

void createParentDirectories () const
 
 FileSystemPathBuilder (std::string rawPath)
 FileSystemPathBuilder.
 
const std::filesystem::path & getBoostPath () const
 
const std::string & getPath () const
 
const std::string & getRawPath () const
 

Static Public Member Functions

static std::string ApplyFormatting (const std::string &rawPath)
 
static std::string ApplyFormattingAndResolveEnvAndCMakeVars (const std::string &rawPath)
 
static std::map< std::string, FormatStringOption > GetFormatStringOptions ()
 

Public Attributes

const std::filesystem::path bpath
 
const std::string path
 
const std::string rawPath
 

Static Public Attributes

static const boost::regex RawPathRegex {"([^{}]+|\\{[^{}]+\\})+"}
 

Detailed Description

Helps to build a path via format strings: All format strings are of the form '{[^{}]+}' If the resulting path should contain the characters '{' or '}', they have to be replaced with '{LEFT CURLY}' and '{RIGHT CURLY}'.

Default patterns are:

  • {LEFT CURLY} -> {
  • {RIGHT CURLY} -> }
  • {year / Year} -> year (2/4 digits)
  • {month}
  • {day}
  • {hour}
  • {minute}
  • {second}
  • {Date} -> YYYY-MM-DD
  • {Time} -> HH-MM-SS
  • {DateTime} -> {Date}_{Time}
  • {time-since-epoch} -> nanoseconds since epoch (can be used as uuid)
  • {PackageDir:...} -> Directory of the given package
  • {ScenarioDir:...} -> Scenario Directory of the given package
  • {DataDir:...} -> Data Directory of the given package
  • {BinaryeDir:...} -> Binary Directory of the given package
  • {CMakeDir:...} -> CMake Directory of the given package
  • {BuildDir:...} -> Build Directory of the given package

Constructor & Destructor Documentation

◆ FileSystemPathBuilder()

FileSystemPathBuilder ( std::string rawPath)
inline

FileSystemPathBuilder.

Parameters
rawPathmust match RawPathRegex ("([^{}]+|{[^{}]+})+")

Member Function Documentation

◆ ApplyFormatting()

std::string ApplyFormatting ( const std::string & rawPath)
static

◆ ApplyFormattingAndResolveEnvAndCMakeVars()

std::string ApplyFormattingAndResolveEnvAndCMakeVars ( const std::string & rawPath)
static

◆ createParentDirectories()

void createParentDirectories ( ) const
inline

◆ getBoostPath()

const std::filesystem::path & getBoostPath ( ) const
inline

◆ GetFormatStringOptions()

std::map< std::string, FileSystemPathBuilder::FormatStringOption > GetFormatStringOptions ( )
static

◆ getPath()

const std::string & getPath ( ) const
inline

◆ getRawPath()

const std::string & getRawPath ( ) const
inline

Member Data Documentation

◆ bpath

const std::filesystem::path bpath

◆ path

const std::string path

◆ rawPath

const std::string rawPath

◆ RawPathRegex

const boost::regex RawPathRegex {"([^{}]+|\\{[^{}]+\\})+"}
static

The documentation for this struct was generated from the following files: