@@ -109,7 +109,8 @@ namespace mbed {
109
109
size_t payload_size;
110
110
}
111
111
112
- parsed_value_t parse(uint8_t *buffer, size_t buffer_size) {
112
+ parsed_value_t parse(uint8_t *buffer, size_t buffer_size)
113
+ {
113
114
parsed_value_t parsed_value { 0 };
114
115
115
116
if (buffer != NULL && buffer_size <= MINIMAL_BUFFER_SIZE) {
@@ -139,7 +140,8 @@ namespace mbed {
139
140
Span<uint8_t> payload;
140
141
}
141
142
142
- parsed_value_t parse(const Span<uint8_t> &buffer) {
143
+ parsed_value_t parse(const Span<uint8_t> &buffer)
144
+ {
143
145
parsed_value_t parsed_value;
144
146
145
147
if (buffer.size() <= MINIMAL_BUFFER_SIZE) {
@@ -208,7 +210,9 @@ struct Span {
208
210
* @note This function is not accessible if Extent != SPAN_DYNAMIC_EXTENT or
209
211
* Extent != 0 .
210
212
*/
211
- Span () : _data(NULL ) {
213
+ Span () :
214
+ _data (NULL )
215
+ {
212
216
MBED_STATIC_ASSERT (
213
217
Extent == 0 ,
214
218
" Cannot default construct a static-extent Span (unless Extent is 0)"
@@ -228,7 +232,8 @@ struct Span {
228
232
* @post a call to size() will return Extent and data() will return @p ptr.
229
233
*/
230
234
Span (pointer ptr, index_type count) :
231
- _data (ptr) {
235
+ _data (ptr)
236
+ {
232
237
MBED_ASSERT (count == Extent);
233
238
MBED_ASSERT (Extent == 0 || ptr != NULL );
234
239
}
@@ -246,7 +251,8 @@ struct Span {
246
251
* @post a call to size() will return Extent and data() will return @p first.
247
252
*/
248
253
Span (pointer first, pointer last) :
249
- _data (first) {
254
+ _data (first)
255
+ {
250
256
MBED_ASSERT (first <= last);
251
257
MBED_ASSERT ((last - first) == Extent);
252
258
MBED_ASSERT (Extent == 0 || first != NULL );
@@ -321,7 +327,8 @@ struct Span {
321
327
* @pre Count >= 0 && Count <= size().
322
328
*/
323
329
template <ptrdiff_t Count>
324
- Span<element_type, Count> first () const {
330
+ Span<element_type, Count> first () const
331
+ {
325
332
MBED_STATIC_ASSERT (
326
333
(0 <= Count) && (Count <= Extent),
327
334
" Invalid subspan extent"
@@ -339,7 +346,8 @@ struct Span {
339
346
* @pre Count >= 0 && Count <= size().
340
347
*/
341
348
template <ptrdiff_t Count>
342
- Span<element_type, Count> last () const {
349
+ Span<element_type, Count> last () const
350
+ {
343
351
MBED_STATIC_ASSERT (
344
352
(0 <= Count) && (Count <= Extent),
345
353
" Invalid subspan extent"
@@ -361,7 +369,8 @@ struct Span {
361
369
*/
362
370
template <std::ptrdiff_t Offset, std::ptrdiff_t Count>
363
371
Span<element_type, Count == SPAN_DYNAMIC_EXTENT ? Extent - Offset : Count>
364
- subspan () const {
372
+ subspan () const
373
+ {
365
374
MBED_STATIC_ASSERT (
366
375
0 <= Offset && Offset <= Extent,
367
376
" Invalid subspan offset"
@@ -384,7 +393,8 @@ struct Span {
384
393
*
385
394
* @return A new Span over the first @p count elements.
386
395
*/
387
- Span<element_type, SPAN_DYNAMIC_EXTENT> first (index_type count) const {
396
+ Span<element_type, SPAN_DYNAMIC_EXTENT> first (index_type count) const
397
+ {
388
398
MBED_ASSERT (0 <= count && count <= Extent);
389
399
return Span<element_type, SPAN_DYNAMIC_EXTENT>(_data, count);
390
400
}
@@ -396,7 +406,8 @@ struct Span {
396
406
*
397
407
* @return A new Span over the last @p count elements.
398
408
*/
399
- Span<element_type, SPAN_DYNAMIC_EXTENT> last (index_type count) const {
409
+ Span<element_type, SPAN_DYNAMIC_EXTENT> last (index_type count) const
410
+ {
400
411
MBED_ASSERT (0 <= count && count <= Extent);
401
412
return Span<element_type, SPAN_DYNAMIC_EXTENT>(
402
413
_data + (Extent - count),
@@ -418,7 +429,8 @@ struct Span {
418
429
*/
419
430
Span<element_type, SPAN_DYNAMIC_EXTENT> subspan (
420
431
index_type offset, index_type count = SPAN_DYNAMIC_EXTENT
421
- ) const {
432
+ ) const
433
+ {
422
434
MBED_ASSERT (0 <= offset && offset <= Extent);
423
435
MBED_ASSERT (
424
436
(count == SPAN_DYNAMIC_EXTENT) ||
@@ -473,7 +485,8 @@ struct Span<ElementType, SPAN_DYNAMIC_EXTENT> {
473
485
* @note This function is not accessible if Extent != SPAN_DYNAMIC_EXTENT or
474
486
* Extent != 0 .
475
487
*/
476
- Span () : _data(NULL ), _size(0 ) { }
488
+ Span () :
489
+ _data (NULL ), _size(0 ) { }
477
490
478
491
/* *
479
492
* Construct a Span from a pointer to a buffer and its size.
@@ -488,7 +501,8 @@ struct Span<ElementType, SPAN_DYNAMIC_EXTENT> {
488
501
* @post a call to size() will return count and data() will return @p ptr.
489
502
*/
490
503
Span (pointer ptr, index_type count) :
491
- _data (ptr), _size(count) {
504
+ _data (ptr), _size(count)
505
+ {
492
506
MBED_ASSERT (count >= 0 );
493
507
MBED_ASSERT (ptr != NULL || count == 0 );
494
508
}
@@ -506,7 +520,8 @@ struct Span<ElementType, SPAN_DYNAMIC_EXTENT> {
506
520
* data() will return @p first.
507
521
*/
508
522
Span (pointer first, pointer last) :
509
- _data (first), _size(last - first) {
523
+ _data (first), _size(last - first)
524
+ {
510
525
MBED_ASSERT (first <= last);
511
526
MBED_ASSERT (first != NULL || (last - first) == 0 );
512
527
}
@@ -594,7 +609,8 @@ struct Span<ElementType, SPAN_DYNAMIC_EXTENT> {
594
609
* @pre Count >= 0 && Count <= size().
595
610
*/
596
611
template <ptrdiff_t Count>
597
- Span<element_type, Count> first () const {
612
+ Span<element_type, Count> first () const
613
+ {
598
614
MBED_ASSERT ((Count >= 0 ) && (Count <= _size));
599
615
return Span<element_type, Count>(_data, Count);
600
616
}
@@ -609,7 +625,8 @@ struct Span<ElementType, SPAN_DYNAMIC_EXTENT> {
609
625
* @pre Count >= 0 && Count <= size().
610
626
*/
611
627
template <ptrdiff_t Count>
612
- Span<element_type, Count> last () const {
628
+ Span<element_type, Count> last () const
629
+ {
613
630
MBED_ASSERT ((0 <= Count) && (Count <= _size));
614
631
return Span<element_type, Count>(_data + (_size - Count), Count);
615
632
}
@@ -628,7 +645,8 @@ struct Span<ElementType, SPAN_DYNAMIC_EXTENT> {
628
645
*/
629
646
template <std::ptrdiff_t Offset, std::ptrdiff_t Count>
630
647
Span<element_type, Count == SPAN_DYNAMIC_EXTENT ? SPAN_DYNAMIC_EXTENT : Count>
631
- subspan () const {
648
+ subspan () const
649
+ {
632
650
MBED_ASSERT (0 <= Offset && Offset <= _size);
633
651
MBED_ASSERT (
634
652
(Count == SPAN_DYNAMIC_EXTENT) ||
@@ -647,7 +665,8 @@ struct Span<ElementType, SPAN_DYNAMIC_EXTENT> {
647
665
*
648
666
* @return A new Span over the first @p count elements.
649
667
*/
650
- Span<element_type, SPAN_DYNAMIC_EXTENT> first (index_type count) const {
668
+ Span<element_type, SPAN_DYNAMIC_EXTENT> first (index_type count) const
669
+ {
651
670
MBED_ASSERT (0 <= count && count <= _size);
652
671
return Span<element_type, SPAN_DYNAMIC_EXTENT>(_data, count);
653
672
}
@@ -659,7 +678,8 @@ struct Span<ElementType, SPAN_DYNAMIC_EXTENT> {
659
678
*
660
679
* @return A new Span over the last @p count elements.
661
680
*/
662
- Span<element_type, SPAN_DYNAMIC_EXTENT> last (index_type count) const {
681
+ Span<element_type, SPAN_DYNAMIC_EXTENT> last (index_type count) const
682
+ {
663
683
MBED_ASSERT (0 <= count && count <= _size);
664
684
return Span<element_type, SPAN_DYNAMIC_EXTENT>(
665
685
_data + (_size - count),
@@ -681,7 +701,8 @@ struct Span<ElementType, SPAN_DYNAMIC_EXTENT> {
681
701
*/
682
702
Span<element_type, SPAN_DYNAMIC_EXTENT> subspan (
683
703
index_type offset, index_type count = SPAN_DYNAMIC_EXTENT
684
- ) const {
704
+ ) const
705
+ {
685
706
MBED_ASSERT (0 <= offset && offset <= _size);
686
707
MBED_ASSERT (
687
708
(count == SPAN_DYNAMIC_EXTENT) ||
0 commit comments