Essential Tools Module User's Guide
Introduction
Overview
Features and Benefits
Examples
Products and Services Information
Class Overview
Introduction
Class Groups
Date and Time Class Group
String Processing Class Group
Virtual Stream Class Group
Collection Class Group
Internationalization Class Group
File System Classes
Miscellaneous Class Group
Abstract and Concrete Classes
Concrete Classes
Simple Classes
Template-based Collection Classes
Abstract Base Classes
Common Functionality Among Classes
Common Member Functions
Persistence Functions
Store Size Functions
Stream I/O Functions
Comparison Functions
Memory Allocation and Deallocation
Information Flow
Multithread Safety
Assigning Thread Safety Levels to Classes and Libraries
Thread Safety in the Essential Tools Module
Indexing
Version
Date and Time Classes
Introduction
Calendar and Time Formats
International Standards for Dates and Times
SourcePro’s ISO 8601 Parsers
Setting the Time Zone
RWDateTime
About Two or Four Digit Years
Member Functions
RWDateTime Sentinels
The “Invalid” Sentinel and Other Invalid Instances
The “Null” Sentinel
The Past and Future Sentinels
User-Defined Sentinels
RWTimeTuple and RWTimeTupleOffset
RWDate
RWTime (deprecated)
The Date and Time Collectable Class
String Processing Classes
Introduction
RWCString and RWWString
An Introductory Example
Lexicographic Comparisons
Substrings
Pattern Matching
Regular Expressions
The RWTRegex<T> Interface
Using Regular Expressions Efficiently
Introductory Examples Using Regular Expressions
String I/O
Iostreams
Virtual Streams
Tokenizer
Multibyte Strings
Wide Character Strings
Performance Considerations
Stream Classes
Introduction
RWvios, RWvistream, and RWvostream
Specializing Virtual Streams
Simple Virtual Streams Example
Virtual Steams Recap
RWAuditStreamBuffer
Compressed IOStreams
Buffer Size
Typedefs
Custom Compressor Interface
Collection Classes
Introduction
Collection Class Groups
Traditional Collection Classes
STL-based Collection Classes
STL Extension-based Collection Classes
RWCollectable Classes
Storage Methods of Collection Classes
Value-based and Reference-based Collections
Examples of Value-based and Reference-based Collections
A Note on Memory Management
Copying Collection Classes
Copying Reference-based Collection Classes
Copying Value-based Collection Classes
Retrieving Objects in Collections
Retrieval Methods
Iterators for Collection Classes
Traditional Essential Tools Module Iterators
Collection Class Templates
Template Overview
Template Naming Convention
Value vs. Reference Semantics in Templates
An Important Distinction
Intrusive Lists in Templates
Essential Tools Module Templates and C++ Standard Library Containers
The C++ Standard Library Containers
Commonality of Interface
Parameter Requirements
Function Objects for Comparison
More on Total Ordering
Function Objects for Hashing and Equality
Iterators in Class Templates
C++ Standard Library Iterators
Map-Based Iteration and Pairs
Iterators as Generalized Pointers
Iterators and the std() Gateway
Example Using the Essential Tools Module with the C++ Standard Library
Designing an RWCollectable Class
Bus Example Scenario
Serialization Support Macros
Exporting Symbols in a Windows Environment
The Role of RWCollectable
Bus Example Code
Creating an RWCollectable Object
Define a Default Constructor
Add RW_DECLARE_COLLECTABLE_CLASS() to your Class Declaration
Provide a Class Identifier for Your Class
Virtual Function isA()
Virtual Function newSpecies()
Function stringID()
Add Definitions for Virtual Functions
Virtual Function compareTo()
Virtual Function isEqual()
Virtual Function hash()
An Example of compareTo(), isEqual(), and hash()
Object Destruction
How to Add Polymorphic Persistence
Virtual Functions saveGuts(RWFile&) and saveGuts(RWvostream&)
Virtual Functions restoreGuts(RWFile&) and restoreGuts(RWvistream&)
Multiply-referenced Objects
Virtual Function binaryStoreSize()
Polymorphically Persisting Custom Collections
A Note on the RWFactory
Complete Listing for Class Bus
Smalltalk‑like Collection Classes
Tables of the Smalltalk-like Classes
Smalltalk-like Classes Example
Choosing a Smalltalk-like Collection Class
Bags Versus Sets Versus Hash Tables
Sequenceable Classes
Dictionaries
Virtual Functions Inherited From RWCollection
insert()
find() and Friends
remove() Functions
apply() Functions
Functions clear() and clearAndDestroy()
Other Functions Shared by All RWCollections
Class Conversions
Inserting and Removing Other Collections
Selection
Virtual Functions Inherited from RWSequenceable
A Note on How Objects are Found
Hashing
Internationalization Classes
Introduction
Localizing Alphabets with RWCString and RWWString
Challenges of Localizing Currencies, Numbers, Dates, and Times
RWLocale and RWZone
RWLocaleSnapshot and RWAnsiLocale
Dates
Time
Numbers
Currency
Persistence
Introduction
Levels of Persistence
A Note About Terminology
About the Examples in this Section
No Persistence
Simple Persistence
Two Examples of Simple Persistence
Example One: Simple Persisting Objects of Fundamental Type
Example Two: Simple Persistence and Pointers
Isomorphic Persistence
Isomorphic versus Simple Persistence
Isomorphic Persistence of an Essential Tools Module Class
Designing Your Class to Use Isomorphic Persistence
Make All Necessary Class Data Available
Add RW_DECLARE_PERSISTABLE to Your Header File
Add RW_DEFINE_PERSISTABLE to One Source File
Check for Possible Problems
Define rwSaveGuts and rwRestoreGuts
Writing rwSaveGuts and rwRestoreGuts Functions
Guidelines for Writing rwSaveGuts
Guidelines for Writing rwRestoreGuts
Isomorphic Persistence of a User-designed Class
Polymorphic Persistence
Operators
Designing your Class to Use Polymorphic Persistence
Polymorphic Persistence Example
Example One: Saving Polymorphically
Example Two: Restoring Polymorphically
Example Two Revisited
Choosing Which Persistence Operator to Use
A Few Friendly Warnings
Always Save an Object by Value Before Saving the Identical Object by Pointer
Don't Save Distinct Objects with the Same Address
Don't Use Sorted RWCollections to Store Heterogeneous RWCollectable Objects
Define All RWCollectable Objects To Restore
Error Handling and Reporting
Introduction
Error Categories
The Essential Tools Module Error Model
Internal Errors
Non-recoverable Internal Errors
Recoverable Internal Errors
External Errors
Error Reporting and Error Handling
Essential Tools Module Exception Architecture
RWxmsg
RWExternalErr
RWStreamErr
RWFileErr
RWxalloc
RWInternalErr
RWRegexErr
RWBoundsErr
Using the Error Reporting Classes to Handle Errors
When Exceptions are Supported
When Exceptions are Not Supported
The Debug Version of the Essential Tools Module
File System Classes
Introduction
RWFile
Example
RWFileStat
Construction
Example
RWDirectoryIterator
Flat Iteration Example
Recursive Iteration Example
RWFileManager
Construction
Member Functions
Example
RWBTreeOnDisk
Construction
Example
Scope Guard Classes
Introduction
RWScopeGuard
Construction
Member Functions
RWTRefHolder<T>
Why Use RWTRefHolder<T>
A Note on Pointer and Reference Parameters
Example
Advanced Topics
Introduction
Copy on Write
A More Comprehensive Example
RWStringID
Duration of Identifiers
Programming with RWStringIDs
Implementation Details of RWStringID
Automatic RWClassIDs
Implementing Virtuals Via Statics
Polymorphic Persistence
Efficiency
Identification Collisions
More on Storing and Retrieving RWCollectable Objects
Multiple Inheritance
Using Custom Allocators
Template Functions
Example
Common Mistakes
Introduction
Redefinition of Virtual Functions
Iterators
Return Type of operator>>()
Avoid Persisting Value Collections of Pointers
Include Path
Match Memory Models and Other Qualifiers
Keep Related Methods Consistent
DLL
Use the Capabilities of the Module!
Appendix A, Choosing a Collection
Introduction
Selecting an Essential Tools Module Collection Class
Using the Decision Trees
Decision 1: Determine the Collection Type
Set
Map
Vector
List
Time and Space Considerations
RWTBitVec<Size>, RWTPtrVector, and RWTValVector<T>
Singly-Linked Lists
Doubly-Linked Lists
Ordered Vectors
Sorted Vectors
Stacks and Queues
Deques
Binary Tree
(multi)map and (multi)set family
RWBTree, RWBTreeDictionary
Hash-based Collections
Ordered Hash-based Collections
Appendix B, Constants, Typedefs, Pointers, and Enumerations
Constants
Typedefs
Pointers to Functions
Enumerations
Standard Smalltalk Interface Typedefs
Threads Module User's Guide
PART I Introduction
Introduction
Welcome
Packages and Libraries
Examples
Products and Services Information
Threads Module Overview
Background
The Threads Module Packages
Threading Package
Synchronization Package
Interthread Communication Package
Smart Pointer Package
Functor Package
Execution Tracing Package
Thread-compatible Exception Package
Using the Packages Together
PART II Concurrency Packages
The Threading Package
Introducing the Threading Package
Interpackage Dependencies
Including the Header Files
Definitions
Threads and Concurrency
Threads and Memory
Thread Safety
Threading Class Hierarchies
The Runnable Class Hierarchy
Runnable Handle Classes
Runnable Body Classes
Thread Pool Class
The Attribute Class Hierarchy
The IOU Class in the Threading Package
Using Threads
Creating Threads
Introducing the Runnable
Explicitly Constructing Functors and Runnables
The Runnable Object Classes
Defining a Runnable’s Task
Functor-Based Runnables
Runnable Servers
Guard Functors
Creating Functor-based Runnables
Runnable State
Runnable Operations
Starting a Runnable
Starting Synchronous Runnables
Checking the Completion State
Starting Threaded Runnables
Distinguishing Between Synchronous and Threaded Runnables
Restarting a Threaded Runnable
Joining a Runnable
Types of Join Functions
Joining Unstarted or Inactive Runnables
Monitoring the Completion State of a Runnable
Catching and Rethrowing Exceptions
Testing After Successful Joins
Types of Rethrown Exceptions
Interrupting a Runnable
Avoiding Deadlock
Interrupting a Runnable from Another Thread
Completing the Interrupt Request
Types of requestInterrupt() Functions
Shutting Down a Continuous Process
Rendezvous Synchronization
Interrupting Threads at Startup
Canceling a Runnable
Canceling a Runnable from Another Thread
Completing a Cancellation Request
Aborting a Cancellation
Types of requestCancellation Functions
Undoing a Cancellation Request
Using Synchronization Classes to Service Cancellation Requests
Designing Your Code
Sleeping
Yielding Execution
Executing Under a Preemptive Scheduling Policy
Yielding to Lower Priority Threads
Suspending and Resuming Execution
Using the suspend() and resume() Functions
Deciding Whether Suspension Is Available
Terminating Execution
Monitoring the Execution State of a Runnable
Getting the Instantaneous Execution State of a Runnable
Monitoring Changes in Execution State
Using Wait Functions
Using Callbacks
Registering the Callback
Changing the Execution State
Reusing Functors
Removing a Callback
Execution Nesting
Starting Synchronous Runnables
Using the Nested Runnable Information
Thread Identification
The Server Classes
Constructing a Server
Starting a Server
Enqueuing Runnables on a Server
Stopping a Server
Interrupting a Server
Canceling a Server
Using Server Pool Thread Attributes
Resizing a Server Pool
Contracting a Server Pool
Creating or Expanding a Server Pool
The Thread Pool Class
Constructing a Thread Pool
Starting a Thread Pool
Enqueuing Work on a Thread Pool
Stopping a Thread Pool
Considerations
Pool Thread Attributes
Pool Expansion and Contraction
Using Threads To Build Active Objects
Using Runnables
Example
Other Solutions to the Join Problem
Using Runnable Servers
Thread Attributes
Thread Attribute Families
Scheduling Attributes
Stack Management Attributes
Thread Attribute Portability
Testing For Support
Using Feature Test Macros
“Get” Test Functions
“Set” Test Functions
“Is Set” Test Functions
Querying Attribute Values
Setting Attribute Values
Default Attribute Values
Restoring Default Attribute Values
Determining the Legal Range For An Attribute
Scheduling Attributes
Start Policy
Scheduling Contention Scope
Scheduling Inheritance Policy
Concurrency Policy
Scheduling Policy
Scheduling Priority
Scheduling Time-Slice Quantum
Stack Attributes
Allocating and Managing a Thread Stack
System-Managed Stack Attributes
User-Managed Stack Attributes
Initializing Threaded Runnables
Supplying RWThreadAttribute Instances To Threaded Runnables
Supplying RWThreadAttribute Instances At Construction
Supplying RWThreadAttribute Instances After Construction
Querying Threaded Runnables For Thread Creation Attributes
The Synchronization Package
Introducing the Synchronization Package
Interpackage Dependencies
Including the Header Files
Definitions
Synchronization Class Hierarchy
The Synchronization Class Hierarchy
The Guard Class Hierarchy
Getting Started
Creating Two or More Threads that Access the Same Resources
Using Mutexes
Using a Basic Mutex Mechanism
Using a Try-Catch Block
Using Guards
Building Monitors
Count Synchronization
Read Synchronization
The RWTMonitor<Lock> Class
Using Condition Variables
Combining the Condition Variable with Mutual Exclusion
Using the Condition Variable for Producer-Consumer Synchronization
The Synchronization Classes
The RWMutexLock Class
Avoiding a Block
Using Timed Waits
Attempting Recursive Acquisition
Acquiring Mutex Ownership
Using a Guard Class
Initializing a Mutex
Servicing Cancellation Requests
The RWFIFOMutexLock Class
The RWNullMutexLock Class
The RWTRecursiveLock Class
Identifying Threads
Using RWTRecursiveLock
The RWReadersWriterLock Class
The RWCriticalSection Class
The RWSemaphore Class
The RWCondition Class
The RWBarrier Class
The RWTMonitor Class
The Guard Classes
Using a Lock Guard
Releasing and Reacquiring a Guarded Lock
Using the Unlock Guard Class
Using the RWTTryLockGuard Template Class
Using Classes with Read-Write Synchronization Resources
The Interthread Communication Package
Introducing the Interthread Communication Package
Interpackage Dependencies
Including the Header Files
Definitions
Futures, IOUs, and Escrows
Producers, Consumers, and Blocking
Interthread Communication Class Hierarchies
The Producer-Consumer Class Hierarchy
The IOU Class Hierarchy
Using Interthread Communication
Using Producer-Consumer Queues
The RWTPCValQueue Family of Classes
Example
The IOU Classes
Testing for Empty IOU Handles
Constructing an IOU
Closing an IOU
The close() Function
The setException() Function
Example
Redeeming an IOU
Rules about Threads and IOUs
Aborting a Request
Querying the Status of an IOU Object
Using IOUs
Using IOUs Example
Closing and Redeeming an IOU
Using Active Objects
Waiting for IOUs
Asynchronous Example
Trapping IOUs with RWTIOUTrap
Waiting for Trapped IOUs
Using Timed Waits
Improving the Asynchronous Example
Another Asynchronous Example
The Producer‑Consumer Classes
Value and Pointer Classes
Guarded and Prioritized Classes
PART III Foundation Packages
The Execution Tracing Package
Introducing the Execution Tracing Package
Interpackage Dependencies
Including the Trace Header Files
Trace Severity Levels
Execution Tracing Package Architecture
The Trace Output Pipeline
Trace Class Hierarchy
Using Trace
Using Set Declaration Macros
Package Declaration Macros
Class Declaration Macros
Implications for Template Classes
Function Declaration Macros
Macros for Global Functions
Macros for Member Functions
Macros for Static Member Functions
Macros for Friend Functions
Implications for Template Classes
Assigning functionTag Names
Setting Environment Variables for Event Sets
Using Event Generation Macros
Macros for Global Functions
Macros for Member Functions
Including Variables in Trace Messages
Trace Macros Example
Using the Trace Manager
The Trace Manager Buffer
Stopping Trace
Trace Manager Environment Variables
Using Trace Clients
Using the Predefined Client
Creating User-defined Clients
Including a Timestamp in Trace Output
Including Thread IDs in Trace Output
Using Your Client
Using Trace Filters
Using the Predefined Filters
Using RWTraceLevelFilter
Using RWTraceMultiClientFilter
Chaining Multiple Filters
Creating User-defined Filters
Creating the Filter’s Body Class
Creating the Filter’s Handle Class
Instantiating Your Derived Filter
Using Package-level Tracing
Controlling Trace Output
The RW_USER_TRACE_LEVEL Macro
The RW_TRACE_LEVEL Environment Variable
The RWTraceLevelFilter Class
Combining All Filtering Methods
The Smart Pointer Package
Introducing the Smart Pointer Package
Interpackage Dependencies
Including the Smart Pointer Header Files
Smart Pointer Class Hierarchy
Template Parameter Naming Conventions
Handle-Body Classes in Class Hierarchies
Using the Handle-Body Classes
Understanding the Handle-Body Idiom
Simplifying Memory Management
Decomposing Complex Abstractions
Decoupling Interfaces from Implementations
Handle-Body Mechanics
Implementing Your Own Handles and Bodies
Defining Handle Classes that Automatically Create Bodies
Defining Handle Classes that Don’t Create Bodies
Handle-Body Example
Using the RWTSingleton Class
Using the Smart Pointer Classes
Using RWTOnlyPointer
Using RWTCountedPointer
Deriving from RWTCountingBody for Reference Counting
Using RWTCountingPointer
Providing RWTCountingPointer with a Counter
Smart Pointer Class Architecture
The Functor Package
Introducing the Functor Package
Interpackage Dependencies
Including the Functor Header Files
What Are They For?
How Do They Work?
When the Function Signature Matches the Functor Invocation
When Function Arguments Won’t Change Across Invocations
When You’re Not Using a Return Value
When the Types Don’t Quite Match
Constructing Functors
Analyzing Functor Requirements
Copying and Assigning Functors
Invoking Functors
Running Unknown Functions
Binding Functor Arguments
Binding Reference Types
Binding Member Functions
Using Placeholder Arguments
The Thread‑Compatible Exception Package
Introducing the Thread-compatible Exception Package
Interpackage Dependencies
Including the Exception Header Files
Exception Class Hierarchy
Default Exception Messages
Using the Thread-compatible Exception Classes
Creating Your Own Exception Classes
Creating Your Own Error Handler
Making Existing Exceptions Thread-Compatible
PART IV Resources
Appendix A, Acknowledgements
People
Citations
Threads Module Platform Guide
Introduction
Overview
Examples
Products and Services Information
AIX Technical Information
AIX Thread Attributes: An Overview
AIX POSIX 1003.1c Thread Attribute Support
Scheduling Attributes
Start Policy
Contention Scope
Scheduling Inheritance Policy
Concurrency Policy
Scheduling Policy
Scheduling Priority
Scheduling Time-Slice Quantum
Stack Attributes
System-Managed Stack Attributes
User-Managed Stack Attributes
HP‑UX Technical Information
HP-UX Thread Attributes: An Overview
HP-UX POSIX 1003.1c Thread Attribute Support
Scheduling Attributes
Start Policy
Contention Scope
Scheduling Inheritance Policy
Concurrency Policy
Scheduling Policy
Scheduling Priority
Scheduling Time-Slice Quantum
Stack Attributes
System-Managed Stack Attributes
User-Managed Stack Attributes
Linux Technical Information
Linux Thread Attributes: An Overview
Linux POSIX 1003.1c Thread Attribute Support
Scheduling Attributes
Start Policy
Contention Scope
Scheduling Inheritance Policy
Concurrency Policy
Scheduling Policy
Scheduling Priority
Scheduling Time-Slice Quantum
Stack Attributes
Solaris Technical Information
Solaris Threading APIs
Solaris Thread Attributes: An Overview
Solaris Threads Attribute Support
Scheduling Attributes
Start Policy
Scheduling Contention Scope
Scheduling Inheritance Policy
Concurrency Policy
Scheduling Policy
Scheduling Priority
Scheduling Time-Slice Quantum
Stack Attributes
System-Managed Stack Attributes
User-Managed Stack Attributes
Signal Handling Considerations
Windows Technical Information
Win32 Thread Attribute Support
Scheduling Attributes
Start Policy
Scheduling Contention Scope
Scheduling Inheritance Policy
Concurrency Policy
Scheduling Policy
Scheduling Priority
Scheduling Time-Slice Quantum
Stack Attributes
System-Managed Stack Attributes
User-Managed Stack Attributes
Using the Threads Module with MFC
Advanced Tools Module User’s Guide
PART I Advanced Tools Module
Introduction
Welcome
Product Packages and Libraries
Examples
Products and Services Information
Package Overview
Advanced Tools Module Packages
The Streams Package
The Serialization Package
The Types Package
Using the Packages Together
Introduction to the Handle-Body Architecture
PART II Advanced Tools Module Packages
The Streams Package
Introducing the Streams Package
The Stream Families
Memory Streams
Interpackage Dependencies
Definitions
Streams Package Architecture
The Common Framework
The Handle Classes
The Abstract Body Classes
The Extended Framework
The Memory Stream Handle Classes
The Memory Stream Abstract Body Classes
The Memory Stream Concrete Body Classes
The Common Filtered Streams
Buffered Streams
Synchronized Streams
Guarded Streams
The Streams Package Classes
The Binary Streams
The RWByteToStreambufOutputStreamImp Class
The RWByteFromStreambufInputStreamImp Class
The RWStreambufToByteOutputStream Class
The RWStreambufFromByteInputStream Class
The Narrow Character Streams
The RWCharToStreambufOutputStreamImp Class
The RWCharFromStreambufInputStreamImp Class
The RWStreambufToCharOutputStream Class
The RWStreambufFromCharInputStream Class
The Unicode Character Streams
The RWUCharToByteOutputStreamImp Class
The RWUCharFromByteInputStreamImp Class
The RWUCharToUTF8ByteOutputStreamImp Class
The RWUCharFromUTF8ByteInputStreamImp Class
The Wide Character Streams
The RWWCharToWStreambufOutputStreamImp Class
The RWWCharFromWStreambufInputStreamImp Class
The Data Streams
The RWNativeDataToByteOutputStreamImp Class
The RWNativeDataFromByteInputStreamImp Class
The RWOstreamDataToCharOutputStreamImp Class
The RWIstreamDataFromCharInputStreamImp Class
The RWvostreamToDataOutputStream Class
The RWvistreamFromDataInputStream Class
Using Streams
Introduction
The Streams Header Files
Using the Streams Package with Other Streaming Libraries
Using the Standard iostreams Library
Using Essential Tools Module Virtual Streams
Examples
Creating and Using Streams With Only One Streaming Element
Creating and Using Chains of Streaming Elements
Output Example
Input Example
Creating and Using Thread-safe Chains of Streaming Elements
Creating a Synchronized Data Output Stream
Creating and Managing Threads Using Active Objects
Creating and Sharing a Synchronized Data Output Stream Among Several Active Objects
Active Objects and Data Input Streams
Creating and Sharing a Synchronized Data Input Stream Among Several Active Objects
Creating and Using Stream Adapter Classes
The iostreams Adapter Classes
Virtual Streams Adapter Classes in the Essential Tools Module
Architecture of the Adapter Classes
Using the Adapter Classes for Output
Using the Adapter Classes for Input
Error Handling
Handling Errors Using the Stream Status Functions
Streams Package Exception Classes
The Serialization Package
Introducing the Serialization Package
Classes Supported by the Serialization Package
Object Serialization for Saving Program State
Object Serialization and Distributed Applications
Interpackage Dependencies
Object Serialization Concepts
Writing and Reading the Object State
Type Information (Polymorphism)
Object Identity (Isomorphism)
Intrusive and External Serialization
Symmetry of Object Input and Output
Annotated Streams and Embedded Schemas
Supported Streaming Formats
The Compact Object Stream Format
Object Streams With Data Streams
Object Streams With Virtual Streams
Object Streams With Collectable Objects
Serialization Package Architecture
How Does Serialization Work?
Relationship to the Streams Package
Handle-Body Architecture
Serialization Package Classes
Using Object Serialization
Introduction
Including the Header Files
Getting Started
Serialization Requirements
Simple Examples
Declaring the Streaming Operators
Defining the streamContents() Function
Streaming the Serialized Object
Writing to and Reading from Compact Object Streams
Writing to and Reading from Compact Object Streams With Virtual Streams
Using the Stream Contents Macros
Header File Macros
Source File Macros
Macros for External Serialization
Macro Summary
Basic Examples
Saving and Restoring an Object by Value
First Change
Second Change
Saving and Restoring an Object by Pointer
First Change
Second Change
Third Change
A Caution on Using Streaming Pointers
Associations with Other Objects
Data Member is an Object
Data Member is a Pointer to an Object
Data Member is a Value-based or Pointer-based Collection
Templates
Default Constructors
External Serialization
External Serialization of Templates and Nested Classes
Advanced Examples
Using Object Streams with RWCollectable-Derived Objects
Making RWCollectable Objects That Are Also Serializable
Writing Custom streamContents() Functions
Controlling the Scope of Object Reference Resolution
Streaming Out Multiple Objects
Streaming Multiple Objects into One Document
The Types Package
Introducing the Types Package
International Features of the Advanced Tools Module
Introduction
An Introduction to Unicode
Determining your Character Encoding Needs
The Advanced Tools Module’s Character Encoding Requirements
When You Do Not Need the Internationalization Module
When You Do Need the Internationalization Module
Choosing the Appropriate String Class
International Features of the Streams Package
Using the Streams Package without the Internationalization Module
Unicode-Based Stream Classes
Unicode Converter Classes
Example
Using the Streams Package with the Internationalization Module
International Features of the Serial Package
Using the Serial Package without the Internationalization Module
Compact Object Streams
Using the Serial Package with the Internationalization Module
Converting from a Local Encoding to UTF-16
Converting from UTF-16 to a Local Encoding
Internationalization Module User’s Guide
Introduction
Welcome
Product Overview
Products and Services Information
Concepts
Overview
Basic Terminology
Representing Text in Computers
Abstract Characters
Character Sets
Coded Character Sets
Character Encoding Forms
Character Encoding Schemes
Character Map
The Unicode Standard
Unicode Coded Character Set
Unicode Character Encoding Forms
Unicode Character Encoding Schemes
The ISO-10646 Standard
Multilingual Text in C++
Character and String Processing
Overview
Representing Characters
Character Properties
Valid Code Points
Surrogate Pairs
Character Blocks
Character Scripts
General Character Categories
Character Names
Character Directionality
Character Width
Combining Classes
Character Case
Character Mirroring
Numeric Values
Representing Strings
RWBasicUString and RWCString
Memory Management in RWBasicUString
Creating and Using Deallocators
Null Termination
RWUString and RWBasicUString
Creating an RWUString
Converting to Unicode
Converting from Unicode
Escape Sequences
String Length
Comparing Strings
Accessing SubStrings
Iterating Over Strings
Accessing Code Points with Iterators
Modifying Code Points with Iterators
Conversion
Overview
Character Encodings
Listing Encoding Names
Listing Encoding Name Aliases
Listing Encoding Name Standards
Explicit Conversions
Creating Converters
Explicitly Converting to Unicode
Explicitly Converting from Unicode
Conversion Errors
Saving and Restoring the Error Response State
Resetting Converters
Implicit Conversions
The Conversion Context Stacks
Creating Conversion Contexts
Implicitly Converting to Unicode
Implicitly Converting from Unicode
Bidirectional Conversions
Normalization
Introduction
Character Equivalence
Canonical Equivalence
Compatibility Equivalence
Normalization Forms
Using RWUNormalizer
Normalizing Strings
Detecting the Normalization Form of a String
Collation
Overview
Locale-Sensitive String Comparison
Customizing a Collator
Finding Collation Elements
Forming Collation Weights
Case Order
Punctuation Shifting
Examining Collation Levels
Collation Strength
Case Level
French Collation
Using Collation Keys
Using RWUCollationKey
Sorting Strings with Collation Keys
Boundary Analysis and Tokenizing
Overview
Boundary Analysis
Creating an RWBreakSearch
Using an RWBreakSearch
Direct Queries
Tokenizing
Creating an RWUTokenizer
Specifying Delimiters
Extracting Tokens
Using the Function Call Operator
Using the nextToken() Method
Pattern Matching
Overview
Lexical String Searching
Locale-Sensitive String Searching
Creating an RWUStringSearch
Iteration-Style Searches
Direct Queries
Search and Replace
Regular Expression String Searching
A Note on Support by UTR Version Number
POSIX Extended Regular Expression Syntax
Unicode Regular Expressions
Basic Unicode Regular Expression Extensions
Tailored Unicode Regular Expression Extensions
How to Use Tailored Regular Expressions
How to Create an RWURegularExpression
Searching for Pattern Matches
Manipulating Match Results
Replacing Pattern Matches
Iterating Over Pattern Matches
Error Handling and Debugging
Overview
Exceptions
Compiling in Debug Mode
Locales and Localized Resources
Overview
Named Locales
Listing Language Codes
Listing Country Codes
Listing Available Locales
Locale Objects
Creating Locales
Using Locales
The Default Locale
Localized Resources
The Resource Hierarchy
Defining Resource Bundles
Compiling Resource Bundles
Packaging Resource Bundles
Retrieving a Resource Bundle
Accessing a Resource
Advanced Topics
Overview
Working in a Multithreaded Environment
Accessing ICU Constructs
Appendix A, Glossary
XML Streams Module User’s Guide
Introduction
Welcome
Product Features
The XML Streams Module Package
Dependencies
Basic Software Dependencies
Optional Software Dependencies
Schema Dependencies
Products and Services Information
Using XML Streams
Overview
Types of Streams
When to Use XML Streams
A Simple XML Streams Use Case
Introduction
Use Case Description
Serialization Requirements
Examining the Code
Declaring the Basic Classes
Making the Basic Classes Serializable
Header File Changes
Source File Changes
Persisting the Serializable Objects
Enhanced Streams
Introduction
The Difference Between Enhanced Streams and Basic Streams
Comparison Example of Basic XML Streams with Enhanced XML Streams
Example
Example Discussion
Serializing the book Object to a File
Restoring the book Object
Examining the XML Output
Performing Transformations
Introduction
Character-based C++ Transformations
Element-based Transformations
Transforming your XML Documents
Overview of the Transformation Process
Adding Serialization Support
Serializing the book Object to a File
For a Character-based C++ Transformation
For an Element-based C++ Transformation
Restoring the book Object
For a Character-based C++ Transformation
For an Element-based C++ Transformation
Examining the XML Output
For a Character-based C++ Transformation
For an Element-based C++ Transformation
Discussion
XSLT Transformations
Introduction
Your XSLT Processor
The XSLT Transformation Procedure
Creating the Objects and Streams
Defining a Transformation Object
Defining a Character Transformation Stream
Defining an XSLT Transformation Stream
Defining the XSLT Transformation Input Stream
Defining the XSLT Transformation Output Stream
Performing the Transformation
Serializing the book Object to a File
Restoring the book Object
Examining the XML Output
International Features of the XML Streams Module
Introduction
An Introduction to Unicode
Determining your Character Encoding Needs
Deciding if You Need the Internationalization Module
When You Do Not Need the Internationalization Module
When You Do Need the Internationalization Module
The XML Streams Package Character Encoding Requirements
Narrow Character Interfaces
Wide and Unicode Character Interfaces
Using the XML Streams Package without the Internationalization Module
Choosing the Appropriate String Class Interface
Converting to and from UTF-8 and UTF-16
Converting RWCStrings and RWBasicUStrings
Converting RWWStrings to and from UTF-8
Using the XML Streams Package with the Internationalization Module
Output Stream Example
Input Stream Example
Essential Tools Module User's Guide
Input Stream Example