OPAL
Version 3.14.3
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
safestrings.h
Go to the documentation of this file.
1
/*
2
*
3
*
4
* Inter Asterisk Exchange 2
5
*
6
* Provide string list handling in a thread safe fashion.
7
*
8
* Open Phone Abstraction Library (OPAL)
9
*
10
* Copyright (c) 2005 Indranet Technologies Ltd.
11
*
12
* The contents of this file are subject to the Mozilla Public License
13
* Version 1.0 (the "License"); you may not use this file except in
14
* compliance with the License. You may obtain a copy of the License at
15
* http://www.mozilla.org/MPL/
16
*
17
* Software distributed under the License is distributed on an "AS IS"
18
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
19
* the License for the specific language governing rights and limitations
20
* under the License.
21
*
22
* The Original Code is Open Phone Abstraction Library.
23
*
24
* The Initial Developer of the Original Code is Indranet Technologies Ltd.
25
*
26
* The author of this code is Derek J Smithies
27
*
28
* $Revision: 29536 $
29
* $Author: rjongbloed $
30
* $Date: 2013-04-19 18:55:15 +1000 (Fri, 19 Apr 2013) $
31
*/
32
33
#ifndef OPAL_IAX2_SAFESTRINGS_H
34
#define OPAL_IAX2_SAFESTRINGS_H
35
36
#ifndef _PTLIB_H
37
#include <ptlib.h>
38
#endif
39
40
#include <
opal_config.h
>
41
42
#if OPAL_IAX2
43
44
#ifdef P_USE_PRAGMA
45
#pragma interface
46
#endif
47
48
53
class
SafeStrings
:
public
PObject
54
{
55
PCLASSINFO(
SafeStrings
, PObject);
56
public
:
61
SafeStrings
();
62
64
~SafeStrings
();
66
69
71
void
AppendString
(
const
PString & newString,
72
PBoolean splitString =
false
73
);
74
76
void
AppendString
(
const
char
*newString,
77
PBoolean splitString =
false
78
) { PString s(newString);
AppendString
(s, splitString); }
79
81
PBoolean
GetNextString
(PString & nextString
82
);
83
85
PBoolean
IsEmpty
();
86
88
PBoolean
StringsAvailable
() {
return
!
IsEmpty
(); }
89
91
PString
GetFirstDeleteAll
();
92
94
void
GetAllDeleteAll
(PStringArray & res);
95
97
protected
:
99
PMutex
accessMutex
;
100
102
PStringArray
data
;
103
};
104
106
107
class
SafeString
:
public
PObject
108
{
109
PCLASSINFO(
SafeString
, PObject);
110
public
:
112
SafeString
() {
internal
= PString::Empty(); }
113
115
SafeString
(PString newValue) {
internal
= newValue; }
116
118
void
operator =
(PString newValue);
119
121
PString
Get
() { PWaitAndSignal m(
mutex
);
return
internal
; }
122
124
virtual
void
PrintOn
(ostream & str)
const
;
125
127
operator
PString();
128
130
void
operator +=
(PString toBeAdded);
131
133
PString
GetAndDelete
();
134
136
PBoolean
IsEmpty
()
const
;
137
138
139
protected
:
141
PString
internal
;
142
144
PMutex
mutex
;
145
};
146
148
149
150
#endif // OPAL_IAX2
151
152
#endif // OPAL_IAX2_SAFESTRINGS_H
153
154
/* The comment below is magic for those who use emacs to edit this file.
155
* With the comment below, the tab key does auto indent to 2 spaces.
156
*
157
* Local Variables:
158
* mode:c
159
* c-basic-offset:2
160
* End:
161
*/
include
iax2
safestrings.h
Generated on Fri Oct 10 2014 21:36:58 for OPAL by
1.8.3.1