@@ -27,11 +27,11 @@ namespace sio
27
27
flag_binary,
28
28
flag_array,
29
29
flag_object,
30
- flag_boolean,
31
- flag_null
30
+ flag_boolean,
31
+ flag_null
32
32
};
33
33
34
- virtual ~message (){};
34
+ virtual ~message (){};
35
35
36
36
class list ;
37
37
@@ -42,11 +42,11 @@ namespace sio
42
42
43
43
typedef shared_ptr<message> ptr;
44
44
45
- virtual bool get_bool () const
46
- {
47
- assert (false );
48
- return false ;
49
- }
45
+ virtual bool get_bool () const
46
+ {
47
+ assert (false );
48
+ return false ;
49
+ }
50
50
51
51
virtual int64_t get_int () const
52
52
{
@@ -114,26 +114,26 @@ namespace sio
114
114
message (flag f):_flag(f){}
115
115
};
116
116
117
- class null_message : public message
118
- {
119
- protected:
117
+ class null_message : public message
118
+ {
119
+ protected:
120
120
null_message ()
121
- :message(flag_null)
121
+ :message(flag_null)
122
122
{
123
123
}
124
124
125
- public:
125
+ public:
126
126
static message::ptr create ()
127
127
{
128
128
return ptr (new null_message ());
129
129
}
130
- };
130
+ };
131
131
132
- class bool_message : public message
133
- {
134
- bool _v;
132
+ class bool_message : public message
133
+ {
134
+ bool _v;
135
135
136
- protected:
136
+ protected:
137
137
bool_message (bool v)
138
138
:message(flag_boolean),_v(v)
139
139
{
@@ -149,7 +149,7 @@ namespace sio
149
149
{
150
150
return _v;
151
151
}
152
- };
152
+ };
153
153
154
154
class int_message : public message
155
155
{
@@ -265,53 +265,53 @@ namespace sio
265
265
}
266
266
267
267
void push (const string& text)
268
- {
269
- _v.push_back (string_message::create (text));
270
- }
268
+ {
269
+ _v.push_back (string_message::create (text));
270
+ }
271
271
272
272
void push (string&& text)
273
- {
274
- _v.push_back (string_message::create (move (text)));
275
- }
273
+ {
274
+ _v.push_back (string_message::create (move (text)));
275
+ }
276
276
277
277
void push (shared_ptr<string> const & binary)
278
- {
279
- if (binary)
280
- _v.push_back (binary_message::create (binary));
281
- }
278
+ {
279
+ if (binary)
280
+ _v.push_back (binary_message::create (binary));
281
+ }
282
282
283
283
void push (shared_ptr<const string> const & binary)
284
- {
285
- if (binary)
286
- _v.push_back (binary_message::create (binary));
287
- }
284
+ {
285
+ if (binary)
286
+ _v.push_back (binary_message::create (binary));
287
+ }
288
288
289
289
void insert (size_t pos,message::ptr const & message)
290
290
{
291
291
_v.insert (_v.begin ()+pos, message);
292
292
}
293
293
294
294
void insert (size_t pos,const string& text)
295
- {
296
- _v.insert (_v.begin ()+pos, string_message::create (text));
297
- }
295
+ {
296
+ _v.insert (_v.begin ()+pos, string_message::create (text));
297
+ }
298
298
299
299
void insert (size_t pos,string&& text)
300
- {
301
- _v.insert (_v.begin ()+pos, string_message::create (move (text)));
302
- }
300
+ {
301
+ _v.insert (_v.begin ()+pos, string_message::create (move (text)));
302
+ }
303
303
304
304
void insert (size_t pos,shared_ptr<string> const & binary)
305
- {
306
- if (binary)
307
- _v.insert (_v.begin ()+pos, binary_message::create (binary));
308
- }
305
+ {
306
+ if (binary)
307
+ _v.insert (_v.begin ()+pos, binary_message::create (binary));
308
+ }
309
309
310
310
void insert (size_t pos,shared_ptr<const string> const & binary)
311
- {
312
- if (binary)
313
- _v.insert (_v.begin ()+pos, binary_message::create (binary));
314
- }
311
+ {
312
+ if (binary)
313
+ _v.insert (_v.begin ()+pos, binary_message::create (binary));
314
+ }
315
315
316
316
size_t size () const
317
317
{
@@ -357,39 +357,39 @@ namespace sio
357
357
}
358
358
359
359
void insert (const string & key,const string& text)
360
- {
361
- _v[key] = string_message::create (text);
362
- }
360
+ {
361
+ _v[key] = string_message::create (text);
362
+ }
363
363
364
364
void insert (const string & key,string&& text)
365
- {
366
- _v[key] = string_message::create (move (text));
367
- }
365
+ {
366
+ _v[key] = string_message::create (move (text));
367
+ }
368
368
369
369
void insert (const string & key,shared_ptr<string> const & binary)
370
- {
371
- if (binary)
372
- _v[key] = binary_message::create (binary);
373
- }
370
+ {
371
+ if (binary)
372
+ _v[key] = binary_message::create (binary);
373
+ }
374
374
375
375
void insert (const string & key,shared_ptr<const string> const & binary)
376
- {
377
- if (binary)
378
- _v[key] = binary_message::create (binary);
379
- }
376
+ {
377
+ if (binary)
378
+ _v[key] = binary_message::create (binary);
379
+ }
380
380
381
381
bool has (const string & key)
382
382
{
383
- return _v.find (key) != _v.end ();
383
+ return _v.find (key) != _v.end ();
384
384
}
385
385
386
386
const message::ptr& at (const string & key) const
387
387
{
388
- static shared_ptr<message> not_found;
388
+ static shared_ptr<message> not_found;
389
389
390
- map<string,message::ptr>::const_iterator it = _v.find (key);
391
- if (it != _v.end ()) return it->second ;
392
- return not_found;
390
+ map<string,message::ptr>::const_iterator it = _v.find (key);
391
+ if (it != _v.end ()) return it->second ;
392
+ return not_found;
393
393
}
394
394
395
395
const message::ptr& operator [] (const string & key) const
@@ -399,7 +399,7 @@ namespace sio
399
399
400
400
bool has (const string & key) const
401
401
{
402
- return _v.find (key) != _v.end ();
402
+ return _v.find (key) != _v.end ();
403
403
}
404
404
405
405
map<string,message::ptr>& get_map ()
@@ -436,10 +436,10 @@ namespace sio
436
436
return *this ;
437
437
}
438
438
439
- template <typename T>
440
- list (T&& content,
441
- typename enable_if<is_same<vector<message::ptr>,typename remove_reference<T>::type>::value>::type* = 0 ):
442
- m_vector (std::forward<T>(content))
439
+ template <typename T>
440
+ list (T&& content,
441
+ typename enable_if<is_same<vector<message::ptr>,typename remove_reference<T>::type>::value>::type* = 0 ):
442
+ m_vector (std::forward<T>(content))
443
443
{
444
444
}
445
445
@@ -485,53 +485,53 @@ namespace sio
485
485
}
486
486
487
487
void push (const string& text)
488
- {
489
- m_vector.push_back (string_message::create (text));
490
- }
488
+ {
489
+ m_vector.push_back (string_message::create (text));
490
+ }
491
491
492
492
void push (string&& text)
493
- {
494
- m_vector.push_back (string_message::create (move (text)));
495
- }
493
+ {
494
+ m_vector.push_back (string_message::create (move (text)));
495
+ }
496
496
497
497
void push (shared_ptr<string> const & binary)
498
- {
499
- if (binary)
500
- m_vector.push_back (binary_message::create (binary));
501
- }
498
+ {
499
+ if (binary)
500
+ m_vector.push_back (binary_message::create (binary));
501
+ }
502
502
503
503
void push (shared_ptr<const string> const & binary)
504
- {
505
- if (binary)
506
- m_vector.push_back (binary_message::create (binary));
507
- }
504
+ {
505
+ if (binary)
506
+ m_vector.push_back (binary_message::create (binary));
507
+ }
508
508
509
509
void insert (size_t pos,message::ptr const & message)
510
510
{
511
511
m_vector.insert (m_vector.begin ()+pos, message);
512
512
}
513
513
514
514
void insert (size_t pos,const string& text)
515
- {
516
- m_vector.insert (m_vector.begin ()+pos, string_message::create (text));
517
- }
515
+ {
516
+ m_vector.insert (m_vector.begin ()+pos, string_message::create (text));
517
+ }
518
518
519
519
void insert (size_t pos,string&& text)
520
- {
521
- m_vector.insert (m_vector.begin ()+pos, string_message::create (move (text)));
522
- }
520
+ {
521
+ m_vector.insert (m_vector.begin ()+pos, string_message::create (move (text)));
522
+ }
523
523
524
524
void insert (size_t pos,shared_ptr<string> const & binary)
525
- {
526
- if (binary)
527
- m_vector.insert (m_vector.begin ()+pos, binary_message::create (binary));
528
- }
525
+ {
526
+ if (binary)
527
+ m_vector.insert (m_vector.begin ()+pos, binary_message::create (binary));
528
+ }
529
529
530
530
void insert (size_t pos,shared_ptr<const string> const & binary)
531
- {
532
- if (binary)
533
- m_vector.insert (m_vector.begin ()+pos, binary_message::create (binary));
534
- }
531
+ {
532
+ if (binary)
533
+ m_vector.insert (m_vector.begin ()+pos, binary_message::create (binary));
534
+ }
535
535
536
536
size_t size () const
537
537
{
0 commit comments