Panini 1.4.0
Header-only library for generating C++, written in C++17
panini::IncludeSet Class Reference

Collection of unique file system paths. More...

#include <IncludeSet.hpp>

Public Member Functions

 IncludeSet ()=default
 
 IncludeSet (std::initializer_list< IncludeEntry > entries)
 
 IncludeSet (std::initializer_list< std::filesystem::path > paths, IncludeStyle style)
 
const std::vector< IncludeEntry > & GetEntries () const
 
std::vector< IncludeEntry >::const_iterator begin () const
 
std::vector< IncludeEntry >::iterator begin ()
 
std::vector< IncludeEntry >::const_iterator end () const
 
std::vector< IncludeEntry >::iterator end ()
 
void Add (const std::filesystem::path &path, IncludeStyle style=IncludeStyle::Inherit)
 
void Sort (IncludeStyle resolvedStyle)
 

Detailed Description

Collection of unique file system paths.

Paths can be sorted by priority, which is based on their IncludeStyle and how many forward slashes (/) it contains. This causes paths that end in a filename to be sorted after paths with folders, even when the folder name is the same as the filename.

Note
Duplicate paths are not allowed in the collection, unless they differ in IncludeStyle.

Constructor & Destructor Documentation

◆ IncludeSet() [1/3]

panini::IncludeSet::IncludeSet ( )
inlinedefault

◆ IncludeSet() [2/3]

panini::IncludeSet::IncludeSet ( std::initializer_list< IncludeEntry entries)
inline

Construct an IncludeSet from a list of IncludeEntry.

◆ IncludeSet() [3/3]

panini::IncludeSet::IncludeSet ( std::initializer_list< std::filesystem::path >  paths,
IncludeStyle  style 
)
inline

Construct an IncludeSet from a list of paths and an IncludeStyle.

Member Function Documentation

◆ Add()

void panini::IncludeSet::Add ( const std::filesystem::path &  path,
IncludeStyle  style = IncludeStyle::Inherit 
)
inline

Add a path to the set with an include style.

Note
Duplicate paths will note be added, unless they differ in IncludeStyle.

◆ begin() [1/2]

std::vector< IncludeEntry >::iterator panini::IncludeSet::begin ( )
inline

STL-compatible method for getting an iterator to the start of the list of entries.

◆ begin() [2/2]

std::vector< IncludeEntry >::const_iterator panini::IncludeSet::begin ( ) const
inline

STL-compatible method for getting an iterator to the start of the list of entries.

◆ end() [1/2]

std::vector< IncludeEntry >::iterator panini::IncludeSet::end ( )
inline

STL-compatible method for getting an iterator to the end of the list of entries.

◆ end() [2/2]

std::vector< IncludeEntry >::const_iterator panini::IncludeSet::end ( ) const
inline

STL-compatible method for getting an iterator to the end of the list of entries.

◆ GetEntries()

const std::vector< IncludeEntry > & panini::IncludeSet::GetEntries ( ) const
inline

Get entries as an std::vector.

◆ Sort()

void panini::IncludeSet::Sort ( IncludeStyle  resolvedStyle)
inline

Sort the paths in the collection based on an include style.

Entries are first sorted by include style:

  1. IncludeStyle::AngularBrackets
  2. IncludeStyle::DoubleQuotes
  3. IncludeStyle::SingleQuotes

And then by their paths.

The resolved style parameter is used to prioritize entries that have an include style of IncludeStyle::Inherit.

Note
You cannot sort with a resolved style set to IncludeStyle::Inherit.

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