summaryrefslogtreecommitdiff
path: root/docs/man/man3/Extensible.3
blob: 2018cd12675617aec54201c4d03effba313f9f9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
.TH "Extensible" 3 "25 May 2005" "InspIRCd" \" -*- nroff -*-
.ad l
.nh
.SH NAME
Extensible \- class Extensible is the parent class of many classes such as userrec and chanrec.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <base.h>\fP
.PP
Inherits \fBclassbase\fP.
.PP
Inherited by \fBchanrec\fP, \fBcommand_t\fP, \fBconnection\fP, and \fBircd_connector\fP.
.PP
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "bool \fBExtend\fP (std::string key, char *p)"
.br
.RI "\fIExtend an Extensible class. \fP"
.ti -1c
.RI "bool \fBShrink\fP (std::string key)"
.br
.RI "\fIShrink an Extensible class. \fP"
.ti -1c
.RI "char * \fBGetExt\fP (std::string key)"
.br
.RI "\fIGet an extension item. \fP"
.in -1c
.SS "Private Attributes"

.in +1c
.ti -1c
.RI "std::map< std::string, char * > \fBExtension_Items\fP"
.br
.RI "\fIPrivate data store. \fP"
.in -1c
.SH "Detailed Description"
.PP 
class Extensible is the parent class of many classes such as userrec and chanrec. 

class Extensible implements a system which allows modules to 'extend' the class by attaching data within a map associated with the object. In this way modules can store their own custom information within user objects, channel objects and server objects, without breaking other modules (this is more sensible than using a flags variable, and each module defining bits within the flag as 'theirs' as it is less prone to conflict and supports arbitary data storage). 
.PP
Definition at line 50 of file base.h.
.SH "Member Function Documentation"
.PP 
.SS "bool Extensible::Extend (std::string key, char * p)"
.PP
Extend an Extensible class. \fBParameters:\fP
.RS 4
\fIkey\fP The key parameter is an arbitary string which identifies the extension data 
.br
\fIp\fP This parameter is a pointer to any data you wish to associate with the object
.RE
.PP
You must provide a key to store the data as, and a void* to the data (typedef VoidPointer) The data will be inserted into the map. If the data already exists, you may not insert it twice, \fBExtensible::Extend\fP will return false in this case.
.PP
\fBReturns:\fP
.RS 4
Returns true on success, false if otherwise
.RE
.PP

.SS "char* Extensible::GetExt (std::string key)"
.PP
Get an extension item. \fBParameters:\fP
.RS 4
\fIkey\fP The key parameter is an arbitary string which identifies the extension data
.RE
.PP
\fBReturns:\fP
.RS 4
If you provide a non-existent key name, the function returns NULL, otherwise a pointer to the item referenced by the key is returned.
.RE
.PP

.SS "bool Extensible::Shrink (std::string key)"
.PP
Shrink an Extensible class. \fBParameters:\fP
.RS 4
\fIkey\fP The key parameter is an arbitary string which identifies the extension data
.RE
.PP
You must provide a key name. The given key name will be removed from the classes data. If you provide a nonexistent key (case is important) then the function will return false.
.PP
\fBReturns:\fP
.RS 4
Returns true on success.
.RE
.PP

.SH "Member Data Documentation"
.PP 
.SS "std::map<std::string,char*> \fBExtensible::Extension_Items\fP\fC [private]\fP"
.PP
Private data store. Definition at line 54 of file base.h.

.SH "Author"
.PP 
Generated automatically by Doxygen for InspIRCd from the source code.