API
4.0
For C++ developers
|
A class for handling Paths for Components, deriving from Path. More...
Public Member Functions | |
ComponentPath () | |
The default-constructed path is empty (an empty string). More... | |
ComponentPath (const std::string &path) | |
Construct a ComponentPath from a string. More... | |
ComponentPath (const std::vector< std::string > &pathVec, bool isAbsolute) | |
Constructor a ComponentPath from a vector that contains all subtree node names and a bool that indicates if the path is an absolute path. More... | |
bool | operator== (const ComponentPath &other) const |
bool | operator!= (const ComponentPath &other) const |
const char | getSeparator () const override |
Pure virtual function that returns a char for the designated separator. More... | |
const std::string | getInvalidChars () const override |
Pure virtual function that returns a string of invalid characters. More... | |
ComponentPath | formAbsolutePath (const ComponentPath &otherPath) const |
Get an absolute path by resolving it relative to a given otherPath. More... | |
ComponentPath | formRelativePath (const ComponentPath &otherPath) const |
Find the relative Path between this Path and another Path (otherPath) (i.e. More... | |
ComponentPath | getParentPath () const |
Return the sub-path that contains all subdirectory levels except for the last one. More... | |
std::string | getParentPathString () const |
Return the parent path as a string. More... | |
std::string | getSubcomponentNameAtLevel (size_t index) const |
Return a string of a subdirectory name at a specified level. More... | |
std::string | getComponentName () const |
Return a string of the name of the Component related to a ComponentPath. More... | |
Public Member Functions inherited from OpenSim::Path | |
Path (const char separator, const std::string invalidChars) | |
Create an empty path. More... | |
Path (const std::string path, const char separator, const std::string invalidChars) | |
Construct Path from a string, given separator character and a string of invalidChars. More... | |
Path (const std::vector< std::string > pathVec, const char separator, const std::string invalidChars, bool isAbsolute) | |
Construct Path from a vector of strings (pathVec), given separator character and a string of invalidChars. More... | |
Path (const Path &)=default | |
Use default copy constructor and assignment operator. More... | |
Path & | operator= (const Path &)=default |
virtual | ~Path ()=default |
Destructor. More... | |
std::string | toString () const |
Write out the path to a string with each element separated by the specified separator. More... | |
bool | isAbsolute () const |
Return true if this Path is an absolute path. More... | |
size_t | getNumPathLevels () const |
Return the number of levels (or elements) in the Path. More... | |
void | pushBack (const std::string &pathElement) |
Push a string to the back of a path (i.e. More... | |
bool | isLegalPathElement (const std::string &pathElement) const |
Return true if pathElement does not contain any chars from the list of getInvalidChars() More... | |
void | trimDotAndDotDotElements () |
This removes "." elements and resolves ".." elements if possible (i.e., it will not remove leading ".." but otherwise will remove pairs of ".." and the preceding element). More... | |
Additional Inherited Members | |
Protected Member Functions inherited from OpenSim::Path | |
std::vector< std::string > | formAbsolutePathVec (const Path &otherPath) const |
Get an absolute path by resolving it relative to a given otherPath. More... | |
std::vector< std::string > | formRelativePathVec (const Path &otherPath) const |
Find the relative Path between this Path and another Path (otherPath) (i.e. More... | |
std::vector< std::string > | getParentPathVec () const |
Return the sub-path that contains all pathElements except for the last one. More... | |
std::string | getPathElement (size_t pos) const |
Return the pathElement from the specified position as a string. More... | |
std::string | getPathName () const |
Return the last pathElement as a string. More... | |
A class for handling Paths for Components, deriving from Path.
A ComponentPath uses a forward-slash ('/') as a separator always. It also specifies invalid characters in a Component name:
OpenSim::ComponentPath::ComponentPath | ( | ) |
The default-constructed path is empty (an empty string).
OpenSim::ComponentPath::ComponentPath | ( | const std::string & | path | ) |
Construct a ComponentPath from a string.
This will clean up the path, removing and resolving "." and ".." when possible.
OpenSim::ComponentPath::ComponentPath | ( | const std::vector< std::string > & | pathVec, |
bool | isAbsolute | ||
) |
Constructor a ComponentPath from a vector that contains all subtree node names and a bool that indicates if the path is an absolute path.
ComponentPath OpenSim::ComponentPath::formAbsolutePath | ( | const ComponentPath & | otherPath | ) | const |
ComponentPath OpenSim::ComponentPath::formRelativePath | ( | const ComponentPath & | otherPath | ) | const |
std::string OpenSim::ComponentPath::getComponentName | ( | ) | const |
Return a string of the name of the Component related to a ComponentPath.
This is just the last level of a ComponentPath.
Referenced by OpenSim::AbstractSocket::checkConnecteePathProperty(), and OpenSim::Component::findComponent().
|
inlineoverridevirtual |
Pure virtual function that returns a string of invalid characters.
Implements OpenSim::Path.
ComponentPath OpenSim::ComponentPath::getParentPath | ( | ) | const |
Return the sub-path that contains all subdirectory levels except for the last one.
std::string OpenSim::ComponentPath::getParentPathString | ( | ) | const |
Return the parent path as a string.
|
inlineoverridevirtual |
Pure virtual function that returns a char for the designated separator.
Implements OpenSim::Path.
std::string OpenSim::ComponentPath::getSubcomponentNameAtLevel | ( | size_t | index | ) | const |
Return a string of a subdirectory name at a specified level.
This is 0 indexed.
Referenced by OpenSim::Input< T >::finalizeConnection(), and OpenSim::Component::traversePathToComponent().
|
inline |
References OpenSim::Path::toString().
|
inline |
References OpenSim::Path::toString().