Jamoma API  0.6.0.a19
TTXmlHandler Class Reference

Write / Read mecanism. More...

#include <TTXmlHandler.h>

+ Inheritance diagram for TTXmlHandler:
+ Collaboration diagram for TTXmlHandler:

Public Member Functions

TTErr setObject (const TTValue &value)
 Setter for mObject attribute. More...
 
TTErr Write (const TTValue &args, TTValue &outputValue)
 TTXmlWriter could takes absolute file path or nothing. More...
 
TTErr Read (const TTValue &args, TTValue &outputValue)
 TTXmlReader could takes absolute file path or nothing. More...
 
TTErr fromXmlChar (const void *xCh, TTValue &v, TTBoolean addQuote=NO, TTBoolean numberAsSymbol=NO)
 TTXmlReader make a TTValue from an xmlChar* using the fromString method (see in TTValue.h)
 
TTErr getXmlAttribute (TTSymbol attributeName, TTValue &returnedValue, TTBoolean addQuote=NO, TTBoolean numberAsSymbol=NO)
 Get the value of an xml element attribute.
 
TTErr getXmlNextAttribute (TTSymbol &returnedAttributeName, TTValue &returnedValue, TTBoolean addQuote=NO, TTBoolean numberAsSymbol=NO)
 Get the value of the next xml element attribute.
 
- Public Member Functions inherited from TTObjectBase
virtual ~TTObjectBase ()
 Destructor.
 
TTUInt16 getReferenceCount ()
 Query an object to get its current reference count. More...
 
TTUInt32 getObserverCount () const
 Query an object to get the number of observers. More...
 
TTErr registerAttribute (const TTSymbol name, const TTDataType type, void *address)
 Register an attribute. More...
 
TTErr extendAttribute (const TTSymbol name, const TTObjectBasePtr extendedObject, const TTSymbol extendedName)
 Extend the attribute of an existing TTObjectBase to this TTObjectBase (using another attribute name) More...
 
TTErr removeAttribute (const TTSymbol name)
 Remove an attribute. More...
 
TTErr findAttribute (const TTSymbol name, TTAttribute **attr)
 Find an attribute. More...
 
TTErr setAttributeValue (const TTSymbol name, TTValue &value)
 Set an attribute value for an object. More...
 
template<class T >
TTErr set (const TTSymbol aName, T aValue)
 Set an attribute value for an object This is the same as calling setAttributeValue(). More...
 
TTErr getAttributeValue (const TTSymbol name, TTValue &value)
 Get an attribute value for an object. More...
 
template<class T >
TTErr get (const TTSymbol aName, T &aReturnedValue)
 Get an attribute value for an object This is the same as calling getAttributeValue(). More...
 
TTSymbol getAttributeType (const TTSymbol name)
 Return the type of an attribute as a symbol. More...
 
TTErr getAttributeGetterFlags (const TTSymbol name, TTAttributeFlags &value)
 Get the getterFlags of an attribute. More...
 
TTErr setAttributeGetterFlags (const TTSymbol name, TTAttributeFlags &value)
 Set the getterFlags of an attribute. More...
 
TTErr getAttributeSetterFlags (const TTSymbol name, TTAttributeFlags &value)
 Get the setterFlags of an attribute. More...
 
TTErr setAttributeSetterFlags (const TTSymbol name, TTAttributeFlags &value)
 Set the setterFlags of an attribute. More...
 
TTErr registerAttributeProperty (const TTSymbol attributeName, const TTSymbol propertyName, const TTValue &initialValue, TTGetterMethod getter, TTSetterMethod setter)
 Register an attribute property. More...
 
TTErr registerMessageProperty (const TTSymbol messageName, const TTSymbol propertyName, const TTValue &initialValue, TTGetterMethod getter, TTSetterMethod setter)
 Register an message property. More...
 
TTErr getAttribute (const TTSymbol name, TTAttributePtr *attributeObject)
 Search for and locate an attribute. More...
 
TTErr getMessage (const TTSymbol name, TTMessagePtr *messageObject)
 Search for and locate a message. More...
 
void getAttributeNames (TTValue &attributeNameList)
 Return a list of names of the available attributes. More...
 
void getMessageNames (TTValue &messageNameList)
 Return a list of names of the available messages. More...
 
TTSymbol getName () const
 Return the name of this class. More...
 
TTErr registerMessage (const TTSymbol name, TTMethod method)
 Register a message with this object. More...
 
TTErr findMessage (const TTSymbol name, TTMessage **message)
 Find a message registered with this object. More...
 
TTErr removeMessage (const TTSymbol name)
 Remove a message. More...
 
TTErr sendMessage (const TTSymbol name)
 TODO: Document this function. More...
 
TTErr registerObserverForMessage (const TTObject &observingObject, const TTSymbol messageName)
 Register an observer for a message. More...
 
TTErr registerObserverForAttribute (const TTObject &observingObject, const TTSymbol attributeName)
 Register an observer for an attribute. More...
 
TTErr registerObserverForNotifications (const TTObject &observingObject)
 Register an observer. More...
 
TTErr unregisterObserverForMessage (const TTObject &observingObject, const TTSymbol messageName)
 Unregister an observer for a message. More...
 
TTErr unregisterObserverForAttribute (const TTObject &observingObject, const TTSymbol attributeName)
 Unregister an observer for an attribute. More...
 
TTErr unregisterObserverForNotifications (const TTObject &observingObject)
 Unregister an observer for notifications. More...
 
TTErr sendNotification (const TTSymbol name, const TTValue &arguments)
 Send a notification. More...
 
TTErr logMessage (TTImmutableCString fmtstring,...)
 Log messages scoped to this object instance. More...
 
TTErr logWarning (TTImmutableCString fmtstring,...)
 Log warnings scoped to this object instance. More...
 
TTErr logError (TTImmutableCString fmtstring,...)
 Log errors scoped to this object instance. More...
 
TTErr logDebug (TTImmutableCString fmtstring,...)
 Log messages (scoped to this object instance) to output only if the basic debugging flag is enabled in the environment. More...
 
TTErr lock ()
 Lock the object in order to ensure thread-safe processing. More...
 
TTErr unlock ()
 Unlock the object when thread-safe processing is no longer required. More...
 
TTBoolean isLocked ()
 Query if the object currently is locked for thread-safe processing. More...
 
TTBoolean waitForLock ()
 If the object is locked (e.g. More...
 

Public Attributes

TTValue mObject
 the last handled object (it is possible to have an array of objects)
 
TTSymbol mFilePath
 the path to the last writen/read file
 
TTSymbol mHeaderNodeName
 the name of the header node in the xml file
 
TTSymbol mVersion
 the version number
 
TTSymbol mXmlSchemaInstance
 the URL of the schema instance location
 
TTSymbol mXmlSchemaLocation
 the URL of the xml schema location
 
TTBoolean mXmlNodeStart
 true if the Reader starts to read a Node
 
TTBoolean mXmlNodeIsEmpty
 true if the Node is empty
 
TTSymbol mXmlNodeName
 the Node name being read by the Reader
 
TTValue mXmlNodeValue
 the Node value being read by the Reader
 
- Public Attributes inherited from TTObjectBase
TTBoolean valid
 If the object isn't completely built, or is in the process of freeing, this will be false.
 
TTBoolean track
 enable the print of a log message to ease the track of reference counting mechanism on an instance More...
 

Additional Inherited Members

- Protected Member Functions inherited from TTObjectBase
 TTObjectBase (const TTValue arguments)
 Constructor. More...
 
- Protected Attributes inherited from TTObjectBase
TTList observers
 List of all objects watching this object for life-cycle and other changes.
 

Detailed Description

Write / Read mecanism.

writeAs<Format> / readFrom<Format> methods are not directly called using the classic message system. We should prefer use one of the exported TT<Format>Reader / TT<Format>Writer method which have :

  • an Object attribute : the TTObjectBase you want it reads / writes a file or
  • the data structure to pass in order to read / write depending on the selected <Format>

This allow us to use the same method to start reading / writing and even to ask to other objects to read / write recursively on the same data stucture.

Exemple :

If you want to read in Xml format you set the Object attribute as myTopObject then you call the Read message with aValueContainingFullPathToaFile. Then this method (as a friend of your TTTopObject class) will automatically create an XmlReader data structure and call ReadFromXml(aValueContainingAnXmlReader) on your myTopObject.

Because your TTTopObject class used TTLowerObject to describe himself (and have to extract their xml description from the xml file to set them up) the ReadFromXml method sets recursively the Object Attribute with aLowerObject and then calls the Read message with an empty value : this would calls the ReadFromXml(aValueContainingAnXmlReader) on your TTLowerObject.

Definition at line 48 of file TTXmlHandler.h.

Member Function Documentation

TTErr TTXmlHandler::Read ( const TTValue args,
TTValue outputValue 
)

TTXmlReader could takes absolute file path or nothing.

In the path case, TTXmlReader starts xml file reading and then calls the ReadFromXml method of mObject attribute In the second case, it directly calls the ReadFromXml method

Definition at line 178 of file TTXmlHandler.cpp.

References TTSymbol::c_str(), TTValue::clear(), fromXmlChar(), kTTErrGeneric, kTTErrNone, kTypeObject, kTypeSymbol, mFilePath, mHeaderNodeName, mObject, mXmlNodeIsEmpty, mXmlNodeName, mXmlNodeStart, mXmlNodeValue, TTValue::resize(), TTObject::send(), and TTValue::size().

+ Here is the call graph for this function:

TTErr TTXmlHandler::setObject ( const TTValue value)

Setter for mObject attribute.

Definition at line 56 of file TTXmlHandler.cpp.

References kTTErrNone, and mObject.

TTErr TTXmlHandler::Write ( const TTValue args,
TTValue outputValue 
)

TTXmlWriter could takes absolute file path or nothing.

In the path case, TTXmlWriter starts xml file writting and then calls the WriteAsXml method of mObject attribute In the second case, it directly calls the WriteAsXml method

Definition at line 63 of file TTXmlHandler.cpp.

References TTSymbol::c_str(), kTTErrGeneric, kTTErrNone, kTypeObject, kTypeSymbol, mFilePath, mHeaderNodeName, mObject, mVersion, mXmlSchemaInstance, mXmlSchemaLocation, TTValue::resize(), TTObject::send(), and TTValue::size().

+ Here is the call graph for this function:


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