Workspace 6.21.5
Public Member Functions | Protected Member Functions | List of all members
NamePath Class Reference

Provides a way to identify a particular input or output of an operation in a (possibly nested) namespace.

#include <Workspace/Widgets/namepath.h>

Inheritance diagram for NamePath:
[legend]

Public Member Functions

 NamePath ()
 
 NamePath (DataExecution::IOBase &iobase)
 
 ~NamePath () override
 
void add (const QString &name)
 
const QString & back () const
 
void clear ()
 
NamePathclone () const override
 
bool empty () const
 
void erase (int index)
 
void eraseToEnd (int index)
 
const QString & front () const
 
virtual DataExecution::DataObjectgetDataObject () const
 
DataExecution::IOBasegetIOBase () const
 
QString getLocalName () const
 
QWidget * getWidget () const
 
bool isValid () const
 
NamePathoperator= (const NamePath &namePath)=delete
 
bool operator== (const NamePath &namePath) const
 
const QString & operator[] (int index) const
 
void setWidget (QWidget *widget) const
 
unsigned size () const
 
- Public Member Functions inherited from Clonable
virtual ~Clonable ()=default
 
virtual Clonableclone () const =0
 

Protected Member Functions

 NamePath (const NamePath &namePath)
 

Constructor & Destructor Documentation

◆ NamePath() [1/3]

NamePath ( const NamePath namePath)
protected
Parameters
namePathThe name path to copy.

◆ NamePath() [2/3]

NamePath ( )

Constructs an invalid path.

See also
isValid()

◆ NamePath() [3/3]

Parameters
iobaseThe input/output with which to associate this name path.

◆ ~NamePath()

~NamePath ( )
override

Member Function Documentation

◆ add()

void add ( const QString &  name)
Parameters
nameThe name to append to the end of the name path.

◆ back()

const QString & back ( ) const
Returns
The last name in the name path.
Precondition
The name path must not be empty.

◆ clear()

void clear ( )

Clears the name path. If the name path is invalid, clear() does nothing.

See also
isValid()

◆ clone()

NamePath * clone ( ) const
overridevirtual
Returns
A clone of this object.
Note
Subclasses would normally return their own type rather than the Clonable type. The C++ language rules allow a more derived type to be returned from a virtual function and the compiler will still treat it as a valid override.

Implements Clonable.

◆ empty()

bool empty ( ) const
Returns
True if the name path is empty or invalid.
See also
isValid()

◆ erase()

void erase ( int  index)
Parameters
indexThe index of the name to erase. Names at higher indexes are shifted down.

◆ eraseToEnd()

void eraseToEnd ( int  index)
Parameters
indexThe index of the name to erase. Names at higher indexes will also be erased.
Postcondition
The size of the name path will be index after the function returns.

◆ front()

const QString & front ( ) const
Returns
The first name in the name path.
Precondition
The name path must not be empty.

◆ getDataObject()

DataObject * getDataObject ( ) const
virtual
Returns
The data object this name path corresponds to. If the name path is empty, this will return the data object for the input/output the name path is attached to (set in the constructor). If the name path is invalid, a null pointer will be returned.
See also
isValid()

◆ getIOBase()

IOBase * getIOBase ( ) const
Returns
The input/output this name path is attached to (set in the constructor), or a null pointer if the name path is invalid.
See also
isValid()

◆ getLocalName()

QString getLocalName ( ) const
Returns
The name of the specific data object this name path refers to. If the name path is not empty, this will be the last name in the name path list. For an empty name path, the name of the input/output this name path is associated with will be returned. Finally, if the name path is invalid, an empty string will be returned.

◆ getWidget()

QWidget * getWidget ( ) const

◆ isValid()

bool isValid ( ) const
Returns
True if the name path is associated with an input or output. The only way to create an invalid name path is through the default constructor.

◆ operator=()

NamePath & operator= ( const NamePath namePath)
delete

◆ operator==()

bool operator== ( const NamePath namePath) const
Returns
True if the two name paths refer to the same data.

◆ operator[]()

const QString & operator[] ( int  index) const
Parameters
indexThe index into the name path of the name to return. It is up to the caller to ensure that this index is valid (ie >=0 and less than the result of size()).
Returns
The specified name.

◆ setWidget()

void setWidget ( QWidget *  widget) const

◆ size()

unsigned size ( ) const
Returns
The number of names in the name path. If isValid() returns false, size() will return 0.
See also
isValid()