Views
Foundation Package API Reference Guide
Product Documentation:
Views Documentation Home
List of all members | Public Member Functions
IlvSmartSet Class Reference

Group class. More...

#include <ilviews/graphics/smartset.h>

Public Member Functions

 IlvSmartSet (const char *name=0)
 Constructor. More...
 
 IlvSmartSet (const IlvSmartSet &source, const char *name=0)
 Constructor. More...
 
 IlvSmartSet (IlvDisplay *display, IlvInputFile &file)
 Constructor. More...
 
virtual ~IlvSmartSet ()
 Destructor. More...
 
IlBoolean addObject (IlvGraphic *object)
 Adds an object. More...
 
virtual IlvSmartSetcopy () const
 Copies this smart set. More...
 
IlUInt getCardinal () const
 Gets the number of objects. More...
 
const char * getName () const
 Gets the name. More...
 
const char * getName (const IlvGraphic *object)
 Gets the original name of an object. More...
 
virtual const char * getNamesSeparator () const
 Gets the string used to name the objects. More...
 
virtual IlvGraphicgetObject (const char *) const
 Gets an object by name. More...
 
IlvGraphic *const * getObjects (IlUInt &count) const
 Gets all the objects. More...
 
IlBoolean hasObject (IlvGraphic *object) const
 Checks if an object is present. More...
 
IlBoolean removeObject (IlvGraphic *object, IlBoolean destroy=IlFalse)
 Removes an object. More...
 
void setName (const char *newName)
 Sets the name. More...
 
void setName (const IlvGraphic *, const char *)
 Sets the name of an object. More...
 
virtual void write (IlvOutputFile &file) const
 Writes this smart set to a stream. More...
 

Detailed Description

Group class.

Library: views

The IlvSmartSet class is designed to create logical groups, called SmartSets, in the context of a container or a manager. A SmartSet references a group of objects.

When an object is added to the SmartSet, its name is modified in order to reference the name of the SmartSet. An object cannot be stored simultaneously in more than one SmartSet.

See also
IlvContainer, IlvManager.

Constructor & Destructor Documentation

◆ IlvSmartSet() [1/3]

IlvSmartSet::IlvSmartSet ( const IlvSmartSet source,
const char *  name = 0 
)

Constructor.

This constructor initializes a new SmartSet by creating a copy of an existing SmartSet. All the objects stored in the source are copied (by calling their copy() method) and stored in this new SmartSet. If name is not 0, the name of this new SmartSet is set to a copy of name, otherwise, this SmartSet is given the same name as source.

◆ IlvSmartSet() [2/3]

IlvSmartSet::IlvSmartSet ( const char *  name = 0)

Constructor.

This constructor initializes a new empty IlvSmartSet. The name of this new SmartSet is initialized to a copy of the string name.

◆ IlvSmartSet() [3/3]

IlvSmartSet::IlvSmartSet ( IlvDisplay display,
IlvInputFile file 
)

Constructor.

This constructor initializes a new SmartSet by reading its definition from the input file file.

◆ ~IlvSmartSet()

virtual IlvSmartSet::~IlvSmartSet ( )
virtual

Destructor.

The destructor removes all the objects this SmartSet stores, and gives them their original names. No objects are destroyed.

Member Function Documentation

◆ addObject()

IlBoolean IlvSmartSet::addObject ( IlvGraphic object)

Adds an object.

Adds the graphic object object to this SmartSet. If both this SmartSet and object have names, the name of object is changed to the concatenation of the SmartSet name, the name separator string, and the object name. This function returns IlFalse on error, that is, if this object is already located in a SmartSet.

◆ copy()

virtual IlvSmartSet* IlvSmartSet::copy ( ) const
virtual

Copies this smart set.

Returns
A copy of this smart set. It is equivalent to: new IlvSmartSet(*this);

◆ getCardinal()

IlUInt IlvSmartSet::getCardinal ( ) const

Gets the number of objects.

Returns
The number of objects stored in this smart set.

◆ getName() [1/2]

const char* IlvSmartSet::getName ( ) const

Gets the name.

Returns
the name of this SmartSet or 0 if the SmartSet doesn't have a name. This string must not be modified nor deleted.

◆ getName() [2/2]

const char* IlvSmartSet::getName ( const IlvGraphic object)

Gets the original name of an object.

Returns
The original name of the object object, or 0 if the object cannot be found or has no name.

◆ getNamesSeparator()

virtual const char* IlvSmartSet::getNamesSeparator ( ) const
virtual

Gets the string used to name the objects.

Returns
The string used to build the names of the objects when stored in this smart set. The default implementation returns "#".

◆ getObject()

virtual IlvGraphic* IlvSmartSet::getObject ( const char *  ) const
virtual

Gets an object by name.

Returns
A pointer to the object that has the original name name in this smart set, or 0 if it cannot be found.

◆ getObjects()

IlvGraphic* const* IlvSmartSet::getObjects ( IlUInt count) const

Gets all the objects.

Returns
An array of graphic object stored in this smart set. The number of objects is returned in count. This array must not be modified nor deleted. Other Rogue Wave Views functions can overwrite this array so the caller of this method should consider copying it.

◆ hasObject()

IlBoolean IlvSmartSet::hasObject ( IlvGraphic object) const

Checks if an object is present.

Returns
IlTrue if object is stored in this SmartSet, and IlFalse if it is not.

◆ removeObject()

IlBoolean IlvSmartSet::removeObject ( IlvGraphic object,
IlBoolean  destroy = IlFalse 
)

Removes an object.

Removes the object object from the SmartSet. If destroy is set to IlTrue, the object is deleted, otherwise, the object is renamed to its original name.

◆ setName() [1/2]

void IlvSmartSet::setName ( const char *  newName)

Sets the name.

Sets the name of this SmartSet to a copy of the string newName. If newName is 0, the SmartSet has no name and the name of the subobjects is hidden.

◆ setName() [2/2]

void IlvSmartSet::setName ( const IlvGraphic ,
const char *   
)

Sets the name of an object.

Sets the original name of object, that must be stored in this smart set, to a copy of the string name. If name is 0, the name of the object is removed.

◆ write()

virtual void IlvSmartSet::write ( IlvOutputFile file) const
virtual

Writes this smart set to a stream.

Writes in the output file file a description of this SmartSet.