Coriolis Core (CRL) Documentation


Classes | Public Member Functions | Static Public Member Functions | List of all members
CRL::SearchPath Class Reference

An ordered list of search pathes. More...

Classes

class  Element
 An element of the search path (mapping a directory). More...
 

Public Member Functions

void reset ()
 
size_t append (const std::string &path, const std::string &name="")
 
size_t prepend (const std::string &path, const std::string &name="")
 
size_t replace (const std::string &path, const std::string &, size_t index)
 
size_t locate (const std::string &file, std::ios::openmode mode=std::ios::in, int first=0, int last=64)
 
size_t getSize () const
 
const std::string & getSelected () const
 
size_t getIndex () const
 
bool hasSelected () const
 
size_t hasPath (const std::string &path) const
 
const Elementoperator[] (size_t index) const
 

Static Public Member Functions

static std::string extractLibName (const std::string &)
 

Detailed Description

An ordered list of search pathes.

The SearchPath is an AllianceFramework owned object, and as such it's constructors & destructors are made inaccessible by the outside world.

Member Function Documentation

◆ extractLibName()

std::string CRL::SearchPath::extractLibName ( const std::string &  )
static
Returns
the library name guessed from a directory path. This is the last component of the, stripped of any extention.

Referenced by append().

◆ reset()

void CRL::SearchPath::reset ( )
inline

Clear all the search path. Only the first, corresponding to the working library is kept.

◆ append()

void CRL::SearchPath::append ( const std::string &  path,
const std::string &  name = "" 
)
inline

Append a search path. The name gives the library name.

References extractLibName().

◆ prepend()

void CRL::SearchPath::prepend ( const std::string &  path,
const std::string &  name = "" 
)

Prepend a search path. The name gives the library name.

◆ replace()

void CRL::SearchPath::replace ( const std::string &  path,
const std::string &  name,
size_t  index 
)

Replace the search path element at index index.

◆ locate()

size_t CRL::SearchPath::locate ( const std::string &  file,
std::ios::openmode  mode = std::ios::in,
int  first = 0,
int  last = 64 
)
Parameters
filethe requested file.
modethe wanted opening mode.
firstthe lower bound in the search path elements.
lastthe upper bound in the search path elements. Returns: the index of the search path element in which the file has been found.

Try to locate a file named file (without leading path, but with extention) and check if it can be opened in the desired mode. The file is not left opened, but the memory of the search is kept for further operations.

◆ getSize()

size_t CRL::SearchPath::getSize ( ) const
inline
Returns
the number of search path elements (directories).

◆ getSelected()

const std::string & CRL::SearchPath::getSelected ( ) const
inline
Returns
the search path element selected through the last locate request.

◆ getIndex()

size_t CRL::SearchPath::getIndex ( ) const
inline
Returns
the index of search path element selected through the last locate request.

◆ hasSelected()

bool CRL::SearchPath::hasSelected ( ) const
inline
Returns
true if an element is currently selected (a locate has been performed).

◆ hasPath()

bool CRL::SearchPath::hasPath ( const std::string &  path) const
Returns
true if the path is present in the search path (at any position).

◆ operator[]()

const Element & CRL::SearchPath::operator[] ( size_t  index) const
Returns
The search path element at position index. If index is out of bounds, an empty Element is returned.

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


Generated by doxygen 1.8.14 on Sun Nov 21 2021 Return to top of page
Coriolis Core (CRL) Copyright © 2008-2020 Sorbonne Universite, All rights reserved