OWLNext
7.0
Borland's Object Windows Library for the modern age
Toggle main menu visibility
Loading...
Searching...
No Matches
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
48
namespace
owl
{
49
50
#include <
owl/preclass.h
>
51
52
typedef
unsigned
ModuleId
;
53
inline
ModuleId
GetModuleId
() {
return
1; }
54
55
class
_OWLCLASS
_OWLFASTTHIS
_RTTI
TStreamer
;
56
class
_OWLCLASS
_OWLFASTTHIS
_RTTI
TStreamableBase
;
57
58
typedef
TStreamer
* (* BUILDER)(
TStreamableBase
* );
59
60
struct
_OWLCLASS
ObjectBuilder
{
61
62
enum
{
NoDelta
= -1 };
63
64
ObjectBuilder
(
BUILDER
b,
int
d ) :
Builder
( b ),
Delta
( d ) {}
65
66
BUILDER
Builder
;
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.
75
class
_OWLCLASS
TStreamableClass
:
public
ObjectBuilder
{
76
public
:
77
78
TStreamableClass
( LPCSTR n,
79
BUILDER
b,
80
int
d =
NoDelta
,
81
ModuleId
mid =
GetModuleId
() );
82
83
~TStreamableClass
();
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
};
112
class
TStreamableClassArray;
113
class
_OWLCLASS
TStreamableTypes
{
114
public
:
115
TStreamableTypes
();
116
~TStreamableTypes
();
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
owl::TStreamableBase
Classes that inherit from TStreamableBase are known as streamable classes (their objects can be writt...
Definition
objstrm.h:108
owl::TStreamableClass
TStreamableClass is used by the private database class and pstream in the registration of streamable ...
Definition
streambl.h:75
owl::TStreamableClass::TStreamableClass
TStreamableClass(LPCSTR n, BUILDER b, int d=NoDelta, ModuleId mid=GetModuleId())
Creates a TStreamableClass object with the given name (n) and the given builder function (b),...
Definition
objstrm.cpp:184
owl::TStreamableTypes::TStreamableTypes
TStreamableTypes()
Definition
objstrm.cpp:205
owl::TStreamableTypes::Lookup
const ObjectBuilder * Lookup(ModuleId id, LPCSTR name) const
Definition
objstrm.cpp:231
owl::TStreamableTypes::UnRegisterType
void UnRegisterType(ModuleId id, TStreamableClass &)
Definition
objstrm.cpp:224
owl::TStreamableTypes::RegisterType
void RegisterType(ModuleId id, TStreamableClass &)
Definition
objstrm.cpp:217
owl::TStreamer
Provides a base class for all streamable objects.
Definition
objstrm.h:130
owl
Object Windows Library (OWLNext Core).
Definition
animctrl.h:22
owl::BUILDER
TStreamer *(*) BUILDER(TStreamableBase *)
Definition
streambl.h:58
owl::GetModuleId
ModuleId GetModuleId()
Definition
streambl.h:53
owl::ModuleId
unsigned ModuleId
Definition
streambl.h:52
defs.h
_RTTI
#define _RTTI
Definition
defs.h:223
_OWLCLASS
#define _OWLCLASS
Definition
defs.h:338
posclass.h
preclass.h
wsysinc.h
_OWLFASTTHIS
#define _OWLFASTTHIS
Definition
streambl.h:45
string.h
Definition of class TString, a flexible universal string envelope class.
owl::ObjectBuilder
Definition
streambl.h:60
owl::ObjectBuilder::NoDelta
@ NoDelta
Definition
streambl.h:62
owl::ObjectBuilder::ObjectBuilder
ObjectBuilder(BUILDER b, int d)
Definition
streambl.h:64
owl::ObjectBuilder::Builder
BUILDER Builder
Definition
streambl.h:66
owl::ObjectBuilder::Delta
int Delta
Definition
streambl.h:67
include
owl
streambl.h
Generated by
1.18.0