Jamoma API  0.6.0.a19
TTTextHandler.h File Reference

TTObjectBase to handle text file reading and writing to be able to store / recall state of an object into/from text files. More...

+ Include dependency graph for TTTextHandler.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Detailed Description

TTObjectBase to handle text file reading and writing to be able to store / recall state of an object into/from text files.

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 / write recursively on the same data stucture.

Example :

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.

Authors
Théo de la Hogue

Definition in file TTTextHandler.h.