String properties This is the father of all properties handling Strings. More...
#include <PropertyStandard.h>
Public Member Functions | |
virtual Property * | Copy (void) const |
Returns a new copy of the property (mainly for Undo/Redo and transactions). | |
virtual const char * | getEditorName (void) const |
Get the class name of the associated property editor item. | |
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 PyObject * | getPyObject (void) |
This method returns the Python wrapper for a C++ object. | |
virtual Base::Type | getTypeId (void) const |
const char * | getValue (void) const |
bool | isEmpty (void) |
virtual void | Paste (const Property &from) |
PropertyString (void) | |
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 (const std::string &sString) |
void | setValue (const char *sString) |
virtual | ~PropertyString () |
A destructor. | |
Static Public Member Functions | |
static void * | create (void) |
static Base::Type | getClassTypeId (void) |
static void | init (void) |
String properties This is the father of all properties handling Strings.
Definition at line 455 of file PropertyStandard.h.
PropertyString::PropertyString | ( | void | ) |
A constructor.
A more elaborate description of the constructor.
Definition at line 1038 of file PropertyStandard.cpp.
Referenced by Copy().
PropertyString::~PropertyString | ( | ) | [virtual] |
A destructor.
A more elaborate description of the destructor.
Definition at line 1043 of file PropertyStandard.cpp.
Property * PropertyString::Copy | ( | void | ) | const [virtual] |
Returns a new copy of the property (mainly for Undo/Redo and transactions).
Implements App::Property.
Definition at line 1111 of file PropertyStandard.cpp.
References draftTools::p, and PropertyString().
void * App::PropertyString::create | ( | void | ) | [static] |
Reimplemented from App::Property.
Reimplemented in App::PropertyFile, and App::PropertyFont.
Definition at line 1036 of file PropertyStandard.cpp.
Base::Type App::PropertyString::getClassTypeId | ( | void | ) | [static] |
Reimplemented from App::Property.
Reimplemented in App::PropertyFile, and App::PropertyFont.
Definition at line 1036 of file PropertyStandard.cpp.
Referenced by Gui::PropertyEditor::PropertyStringItem::value().
virtual const char* App::PropertyString::getEditorName | ( | void | ) | const [inline, virtual] |
Get the class name of the associated property editor item.
Reimplemented from App::Property.
Reimplemented in App::PropertyFile, and App::PropertyFont.
Definition at line 479 of file PropertyStandard.h.
unsigned int PropertyString::getMemSize | ( | void | ) | const [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.
Reimplemented from App::Property.
Definition at line 1125 of file PropertyStandard.cpp.
PyObject * PropertyString::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 1069 of file PropertyStandard.cpp.
References draftTools::p.
Base::Type App::PropertyString::getTypeId | ( | void | ) | const [virtual] |
Reimplemented from App::Property.
Reimplemented in App::PropertyFile, and App::PropertyFont.
Definition at line 1036 of file PropertyStandard.cpp.
const char * PropertyString::getValue | ( | void | ) | const |
Definition at line 1064 of file PropertyStandard.cpp.
Referenced by Gui::ViewProviderAnnotationLabel::drawImage(), Raytracing::RayProject::execute(), Points::Export::execute(), Points::ImportAscii::execute(), Part::ImportStep::execute(), Part::ImportIges::execute(), Part::ImportBrep::execute(), Part::CurveNet::execute(), Drawing::FeaturePage::execute(), Mesh::SetOperations::execute(), Mesh::Import::execute(), Mesh::Export::execute(), App::Document::isSaved(), Gui::ViewProviderAnnotation::onChanged(), App::FeaturePythonImp::onChanged(), App::DocumentPy::restore(), App::Document::restore(), App::Document::Restore(), App::DocumentPy::save(), App::Document::save(), and App::Document::~Document().
void App::PropertyString::init | ( | void | ) | [static] |
Reimplemented from App::Property.
Reimplemented in App::PropertyFile, and App::PropertyFont.
Definition at line 1036 of file PropertyStandard.cpp.
bool App::PropertyString::isEmpty | ( | void | ) | [inline] |
Definition at line 477 of file PropertyStandard.h.
void PropertyString::Paste | ( | const Property & | from | ) | [virtual] |
Definition at line 1118 of file PropertyStandard.cpp.
References App::Property::aboutToSetValue(), and App::Property::hasSetValue().
void PropertyString::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 1103 of file PropertyStandard.cpp.
References Base::XMLReader::getAttribute(), Base::XMLReader::readElement(), and setValue().
void PropertyString::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.
Implements Base::Persistence.
Definition at line 1097 of file PropertyStandard.cpp.
References App::Property::encodeAttribute(), Base::Writer::ind(), and Base::Writer::Stream().
void PropertyString::setPyObject | ( | PyObject * | value | ) | [virtual] |
Reimplemented from Base::BaseClass.
Definition at line 1076 of file PropertyStandard.cpp.
References draftlibs::dxfReader::error(), and setValue().
void PropertyString::setValue | ( | const std::string & | sString | ) |
Definition at line 1057 of file PropertyStandard.cpp.
References App::Property::aboutToSetValue(), and App::Property::hasSetValue().
void PropertyString::setValue | ( | const char * | sString | ) |
Definition at line 1048 of file PropertyStandard.cpp.
References App::Property::aboutToSetValue(), and App::Property::hasSetValue().
Referenced by App::Document::addObject(), Raytracing::RayFeature::execute(), Drawing::FeatureViewPart::execute(), App::FeatureTest::execute(), insert(), App::Application::newDocument(), open(), App::Application::openDocument(), Restore(), App::Document::Restore(), Sandbox::DocumentTestThread::run(), App::Document::save(), and setPyObject().