Skip to content

Commit a04bae9

Browse files
committed
synchronized trunk
1 parent 2ef3a4f commit a04bae9

63 files changed

Lines changed: 2694 additions & 311 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Foundation/Foundation_vs71.vcproj‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,9 @@
265265
<File
266266
RelativePath=".\src\DynamicAnyHolder.cpp">
267267
</File>
268+
<File
269+
RelativePath=".\src\DynamicStruct.cpp">
270+
</File>
268271
<File
269272
RelativePath=".\src\Environment.cpp">
270273
</File>
@@ -584,6 +587,9 @@
584587
<File
585588
RelativePath=".\include\Poco\DynamicFactory.h">
586589
</File>
590+
<File
591+
RelativePath=".\include\Poco\DynamicStruct.h">
592+
</File>
587593
<File
588594
RelativePath=".\include\Poco\Environment.h">
589595
</File>

‎Foundation/Foundation_vs80.vcproj‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="Windows-1252"?>
22
<VisualStudioProject
33
ProjectType="Visual C++"
4-
Version="8.00"
4+
Version="8,00"
55
Name="Foundation"
66
ProjectGUID="{8164D41D-B053-405B-826C-CF37AC0EF176}"
77
RootNamespace="Foundation"
@@ -379,6 +379,10 @@
379379
RelativePath=".\src\DynamicAnyHolder.cpp"
380380
>
381381
</File>
382+
<File
383+
RelativePath=".\src\DynamicStruct.cpp"
384+
>
385+
</File>
382386
<File
383387
RelativePath=".\src\Environment.cpp"
384388
>
@@ -803,6 +807,10 @@
803807
RelativePath=".\include\Poco\DynamicFactory.h"
804808
>
805809
</File>
810+
<File
811+
RelativePath=".\include\Poco\DynamicStruct.h"
812+
>
813+
</File>
806814
<File
807815
RelativePath=".\include\Poco\Environment.h"
808816
>

‎Foundation/Makefile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
22
# Makefile
33
#
4-
# $Id: //poco/Main/Foundation/Makefile#44 $
4+
# $Id: //poco/Main/Foundation/Makefile#45 $
55
#
66
# Makefile for Poco Foundation
77
#
@@ -29,7 +29,7 @@ objects = ArchiveStrategy ASCIIEncoding AsyncChannel Base64Decoder Base64Encoder
2929
ThreadPool ActiveDispatcher Timer Timespan Timestamp Timezone Token URI \
3030
FileStreamFactory URIStreamFactory URIStreamOpener UTF16Encoding Windows1252Encoding \
3131
UTF8Encoding UnicodeConverter UUID UUIDGenerator Void Format \
32-
Pipe PipeImpl PipeStream DynamicAny DynamicAnyHolder SharedMemory \
32+
Pipe PipeImpl PipeStream DynamicAny DynamicAnyHolder DynamicStruct SharedMemory \
3333
FileStream Unicode UTF8String \
3434
AsyncIOCommand AsyncIOEvent AsyncIOChannel AsyncStreamChannel \
3535
adler32 compress crc32 deflate gzio infback inffast inflate inftrees \

‎Foundation/include/Poco/Base64Decoder.h‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// Base64Decoder.h
33
//
4-
// $Id: //poco/Main/Foundation/include/Poco/Base64Decoder.h#2 $
4+
// $Id: //poco/Main/Foundation/include/Poco/Base64Decoder.h#3 $
55
//
66
// Library: Foundation
77
// Package: Streams
@@ -67,6 +67,10 @@ class Foundation_API Base64DecoderBuf: public UnbufferedStreamBuf
6767

6868
static unsigned char IN_ENCODING[256];
6969
static bool IN_ENCODING_INIT;
70+
71+
private:
72+
Base64DecoderBuf(const Base64DecoderBuf&);
73+
Base64DecoderBuf& operator = (const Base64DecoderBuf&);
7074
};
7175

7276

@@ -83,6 +87,10 @@ class Foundation_API Base64DecoderIOS: public virtual std::ios
8387

8488
protected:
8589
Base64DecoderBuf _buf;
90+
91+
private:
92+
Base64DecoderIOS(const Base64DecoderIOS&);
93+
Base64DecoderIOS& operator = (const Base64DecoderIOS&);
8694
};
8795

8896

@@ -93,6 +101,10 @@ class Foundation_API Base64Decoder: public Base64DecoderIOS, public std::istream
93101
public:
94102
Base64Decoder(std::istream& istr);
95103
~Base64Decoder();
104+
105+
private:
106+
Base64Decoder(const Base64Decoder&);
107+
Base64Decoder& operator = (const Base64Decoder&);
96108
};
97109

98110

‎Foundation/include/Poco/Base64Encoder.h‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// Base64Encoder.h
33
//
4-
// $Id: //poco/Main/Foundation/include/Poco/Base64Encoder.h#3 $
4+
// $Id: //poco/Main/Foundation/include/Poco/Base64Encoder.h#4 $
55
//
66
// Library: Foundation
77
// Package: Streams
@@ -83,6 +83,9 @@ class Foundation_API Base64EncoderBuf: public UnbufferedStreamBuf
8383
static const unsigned char OUT_ENCODING[64];
8484

8585
friend class Base64DecoderBuf;
86+
87+
Base64EncoderBuf(const Base64EncoderBuf&);
88+
Base64EncoderBuf& operator = (const Base64EncoderBuf&);
8689
};
8790

8891

@@ -100,6 +103,10 @@ class Foundation_API Base64EncoderIOS: public virtual std::ios
100103

101104
protected:
102105
Base64EncoderBuf _buf;
106+
107+
private:
108+
Base64EncoderIOS(const Base64EncoderIOS&);
109+
Base64EncoderIOS& operator = (const Base64EncoderIOS&);
103110
};
104111

105112

@@ -114,6 +121,10 @@ class Foundation_API Base64Encoder: public Base64EncoderIOS, public std::ostream
114121
public:
115122
Base64Encoder(std::ostream& ostr);
116123
~Base64Encoder();
124+
125+
private:
126+
Base64Encoder(const Base64Encoder&);
127+
Base64Encoder& operator = (const Base64Encoder&);
117128
};
118129

119130

‎Foundation/include/Poco/BufferedBidirectionalStreamBuf.h‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// BufferedBidirectionalStreamBuf.h
33
//
4-
// $Id: //poco/Main/Foundation/include/Poco/BufferedBidirectionalStreamBuf.h#5 $
4+
// $Id: //poco/Main/Foundation/include/Poco/BufferedBidirectionalStreamBuf.h#6 $
55
//
66
// Library: Foundation
77
// Package: Streams
@@ -178,6 +178,9 @@ class BasicBufferedBidirectionalStreamBuf: public std::basic_streambuf<ch, tr>
178178
char_type* _pReadBuffer;
179179
char_type* _pWriteBuffer;
180180
openmode _mode;
181+
182+
BasicBufferedBidirectionalStreamBuf(const BasicBufferedBidirectionalStreamBuf&);
183+
BasicBufferedBidirectionalStreamBuf& operator = (const BasicBufferedBidirectionalStreamBuf&);
181184
};
182185

183186

‎Foundation/include/Poco/BufferedStreamBuf.h‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// BufferedStreamBuf.h
33
//
4-
// $Id: //poco/Main/Foundation/include/Poco/BufferedStreamBuf.h#4 $
4+
// $Id: //poco/Main/Foundation/include/Poco/BufferedStreamBuf.h#5 $
55
//
66
// Library: Foundation
77
// Package: Streams
@@ -170,6 +170,9 @@ class BasicBufferedStreamBuf: public std::basic_streambuf<ch, tr>
170170
std::streamsize _bufsize;
171171
char_type* _pBuffer;
172172
openmode _mode;
173+
174+
BasicBufferedStreamBuf(const BasicBufferedStreamBuf&);
175+
BasicBufferedStreamBuf& operator = (const BasicBufferedStreamBuf&);
173176
};
174177

175178

‎Foundation/include/Poco/Channel.h‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// Channel.h
33
//
4-
// $Id: //poco/Main/Foundation/include/Poco/Channel.h#2 $
4+
// $Id: //poco/Main/Foundation/include/Poco/Channel.h#3 $
55
//
66
// Library: Foundation
77
// Package: Logging
@@ -87,6 +87,10 @@ class Foundation_API Channel: public Configurable, public RefCountedObject
8787

8888
protected:
8989
virtual ~Channel();
90+
91+
private:
92+
Channel(const Channel&);
93+
Channel& operator = (const Channel&);
9094
};
9195

9296

‎Foundation/include/Poco/DynamicAny.h‎

Lines changed: 56 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DynamicAny.h
33
//
4-
// $Id: //poco/Main/Foundation/include/Poco/DynamicAny.h#9 $
4+
// $Id: //poco/Main/Foundation/include/Poco/DynamicAny.h#10 $
55
//
66
// Library: Foundation
77
// Package: Core
@@ -64,7 +64,7 @@ class Foundation_API DynamicAny
6464
/// String truncation is allowed -- it is possible to convert between string and character when string length is
6565
/// greater than 1. An empty string gets converted to the char '\0', a non-empty string is truncated to the first character.
6666
///
67-
/// Bolean conversion are performed as follows:
67+
/// Boolean conversion is performed as follows:
6868
///
6969
/// A string value "false" (not case sensitive) or "0" can be converted to a boolean value false, any other string
7070
/// not being false by the above criteria evaluates to true (e.g: "hi" -> true).
@@ -180,15 +180,15 @@ class Foundation_API DynamicAny
180180
}
181181

182182
template <typename T>
183-
bool operator == (const T& other)
183+
bool operator == (const T& other) const
184184
/// Equality operator
185185
{
186186
T value;
187187
_pHolder->convert(value);
188188
return value == other;
189189
}
190190

191-
bool operator == (const char* other)
191+
bool operator == (const char* other) const
192192
/// Equality operator
193193
{
194194
std::string value;
@@ -197,30 +197,79 @@ class Foundation_API DynamicAny
197197
}
198198

199199
template <typename T>
200-
bool operator != (const T& other)
200+
bool operator != (const T& other) const
201201
/// Inequality operator
202202
{
203203
T value;
204204
_pHolder->convert(value);
205205
return value != other;
206206
}
207207

208-
bool operator != (const char* other)
208+
bool operator != (const char* other) const
209209
/// Inequality operator
210210
{
211211
std::string value;
212212
_pHolder->convert(value);
213213
return value != other;
214214
}
215215

216-
const std::type_info& type() const;
216+
bool isArray() const;
217+
/// Returns true if DynamicAny represents a vector
218+
219+
bool isStruct() const;
220+
/// Returns true if DynamicAny represents a struct
221+
222+
DynamicAny& operator[](std::vector<DynamicAny>::size_type n);
223+
/// Index operator, only use on DynamicAnys where isArray
224+
/// returns true! In all other cases a BadCastException is thrown!
225+
226+
const DynamicAny& operator[](std::vector<DynamicAny>::size_type n) const;
227+
/// const Index operator, only use on DynamicAnys where isArray
228+
/// returns true! In all other cases a BadCastException is thrown!
229+
230+
DynamicAny& operator[](const std::string& name);
231+
/// Index operator by name, only use on DynamicAnys where isStruct
232+
/// returns true! In all other cases a BadCastException is thrown!
233+
234+
const DynamicAny& operator[](const std::string& name) const;
235+
/// Index operator by name, only use on DynamicAnys where isStruct
236+
/// returns true! In all other cases a BadCastException is thrown!
237+
238+
const std::type_info& type() const;
217239
/// Returns the type information of the stored content.
240+
241+
static DynamicAny parse(const std::string& val);
242+
/// Parses the string which must be in JSON format
243+
244+
static std::string toString(const DynamicAny& any);
245+
/// Converts the DynamicAny to a string in JSON format. Note that toString will return
246+
/// a different result than any.convert<std::string>()!
218247

248+
private:
249+
static DynamicAny parse(const std::string& val, std::string::size_type& offset);
250+
/// Parses the string which must be in JSON format
251+
252+
static DynamicAny parseObject(const std::string& val, std::string::size_type& pos);
253+
static DynamicAny parseArray(const std::string& val, std::string::size_type& pos);
254+
static std::string parseString(const std::string& val, std::string::size_type& pos);
255+
static void skipWhiteSpace(const std::string& val, std::string::size_type& pos);
219256
private:
220257
DynamicAnyHolder* _pHolder;
221258
};
222259

223260

261+
inline bool DynamicAny::isArray() const
262+
{
263+
return _pHolder->isArray();
264+
}
265+
266+
267+
inline bool DynamicAny::isStruct() const
268+
{
269+
return _pHolder->isStruct();
270+
}
271+
272+
224273
} // namespace Poco
225274

226275

0 commit comments

Comments
 (0)