PlayListModel Serialization

  • Streams and files (Section 1.10)
  • Serializer pattern (Section 10.6)


Most MP3 players load/save their playlists from/to a file with an M3U extension. There is simple M3U and extended M3U (EXTM3U). Simple M3U is just a list of filenames separated by newlines. Extended M3U contains extra information following a # sign on the preceding line. If you use this format, your program will immediately work with the most popular MP3 players.

Serialization, as we discussed in Section 10.6, is the process of taking an object and expressing its state information in a format that allows it to be sent across a network or saved to a storage device such as a file or a database. Deserialization is the process of reconstructing the object from the serialized state information to its original state.

Now that we have a simple data object, we want to be able to serialize and deserialize it. Write two classes, PlayListReader and PlayListWriter for reading/ writing playlist data.

Figure 25.5. Serialization classes for PlayListModel




Part I: Introduction to C++ and Qt 4

C++ Introduction

Classes

Introduction to Qt

Lists

Functions

Inheritance and Polymorphism

Part II: Higher-Level Programming

Libraries

Introduction to Design Patterns

QObject

Generics and Containers

Qt GUI Widgets

Concurrency

Validation and Regular Expressions

Parsing XML

Meta Objects, Properties, and Reflective Programming

More Design Patterns

Models and Views

Qt SQL Classes

Part III: C++ Language Reference

Types and Expressions

Scope and Storage Class

Statements and Control Structures

Memory Access

Chapter Summary

Inheritance in Detail

Miscellaneous Topics

Part IV: Programming Assignments

MP3 Jukebox Assignments

Part V: Appendices

MP3 Jukebox Assignments

Bibliography

MP3 Jukebox Assignments



An Introduction to Design Patterns in C++ with Qt 4
An Introduction to Design Patterns in C++ with Qt 4
ISBN: 0131879057
EAN: 2147483647
Year: 2004
Pages: 268

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net