hecl
High-Level Extensible Combiner Language and Resource Database
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
HECL::ProjectPath Class Reference

Canonicalized project path representation using POSIX conventions. More...

#include <HECL.hpp>

Inheritance diagram for HECL::ProjectPath:
Inheritance graph
Collaboration diagram for HECL::ProjectPath:
Collaboration graph

Public Types

enum  PathType { PT_NONE, PT_FILE, PT_DIRECTORY, PT_GLOB }
 Type of path. More...
 

Public Member Functions

 ProjectPath (const ProjectRootPath &rootPath, const SystemString &path)
 Construct a project subpath representation. More...
 
bool isRoot () const
 Determine if ProjectPath represents project root directory. More...
 
const SystemString & getAbsolutePath () const
 Access fully-canonicalized absolute path. More...
 
const SystemString & getRelativePath () const
 Access fully-canonicalized project-relative path. More...
 
const std::string & getAbsolutePathUTF8 () const
 Access fully-canonicalized absolute path in UTF-8. More...
 
const std::string & getRelativePathUTF8 () const
 
PathType getPathType () const
 Get type of path based on syntax and filesystem queries. More...
 
Time getModtime () const
 Get time of last modification with special behaviors for directories and glob-paths. More...
 
void getGlobResults (std::vector< SystemString > &outPaths) const
 Insert glob matches into existing vector. More...
 
size_t hash () const
 C++11 compatible runtime hash (NOT USED IN PACKAGES!!) More...
 
bool operator== (const ProjectPath &other) const
 
bool operator!= (const ProjectPath &other) const
 

Protected Member Functions

bool _canonAbsPath (const SystemString &path)
 

Protected Attributes

SystemString m_absPath
 
SystemString m_relPath
 
size_t m_hash = 0
 

Detailed Description

Canonicalized project path representation using POSIX conventions.

HECL uses POSIX-style paths (with '/' separator) and directory tokens ('.','..') to resolve files within a project. The database internally uses this representation to track working files.

This class provides a convenient way to resolve paths relative to the project root. Part of this representation involves resolving symbolic links to regular file/directory paths and determining its type.

NOTE THAT PROJECT PATHS ARE TREATED AS CASE SENSITIVE!!

Member Enumeration Documentation

Type of path.

Enumerator
PT_NONE 

If path doesn't reference a valid filesystem entity, this is returned

PT_FILE 

Singular file path (confirmed with filesystem)

PT_DIRECTORY 

Singular directory path (confirmed with filesystem)

PT_GLOB 

Glob-path (whenever one or more '*' occurs in syntax)

Constructor & Destructor Documentation

HECL::ProjectPath::ProjectPath ( const ProjectRootPath rootPath,
const SystemString &  path 
)

Construct a project subpath representation.

Parameters
rootPathpreviously constructed ProjectRootPath held by HECLDatabase::IProject
pathvalid filesystem-path (relative or absolute) to subpath

Member Function Documentation

const SystemString& HECL::ProjectPath::getAbsolutePath ( ) const
inline

Access fully-canonicalized absolute path.

Returns
Absolute path reference
const std::string& HECL::ProjectPath::getAbsolutePathUTF8 ( ) const
inline

Access fully-canonicalized absolute path in UTF-8.

Returns
Absolute path reference
void HECL::ProjectPath::getGlobResults ( std::vector< SystemString > &  outPaths) const

Insert glob matches into existing vector.

Parameters
outPathsVector to add matches to (will not erase existing contents)
Time HECL::ProjectPath::getModtime ( ) const

Get time of last modification with special behaviors for directories and glob-paths.

Returns
Time object representing entity's time of last modification

Regular files simply return their modtime as queried from the OS Directories return the latest modtime of all first-level regular files Glob-paths return the latest modtime of all matched regular files

PathType HECL::ProjectPath::getPathType ( ) const

Get type of path based on syntax and filesystem queries.

Returns
Type of path
const SystemString& HECL::ProjectPath::getRelativePath ( ) const
inline

Access fully-canonicalized project-relative path.

Returns
Relative pointer to within absolute-path or "." for project root-directory (use isRoot to detect)
size_t HECL::ProjectPath::hash ( ) const
inline

C++11 compatible runtime hash (NOT USED IN PACKAGES!!)

Returns
System-specific hash value
bool HECL::ProjectPath::isRoot ( ) const
inline

Determine if ProjectPath represents project root directory.

Returns
true if project root directory

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