Complete the implementation of the Address, Customer
, and CustomerList
classes.
Apply the ideas that we discussed in Section 7.4.1 to write a CustomerWriter
class. Make sure that you use the Q_PROPERTY features of Customer
and Address
so that your CustomerWriter
class will not need to be rewritten if you change the implementation of Customer.
Keep in mind that Address
objects are stored as children of Customer
objects. Here is one output format that you might consider using:
Customer {
Id=83438
DateEstablished=2004-02-01
Type=Corporate
objectName=Bilbo Baggins
UsAddress {
Line1=52 Shire Road
Line2=Suite 6
City=Brighton
Phone=1234567890
State=MA
Zip=02201
addressName=home
}
}
Another possibility arises if you make use of the Dataobject::toString()
function.
Write a CustomerReader
class that creates all its new objects by reusing the CustomerFactory
class that we supplied.
Write a CustomerListWriter
and a CustomerListReader
class that serialize and deserialize lists of Customer
objects. How much of the CustomerWriter/Reader
code can you reuse here?
Write client code to test your classes.
[ fromfile: factory.xml id: x-factorybenefits ]
Generated: 2012-03-02 | © 2012 Alan Ezust and Paul Ezust. |