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. More...
 
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, FormatStringOptionGetFormatStringOptions ()
 

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

Definition at line 63 of file FileSystemPathBuilder.h.

Constructor & Destructor Documentation

◆ FileSystemPathBuilder()

FileSystemPathBuilder ( std::string  rawPath)
inline

FileSystemPathBuilder.

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

Definition at line 93 of file FileSystemPathBuilder.h.

Member Function Documentation

◆ ApplyFormatting()

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

Definition at line 51 of file FileSystemPathBuilder.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ApplyFormattingAndResolveEnvAndCMakeVars()

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

Definition at line 94 of file FileSystemPathBuilder.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createParentDirectories()

void createParentDirectories ( ) const
inline

Definition at line 107 of file FileSystemPathBuilder.h.

+ Here is the caller graph for this function:

◆ getBoostPath()

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

Definition at line 95 of file FileSystemPathBuilder.h.

◆ GetFormatStringOptions()

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

Definition at line 41 of file FileSystemPathBuilder.cpp.

+ Here is the call graph for this function:

◆ getPath()

const std::string& getPath ( ) const
inline

Definition at line 103 of file FileSystemPathBuilder.h.

◆ getRawPath()

const std::string& getRawPath ( ) const
inline

Definition at line 99 of file FileSystemPathBuilder.h.

Member Data Documentation

◆ bpath

const std::filesystem::path bpath

Definition at line 131 of file FileSystemPathBuilder.h.

◆ path

const std::string path

Definition at line 130 of file FileSystemPathBuilder.h.

◆ rawPath

const std::string rawPath

Definition at line 129 of file FileSystemPathBuilder.h.

◆ RawPathRegex

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

Definition at line 65 of file FileSystemPathBuilder.h.


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