An Introduction to Design Patterns in C++ with Qt 4


Chapter 1. C++ Introduction 5
Basic concepts
1.2 A Brief History of C++
1.3 Setup: Open-Source Platforms
1.3.1 *nix
1.3.2 Downloading from Source
1.4 Setup: Win32
1.5 C++ First Example
Comments
#include
The Using Namespace Directive
Declaring and Initializing Variables
Selection
Iteration
1.6 Input and Output
1.7 Identifiers, Types, and Literals
1.8 C++ Simple Types
1.8.1 main and Command Line Arguments
1.8.2 Arithmetic
1.9 C++ Standard Library Strings
1.10 Streams
1.11 The Keyword const
1.12 Pointers and Memory Access
1.12.1 The Unary Operators & and *
1.12.2 Operators new and delete
1.13 const* and *const
1.14 Reference Variables
Introduction to classes and objects
2.1 Structs
2.2 Class Definitions
2.3 Member Access Specifiers
2.4 Encapsulation
2.5 Introduction to UML
2.5.1 UML Relationships
2.6 Friends of a Class
2.7 Constructors
2.8 Subobjects
2.9 Destructors
2.10 The Keyword static
Block-Scope static
static Initialization
2.11 Copy Constructors and Assignment Operators
2.12 Conversions
2.13 const Member Functions
Qt development environment
3.1 Example Project: Using QApplication and QLabel
3.2 Makefile, qmake, and Project Files
3.2.1 #include: Finding Header Files
3.2.2 The make Command
3.2.3 Cleaning Up Files
3.3 Getting Help Online
3.4 Style Guidelines and Naming Conventions
3.5 The Qt Core Module
3.6 Streams and Dates
Ways of grouping things together in lists and how to iterate through them.
4.1 Introduction to Containers
4.2 Iterators
4.2.1 QStringList and Iteration
4.3 Relationships
Functions
5.1 Function Declarations
5.2 Overloading Functions
Function Call Resolution
5.3 Optional Arguments
5.4 Operator Overloading
5.5 Parameter Passing by Value
5.6 Parameter Passing by Reference
5.7 References to const
5.8 Function Return Values
5.9 Returning References from Functions
5.10 Overloading on const-ness
5.11 Inline Functions
5.12 Inlining versus Macro Expansion
Inheritance relationships between C++ classes
6.1 Simple Derivation
Member Initialization for Base Classes
Extending
6.2 Derivation with Polymorphism
6.3 Derivation from an Abstract Base Class
Back to Programming
6.4 Inheritance Design
6.5 Overloading, Hiding, and Overriding
Function Hiding
6.6 Constructors, Destructors, and Copy Assignment Operators
Constructors
Order of Initialization
Copy Assignment Operators
Copy Constructors
Destructors
6.7 Processing Command-Line Arguments
6.7.1 Derivation and ArgumentList
P A R T I I
Chapter 7. Libraries 169
Libraries - how they are built, reused, and designed.
7.2 Reusing Other Libraries
7.3 Organizing Libraries: Dependency Management
7.3.1 Installing Libraries
7.4 Installing Libraries: A Lab Exercise
7.4.1 Fixing the Linker Path
7.5 Frameworks and Components
Design patterns
8.1 Iteration and the Visitor Pattern
8.1.1 Directories and Files: QDir and QFileInfo
8.1.2 Visitor Pattern
8.1.3 Customizing the Visitor Using Inheritance
9.1 QObject’s Child Managment
9.2 Composite Pattern: Parents and Children
9.2.1 Finding Children
9.3 QApplication and the Event Loop
9.3.1 Layouts: A First Look
9.3.2 Connecting to Slots
9.3.3 Signals and Slots
9.4 Q_OBJECT and moc: A Checklist
9.5 Values and Objects
9.6 tr( ) and Internationalization
Qt container classes
10.1 Generics and Templates
10.1.1 Function Templates
10.1.2 Class Templates
10.2 Containers
10.3 Managed Containers, Composites, and Aggregates
10.4 Implicitly Shared Classes
10.5 Generics, Algorithms, and Operators
10.6 Serializer Pattern
10.6.1 Benefits of the Serializer
10.7 Sorted Map Example
Widgets
11.1 Widget Categories
11.2 QMainWindow and QSettings
11.2.1 QSettings: Saving and Restoring Application State
11.3 Dialogs
11.3.1 Input Dialogs and Widgets
11.4 Images and Resources
11.5 Layout of Widgets
11.5.1 Spacing, Stretching, and Struts
11.5.2 Moving Widgets across Layouts
11.6 QActions, QMenus, and QMenuBars
11.7 QActions, QToolbars, and QActionGroups
11.7.1 The Command Pattern
11.8 Regions and QDockWidgets
11.9 Views of a QStringList
QProcess and QThread
12.1 QProcess and Process Control
12.1.1 Processes and Environment
12.1.2 Qonsole: Writing an Xterm in Qt
12.1.3 Qonsole with Keyboard Events
12.2 Threads and QThread
12.2.1 QPixmap and QThread Animation Example: Movie Player
12.2.2 Movie Player with QTimer
12.2.3 Multiple Threads, Queues, and Loggers Example: Giant
12.2.4 Thread Safety and QObjects
12.3 Summary: QProcess and QThread
Validation of input data
13.1 Validators
13.2 Regular Expressions
13.2.1 Regular Expression Syntax
13.2.2 Regular Expressions: Phone Number Recognition
13.3 Regular Expression Validation
Parsing XML data
14.1 The Qt XML Module
14.2 Event-Driven Parsing
14.3 XML, Tree Structures, and DOM
14.3.1 Visitor Pattern: DOM Tree Walking
14.3.2 Generation of XML with DOM
15.1 Anti-patterns
15.2 QMetaObject: The MetaObject Pattern
15.3 Type Identification and qobject_cast
15.4 Q_PROPERTY Macro: Describing QObject Properties
15.5 QVariant Class: Accessing Properties
15.6 DataObject: An Extension of QObject
15.7 Property Containers: PropsMap
Design patterns
16.1 Creational Patterns
16.1.1 Abstract Factory
16.1.2 Abstract Factories and Libraries
16.1.3 qApp and Singleton Pattern
16.1.4 Creation Rules and friend Functions
16.1.5 Benefits of Using Factories
16.2 Serializer Pattern Revisited
16.2.1 Exporting to XML
16.2.2 Importing Objects with an Abstract Factory
16.3 The Façade Pattern
16.3.1 Functional Façade
16.3.2 Smart Pointers: auto_ptr
16.3.3 FileTagger: Façade Example
17.1 M-V-C: What about the Controller?
17.2 Dynamic Form Models
17.2.1 Form Models
17.2.2 Form Views
17.2.3 Unforseen Types
17.2.4 Controlling Actions
17.2.5 DataObject Form Model
17.3 Qt 4 Models and Views
Views
Model Index
17.4 Table Models
But How Does It Work?
17.5 Tree Models
17.5.1 Extended Tree Widget Items
18.1 Introduction to MySQL
Connecting to MySQL from Qt
Defining a Table
Inserting Rows
18.2 Queries and Result Sets
18.3 Database Models
P A R T I I I
Chapter 19. Types and Expressions 437
C++’s strong typing system
Operator Characteristics
19.2 Evaluation of Logical Expressions
19.3 Enumerations
19.4 Signed and Unsigned Integral Types
8-Bit Integer Example
19.5 Standard Expression Conversions
Automatic Expression Conversion Rules for x op y
19.6 Explicit Conversions
19.7 Safer Typecasting Using ANSI C++ Typecasts
19.7.1 static_cast and const_cast
19.7.2 reinterpret_cast
19.7.3 Why Not Use C-style Casts?
19.8 Run-Time Type Identification (RTTI)
19.8.1 typeid Operator
19.9 Member Selection Operators
Identifiers
20.1 Declarations and Definitions
20.2 Identifier Scope
20.2.1 Default Scope of Identifiers: A Summary
20.2.2 File Scope versus Block Scope and operator::
20.3 Storage Class
20.3.1 Globals, statics, and QObject
20.4 Namespaces
20.4.1 Anonymous Namespaces
20.4.2 Open Namespaces
20.4.3 Namespace, static Objects and extern
21.1 Statements
21.2 Selection Statements
21.3 Iteration
21.4 Exceptions
21.4.1 Exception Handling
21.4.2 Exception Types
21.4.3 throwing Things Around
21.4.4 try and catch
21.4.5 More about throw
21.4.6 Rethrown Exceptions
21.4.7 Exception Expressions
22.1 Pointer Pathology
22.2 Further Pointer Pathology with Heap Memory
22.3 Memory Access Summary
22.4 Introduction to Arrays
22.5 Pointer Arithmetic
22.6 Arrays, Functions, and Return Values
22.7 Different Kinds of Arrays
22.8 Valid Pointer Operations
Assignment
Arithmetic
Comparison
Indirection
Indexing
22.9 What Happens If new Fails?
22.9.1 set_new_handler(): Another Approach to new Failures
22.9.2 Using set_new_handler and bad_alloc
22.9.3 Checking for null
22.10 Chapter Summary
Constructors, destructors, and copy assignment operators
23.1 Virtual Pointers and Virtual Tables
23.2 Polymorphism and virtual Destructors
23.3 Multiple Inheritance
23.3.1 Multiple Inheritance Syntax
23.3.2 Multiple Inheritance with Abstract Interfaces
23.3.3 Resolving Multiple Inheritance Conflicts
23.4 public, protected, and private Derivation
Variable length argument lists
24.1 Functions with Variable-Length Argument Lists
24.2 Resource Sharing
P A R T I V
Chapter 25. MP3 Jukebox Assignments 551
MP3 playlist generator and database manager
The Assignment
25.2 Visitor: Generating Playlists
25.3 Preference: An Enumerated Type
The Assignment
25.4 Reusing id3lib
The Assignment
25.5 PlayListModel Serialization
25.6 Testing Mp3File Related Classes
25.7 Simple Queries and Filters
25.8 Mp3PlayerView
25.9 Models and Views: PlayList
25.10 Source Selector
25.11 Persistent Settings
25.12 Edit Form View for FileTagger
25.13 Database View
P A R T V
Appendix A. C++ Reserved Keywords 575
Appendix C: The Development Environment
C.1 The Preprocessor: For #including Files
C.2 Understanding the Linker
C.3 Debugging
C.4 Qt Assistant and Designer
C.5 Open-Source IDEs and Development Tools
Bibliography
C++ References
Qt References
OOP References
Docbook References
Miscellaneous References
Index
Symbols and Numbers
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Weiter >