#include <ObjectOrderBase.hpp>
Inherited by openstudio::detail::WorkspaceObjectOrder_Impl.
Public Member Functions | |
bool | erase (IddObjectType type) |
Deletes type from the user-specified IddObjectType order, if it exists and contains type. More... | |
OptionalIddObjectTypeVector | iddOrder () const |
Returns the user-specified order by IddObjectType, if it exists. More... | |
OptionalUnsigned | indexInOrder (const IddObjectType &type) const |
Returns the index of type in IddObjectType order if ordering directly by enum, or by user-specified order. More... | |
bool | inOrder (const IddObjectType &type) const |
Returns true if ordering by IddObjectType enum, or if ordering by user-specified IddObjectType order, and type is explicitly listed. More... | |
bool | insert (IddObjectType type, IddObjectType insertBeforeType) |
Inserts type before insertBeforeType in the user-specified IddObjectType order, if it exists. More... | |
bool | insert (IddObjectType type, unsigned index) |
Inserts type at index of the user-specified IddObjectType order, if it exists, and index is valid. More... | |
virtual bool | less (IddObjectType left, IddObjectType right) const |
Predicate function used by derived classes to sort objects and handles. More... | |
virtual bool | less (boost::optional< IddObjectType > left, boost::optional< IddObjectType > right) const |
Predicate function used by derived classes to sort objects and handles. More... | |
bool | move (IddObjectType type, IddObjectType insertBeforeType) |
Moves type from current location and places before insertBeforeType, if a user-specified IddObjectType order exists. More... | |
bool | move (IddObjectType type, unsigned index) |
Moves type from current location to index in user-specified IddObjectType order, if it exists. More... | |
ObjectOrderBase () | |
Default constructor establishes ordering by IddObjectType enum. More... | |
ObjectOrderBase (bool directOrder) | |
Constructor specifies that a derived class is in charge. More... | |
ObjectOrderBase (const IddObjectTypeVector &iddOrder) | |
A user-specified order of IddObjectTypes is established on construction. More... | |
bool | orderByIddEnum () const |
Returns true if ordering by IddObjectType enum. More... | |
bool | push_back (IddObjectType type) |
Adds type to the user-specified IddObjectType order, if it exists. More... | |
void | setDirectOrder () |
Disables ordering by IddObjectType. More... | |
virtual void | setIddOrder (const IddObjectTypeVector &order) |
Clears out the previous order, and establishes order as the new basis for comparison. More... | |
virtual void | setOrderByIddEnum () |
Clears out the previous order, and establishes IddObjectType enum as the orderer. More... | |
bool | swap (IddObjectType type1, IddObjectType type2) |
Swaps type1 and type2 in the user-specified IddObjectType order, if it exists and contains type1 and type2. More... | |
virtual | ~ObjectOrderBase ()=default |
Protected Member Functions | |
IddObjectTypeVector::iterator | getIterator (const IddObjectType &type) |
IddObjectTypeVector::const_iterator | getIterator (const IddObjectType &type) const |
Protected Attributes | |
OptionalIddObjectTypeVector | m_iddOrder |
bool | m_orderByIddEnum |
Base class for ordering objects.
Provides ordering by IddObjectType enum (using the implicit conversion to int), and user-specified ordering of IddObjectTypes.
openstudio::ObjectOrderBase::ObjectOrderBase | ( | ) |
Default constructor establishes ordering by IddObjectType enum.
openstudio::ObjectOrderBase::ObjectOrderBase | ( | bool | directOrder | ) |
Constructor specifies that a derived class is in charge.
openstudio::ObjectOrderBase::ObjectOrderBase | ( | const IddObjectTypeVector & | iddOrder | ) |
A user-specified order of IddObjectTypes is established on construction.
|
virtualdefault |
bool openstudio::ObjectOrderBase::erase | ( | IddObjectType | type | ) |
Deletes type from the user-specified IddObjectType order, if it exists and contains type.
Otherwise, returns false.
|
protected |
|
protected |
OptionalIddObjectTypeVector openstudio::ObjectOrderBase::iddOrder | ( | ) | const |
Returns the user-specified order by IddObjectType, if it exists.
Otherwise return value evaluates to false.
OptionalUnsigned openstudio::ObjectOrderBase::indexInOrder | ( | const IddObjectType & | type | ) | const |
Returns the index of type in IddObjectType order if ordering directly by enum, or by user-specified order.
Otherwise, the return value evaluates to false.
bool openstudio::ObjectOrderBase::inOrder | ( | const IddObjectType & | type | ) | const |
Returns true if ordering by IddObjectType enum, or if ordering by user-specified IddObjectType order, and type is explicitly listed.
bool openstudio::ObjectOrderBase::insert | ( | IddObjectType | type, |
IddObjectType | insertBeforeType | ||
) |
Inserts type before insertBeforeType in the user-specified IddObjectType order, if it exists.
Returns false if such an order does not exist. If insertBeforeType is not in the order, this method is equivalent to push_back(type).
bool openstudio::ObjectOrderBase::insert | ( | IddObjectType | type, |
unsigned | index | ||
) |
Inserts type at index of the user-specified IddObjectType order, if it exists, and index is valid.
Returns false if such an order does not exist. Is equivalent to push_back(type) if index is out of range.
|
virtual |
Predicate function used by derived classes to sort objects and handles.
|
virtual |
Predicate function used by derived classes to sort objects and handles.
Assumes uninitialized optionals are always greater than.
bool openstudio::ObjectOrderBase::move | ( | IddObjectType | type, |
IddObjectType | insertBeforeType | ||
) |
Moves type from current location and places before insertBeforeType, if a user-specified IddObjectType order exists.
Otherwise, returns false. Also returns false if type is not in the order. If insertBeforeType is not in the order, this method is equivalent to move(type,order.size()).
bool openstudio::ObjectOrderBase::move | ( | IddObjectType | type, |
unsigned | index | ||
) |
Moves type from current location to index in user-specified IddObjectType order, if it exists.
Returns false otherwise, or if type is not in the order. If index is invalid, this method is equivalent to move(type,order.size()).
bool openstudio::ObjectOrderBase::orderByIddEnum | ( | ) | const |
Returns true if ordering by IddObjectType enum.
bool openstudio::ObjectOrderBase::push_back | ( | IddObjectType | type | ) |
Adds type to the user-specified IddObjectType order, if it exists.
Returns false if such an order does not exist.
void openstudio::ObjectOrderBase::setDirectOrder | ( | ) |
Disables ordering by IddObjectType.
Is called by derived classes to signal that they are setting the order.
|
virtual |
Clears out the previous order, and establishes order as the new basis for comparison.
|
virtual |
Clears out the previous order, and establishes IddObjectType enum as the orderer.
bool openstudio::ObjectOrderBase::swap | ( | IddObjectType | type1, |
IddObjectType | type2 | ||
) |
Swaps type1 and type2 in the user-specified IddObjectType order, if it exists and contains type1 and type2.
Otherwise, returns false.
|
protected |
|
protected |