OWLNext    7.0
Borland's Object Windows Library for the modern age
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
streambl.h
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// Borland Class Library
3// Copyright (c) 1992, 1996 by Borland International, All Rights Reserved
4//
5/// \file
6/// Class definitions for object streaming
7/// \code
8///
9/// +----------------+ +-------------+
10/// |TStreamableTypes| |ObjectBuilder|
11/// +--+----------+--+ +-------------+
12/// |class name| | BUILDER |
13/// +----------+ | delta |
14/// | +-------------+
15/// | |
16/// | /\ .
17/// | +--------
18/// | |
19/// | |
20/// +----------------+
21/// |TStreamableClass|
22/// +----------------+
23/// | Module ID |
24/// +----------------+
25/// \endcode
26//----------------------------------------------------------------------------
27
28#if !defined(OWL_STREAMBL_H)
29#define OWL_STREAMBL_H
30
31#include <owl/private/defs.h>
32#if defined(BI_HAS_PRAGMA_ONCE)
33# pragma once
34#endif
35
36#if !defined(_INC_STRING)
37# include <string.h>
38#endif
39
40#include <owl/private/wsysinc.h>
41
42#if defined(_FASTTHIS)
43# define _OWLFASTTHIS __fastthis
44#else
45# define _OWLFASTTHIS
46#endif
47
48namespace owl {
49
50#include <owl/preclass.h>
51
52typedef unsigned ModuleId;
53inline ModuleId GetModuleId() { return 1; }
54
57
58typedef TStreamer* (* BUILDER)( TStreamableBase * );
59
61
62 enum { NoDelta = -1 };
63
64 ObjectBuilder( BUILDER b, int d ) : Builder( b ), Delta( d ) {}
65
67 int Delta;
68
69};
70
71#define __DELTA( d ) (FP_OFF((TStreamable *)(d *)1)-1)
72
73/// TStreamableClass is used by the private database class and pstream in the
74/// registration of streamable classes.
76 public:
77
79 BUILDER b,
80 int d = NoDelta,
82
84
85 int operator == ( const TStreamableClass& n ) const
86 {
87 if( strcmp( ObjectId, n.ObjectId ) != 0 )
88 return 0;
89 else
90 return (ModId == 0 || n.ModId == 0 || ModId == n.ModId);
91 }
92
93 int operator < ( const TStreamableClass& n ) const
94 {
95 int res = strcmp( ObjectId, n.ObjectId );
96 if( res < 0 )
97 return 1;
98 else if( res > 0 )
99 return 0;
100 else if( ModId == 0 || n.ModId == 0 || ModId == n.ModId )
101 return 0;
102 else
103 return ModId < n.ModId;
104 }
105
106 private:
107
108 const char* ObjectId;
109 ModuleId ModId;
110
111};
112class TStreamableClassArray;
114 public:
117
118 void RegisterType( ModuleId id, TStreamableClass& );
119 void UnRegisterType( ModuleId id, TStreamableClass& );
120 const ObjectBuilder * Lookup( ModuleId id, LPCSTR name ) const;
121
122 private:
123 TStreamableClassArray* Types;
124};
125
126
127#include <owl/posclass.h>
128
129} // OWL namespace
130
131
132#endif // OWL_STREAMBLE_H
Classes that inherit from TStreamableBase are known as streamable classes (their objects can be writt...
Definition objstrm.h:108
TStreamableClass is used by the private database class and pstream in the registration of streamable ...
Definition streambl.h:75
Provides a base class for all streamable objects.
Definition objstrm.h:130
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
ModuleId GetModuleId()
Definition streambl.h:53
unsigned ModuleId
Definition streambl.h:52
TStreamer *(* BUILDER)(TStreamableBase *)
Definition streambl.h:58
#define _RTTI
Definition defs.h:223
#define _OWLCLASS
Definition defs.h:338
#define _OWLFASTTHIS
Definition streambl.h:45
Definition of class TString, a flexible universal string envelope class.
ObjectBuilder(BUILDER b, int d)
Definition streambl.h:64