App::PropertyLinkSub Class Reference

the Link Poperty with sub elements This property links a object and a defined sequence of sub elements. More...

#include <PropertyLinks.h>

Inheritance diagram for App::PropertyLinkSub:
App::Property Base::Persistence Base::BaseClass

List of all members.

Public Member Functions

virtual PropertyCopy (void) const
 Returns a new copy of the property (mainly for Undo/Redo and transactions).
virtual unsigned int getMemSize (void) const
 This method is used to get the size of objects It is not meant to have the exact size, it is more or less an estimation which runs fast! Is it two bytes or a GB? This method is defined in Base::Persistence.
virtual PyObjectgetPyObject (void)
 This method returns the Python wrapper for a C++ object.
const std::vector< std::string > & getSubValues (void) const
 return the list of sub elements
std::vector< std::string > getSubValuesStartsWith (const char *) const
 return the list of sub elements starts with a special string
virtual Base::Type getTypeId (void) const
template<typename _type >
_type getValue (void) const
 Returns the link type checked.
App::DocumentObjectgetValue (Base::Type t) const
 Returns the link type checked.
App::DocumentObjectgetValue (void) const
 This method returns the linked DocumentObject.
virtual void Paste (const Property &from)
 PropertyLinkSub ()
 A constructor.
virtual void Restore (Base::XMLReader &reader)
 This method is used to restore properties from an XML document.
virtual void Save (Base::Writer &writer) const
 This method is used to save properties to an XML document.
virtual void setPyObject (PyObject *)
void setValue (App::DocumentObject *, const std::vector< std::string > &SubList=std::vector< std::string >())
 Sets the property.
 ~PropertyLinkSub ()
 A destructor.

Static Public Member Functions

static void * create (void)
static Base::Type getClassTypeId (void)
static void init (void)

Protected Attributes

std::vector< std::string > _cSubList
App::DocumentObject_pcLinkSub

Detailed Description

the Link Poperty with sub elements This property links a object and a defined sequence of sub elements.

This subelemts (like Edges of a Shape) are stored as names, which can be resolved by the ComplexGeoDataType interface to concrete sub objects.

Definition at line 106 of file PropertyLinks.h.


Constructor & Destructor Documentation

PropertyLinkSub::PropertyLinkSub (  ) 

A constructor.

A more elaborate description of the constructor.

Definition at line 169 of file PropertyLinks.cpp.

Referenced by Copy().

PropertyLinkSub::~PropertyLinkSub (  ) 

A destructor.

A more elaborate description of the destructor.

Definition at line 176 of file PropertyLinks.cpp.


Member Function Documentation

Property * PropertyLinkSub::Copy ( void   )  const [virtual]

Returns a new copy of the property (mainly for Undo/Redo and transactions).

Implements App::Property.

Definition at line 310 of file PropertyLinks.cpp.

References _cSubList, _pcLinkSub, draftTools::p, and PropertyLinkSub().

void * App::PropertyLinkSub::create ( void   )  [static]

Reimplemented from App::Property.

Definition at line 163 of file PropertyLinks.cpp.

Base::Type App::PropertyLinkSub::getClassTypeId ( void   )  [static]
virtual unsigned int App::PropertyLinkSub::getMemSize ( void   )  const [inline, virtual]

This method is used to get the size of objects It is not meant to have the exact size, it is more or less an estimation which runs fast! Is it two bytes or a GB? This method is defined in Base::Persistence.

See also:
Base::Persistence

Reimplemented from App::Property.

Definition at line 157 of file PropertyLinks.h.

PyObject * PropertyLinkSub::getPyObject ( void   )  [virtual]

This method returns the Python wrapper for a C++ object.

It's in the responsibility of the programmer to do the correct reference counting. Basically there are two ways how to implement that: Either always return a new Python object then reference counting is not a matter or return always the same Python object then the reference counter must be incremented by one. However, it's absolutely forbidden to return always the same Python object without incrementing the reference counter.

The default implementation returns 'None'.

Reimplemented from Base::BaseClass.

Definition at line 216 of file PropertyLinks.cpp.

References _cSubList, _pcLinkSub, App::DocumentObject::getPyObject(), Py::new_reference_to(), Py::None(), and draftlibs::fcvec::tup().

const std::vector< std::string > & PropertyLinkSub::getSubValues ( void   )  const

return the list of sub elements

Definition at line 197 of file PropertyLinks.cpp.

References _cSubList.

Referenced by Sketcher::SketchObject::execute(), and Part::RuledSurface::execute().

std::vector< std::string > PropertyLinkSub::getSubValuesStartsWith ( const char *  starter  )  const

return the list of sub elements starts with a special string

Definition at line 202 of file PropertyLinks.cpp.

References _cSubList.

Referenced by PartDesign::Fillet::execute(), and Robot::Edge2TracObject::execute().

Base::Type App::PropertyLinkSub::getTypeId ( void   )  const [virtual]

Reimplemented from App::Property.

Definition at line 163 of file PropertyLinks.cpp.

Referenced by Restore().

template<typename _type >
_type App::PropertyLinkSub::getValue ( void   )  const [inline]

Returns the link type checked.

Definition at line 144 of file PropertyLinks.h.

App::DocumentObject * PropertyLinkSub::getValue ( Base::Type  t  )  const

Returns the link type checked.

Definition at line 211 of file PropertyLinks.cpp.

References _pcLinkSub, App::PropertyContainer::getTypeId(), and Base::Type::isDerivedFrom().

App::DocumentObject * PropertyLinkSub::getValue ( void   )  const
void App::PropertyLinkSub::init ( void   )  [static]

Reimplemented from App::Property.

Definition at line 163 of file PropertyLinks.cpp.

void PropertyLinkSub::Paste ( const Property from  )  [virtual]
void PropertyLinkSub::Restore ( Base::XMLReader  )  [virtual]

This method is used to restore properties from an XML document.

It uses the XMLReader class, which bases on SAX, to read the in Save() written information. Again the Vector as an example:

 void PropertyVector::Restore(Base::XMLReader &reader)
 {
   // read my Element
   reader.readElement("PropertyVector");
   // get the value of my Attribute
   _cVec.x = (float)reader.getAttributeAsFloat("valueX");
   _cVec.y = (float)reader.getAttributeAsFloat("valueY");
   _cVec.z = (float)reader.getAttributeAsFloat("valueZ");
 }

Implements Base::Persistence.

Definition at line 277 of file PropertyLinks.cpp.

References Base::Console(), RobotExampleTrajectoryOutOfShapes::count, Base::XMLReader::getAttribute(), Base::XMLReader::getAttributeAsInteger(), App::PropertyContainer::getClassTypeId(), App::Property::getContainer(), getTypeId(), Base::BaseClass::isDerivedFrom(), Base::XMLReader::readElement(), Base::XMLReader::readEndElement(), setValue(), and Base::ConsoleSingleton::Warning().

void PropertyLinkSub::Save ( Base::Writer  )  const [virtual]

This method is used to save properties to an XML document.

A good example you'll find in PropertyStandard.cpp, e.g. the vector:

  void PropertyVector::Save (Writer &writer) const
  {
     writer << writer.ind() << "<PropertyVector valueX=\"" <<  _cVec.x <<
                                            "\" valueY=\"" <<  _cVec.y <<
                                            "\" valueZ=\"" <<  _cVec.z <<"\"/>" << endl;
  }

The writer.ind() expression writes the indention, just for pretty printing of the XML. As you see, the writing of the XML document is not done with a DOM implementation because of performance reasons. Therefore the programmer has to take care that a valid XML document is written. This means closing tags and writing UTF-8.

See also:
Base::Writer

Implements Base::Persistence.

Definition at line 262 of file PropertyLinks.cpp.

References _cSubList, _pcLinkSub, Base::Writer::decInd(), App::DocumentObject::getNameInDocument(), Base::Writer::incInd(), Base::Writer::ind(), and Base::Writer::Stream().

void PropertyLinkSub::setPyObject ( PyObject value  )  [virtual]
void PropertyLinkSub::setValue ( App::DocumentObject lValue,
const std::vector< std::string > &  SubList = std::vector<std::string>() 
)

Member Data Documentation

std::vector<std::string> App::PropertyLinkSub::_cSubList [protected]

Definition at line 162 of file PropertyLinks.h.

Referenced by Copy(), getPyObject(), getValue(), Paste(), Save(), and setValue().


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

Generated on Wed Nov 23 19:01:45 2011 for FreeCAD by  doxygen 1.6.1