Skip to content

Commit b7f074e

Browse files
committed
Span: Fix opening brace position.
1 parent 2a6c6d5 commit b7f074e

File tree

1 file changed

+41
-20
lines changed

1 file changed

+41
-20
lines changed

platform/Span.h

Lines changed: 41 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ namespace mbed {
109109
size_t payload_size;
110110
}
111111
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+
{
113114
parsed_value_t parsed_value { 0 };
114115
115116
if (buffer != NULL && buffer_size <= MINIMAL_BUFFER_SIZE) {
@@ -139,7 +140,8 @@ namespace mbed {
139140
Span<uint8_t> payload;
140141
}
141142
142-
parsed_value_t parse(const Span<uint8_t> &buffer) {
143+
parsed_value_t parse(const Span<uint8_t> &buffer)
144+
{
143145
parsed_value_t parsed_value;
144146
145147
if (buffer.size() <= MINIMAL_BUFFER_SIZE) {
@@ -208,7 +210,9 @@ struct Span {
208210
* @note This function is not accessible if Extent != SPAN_DYNAMIC_EXTENT or
209211
* Extent != 0 .
210212
*/
211-
Span() : _data(NULL) {
213+
Span() :
214+
_data(NULL)
215+
{
212216
MBED_STATIC_ASSERT(
213217
Extent == 0,
214218
"Cannot default construct a static-extent Span (unless Extent is 0)"
@@ -228,7 +232,8 @@ struct Span {
228232
* @post a call to size() will return Extent and data() will return @p ptr.
229233
*/
230234
Span(pointer ptr, index_type count) :
231-
_data(ptr) {
235+
_data(ptr)
236+
{
232237
MBED_ASSERT(count == Extent);
233238
MBED_ASSERT(Extent == 0 || ptr != NULL);
234239
}
@@ -246,7 +251,8 @@ struct Span {
246251
* @post a call to size() will return Extent and data() will return @p first.
247252
*/
248253
Span(pointer first, pointer last) :
249-
_data(first) {
254+
_data(first)
255+
{
250256
MBED_ASSERT(first <= last);
251257
MBED_ASSERT((last - first) == Extent);
252258
MBED_ASSERT(Extent == 0 || first != NULL);
@@ -321,7 +327,8 @@ struct Span {
321327
* @pre Count >= 0 && Count <= size().
322328
*/
323329
template<ptrdiff_t Count>
324-
Span<element_type, Count> first() const {
330+
Span<element_type, Count> first() const
331+
{
325332
MBED_STATIC_ASSERT(
326333
(0 <= Count) && (Count <= Extent),
327334
"Invalid subspan extent"
@@ -339,7 +346,8 @@ struct Span {
339346
* @pre Count >= 0 && Count <= size().
340347
*/
341348
template<ptrdiff_t Count>
342-
Span<element_type, Count> last() const {
349+
Span<element_type, Count> last() const
350+
{
343351
MBED_STATIC_ASSERT(
344352
(0 <= Count) && (Count <= Extent),
345353
"Invalid subspan extent"
@@ -361,7 +369,8 @@ struct Span {
361369
*/
362370
template<std::ptrdiff_t Offset, std::ptrdiff_t Count>
363371
Span<element_type, Count == SPAN_DYNAMIC_EXTENT ? Extent - Offset : Count>
364-
subspan() const {
372+
subspan() const
373+
{
365374
MBED_STATIC_ASSERT(
366375
0 <= Offset && Offset <= Extent,
367376
"Invalid subspan offset"
@@ -384,7 +393,8 @@ struct Span {
384393
*
385394
* @return A new Span over the first @p count elements.
386395
*/
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+
{
388398
MBED_ASSERT(0 <= count && count <= Extent);
389399
return Span<element_type, SPAN_DYNAMIC_EXTENT>(_data, count);
390400
}
@@ -396,7 +406,8 @@ struct Span {
396406
*
397407
* @return A new Span over the last @p count elements.
398408
*/
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+
{
400411
MBED_ASSERT(0 <= count && count <= Extent);
401412
return Span<element_type, SPAN_DYNAMIC_EXTENT>(
402413
_data + (Extent - count),
@@ -418,7 +429,8 @@ struct Span {
418429
*/
419430
Span<element_type, SPAN_DYNAMIC_EXTENT> subspan(
420431
index_type offset, index_type count = SPAN_DYNAMIC_EXTENT
421-
) const {
432+
) const
433+
{
422434
MBED_ASSERT(0 <= offset && offset <= Extent);
423435
MBED_ASSERT(
424436
(count == SPAN_DYNAMIC_EXTENT) ||
@@ -473,7 +485,8 @@ struct Span<ElementType, SPAN_DYNAMIC_EXTENT> {
473485
* @note This function is not accessible if Extent != SPAN_DYNAMIC_EXTENT or
474486
* Extent != 0 .
475487
*/
476-
Span() : _data(NULL), _size(0) { }
488+
Span() :
489+
_data(NULL), _size(0) { }
477490

478491
/**
479492
* Construct a Span from a pointer to a buffer and its size.
@@ -488,7 +501,8 @@ struct Span<ElementType, SPAN_DYNAMIC_EXTENT> {
488501
* @post a call to size() will return count and data() will return @p ptr.
489502
*/
490503
Span(pointer ptr, index_type count) :
491-
_data(ptr), _size(count) {
504+
_data(ptr), _size(count)
505+
{
492506
MBED_ASSERT(count >= 0);
493507
MBED_ASSERT(ptr != NULL || count == 0);
494508
}
@@ -506,7 +520,8 @@ struct Span<ElementType, SPAN_DYNAMIC_EXTENT> {
506520
* data() will return @p first.
507521
*/
508522
Span(pointer first, pointer last) :
509-
_data(first), _size(last - first) {
523+
_data(first), _size(last - first)
524+
{
510525
MBED_ASSERT(first <= last);
511526
MBED_ASSERT(first != NULL || (last - first) == 0);
512527
}
@@ -594,7 +609,8 @@ struct Span<ElementType, SPAN_DYNAMIC_EXTENT> {
594609
* @pre Count >= 0 && Count <= size().
595610
*/
596611
template<ptrdiff_t Count>
597-
Span<element_type, Count> first() const {
612+
Span<element_type, Count> first() const
613+
{
598614
MBED_ASSERT((Count >= 0) && (Count <= _size));
599615
return Span<element_type, Count>(_data, Count);
600616
}
@@ -609,7 +625,8 @@ struct Span<ElementType, SPAN_DYNAMIC_EXTENT> {
609625
* @pre Count >= 0 && Count <= size().
610626
*/
611627
template<ptrdiff_t Count>
612-
Span<element_type, Count> last() const {
628+
Span<element_type, Count> last() const
629+
{
613630
MBED_ASSERT((0 <= Count) && (Count <= _size));
614631
return Span<element_type, Count>(_data + (_size - Count), Count);
615632
}
@@ -628,7 +645,8 @@ struct Span<ElementType, SPAN_DYNAMIC_EXTENT> {
628645
*/
629646
template<std::ptrdiff_t Offset, std::ptrdiff_t Count>
630647
Span<element_type, Count == SPAN_DYNAMIC_EXTENT ? SPAN_DYNAMIC_EXTENT : Count>
631-
subspan() const {
648+
subspan() const
649+
{
632650
MBED_ASSERT(0 <= Offset && Offset <= _size);
633651
MBED_ASSERT(
634652
(Count == SPAN_DYNAMIC_EXTENT) ||
@@ -647,7 +665,8 @@ struct Span<ElementType, SPAN_DYNAMIC_EXTENT> {
647665
*
648666
* @return A new Span over the first @p count elements.
649667
*/
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+
{
651670
MBED_ASSERT(0 <= count && count <= _size);
652671
return Span<element_type, SPAN_DYNAMIC_EXTENT>(_data, count);
653672
}
@@ -659,7 +678,8 @@ struct Span<ElementType, SPAN_DYNAMIC_EXTENT> {
659678
*
660679
* @return A new Span over the last @p count elements.
661680
*/
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+
{
663683
MBED_ASSERT(0 <= count && count <= _size);
664684
return Span<element_type, SPAN_DYNAMIC_EXTENT>(
665685
_data + (_size - count),
@@ -681,7 +701,8 @@ struct Span<ElementType, SPAN_DYNAMIC_EXTENT> {
681701
*/
682702
Span<element_type, SPAN_DYNAMIC_EXTENT> subspan(
683703
index_type offset, index_type count = SPAN_DYNAMIC_EXTENT
684-
) const {
704+
) const
705+
{
685706
MBED_ASSERT(0 <= offset && offset <= _size);
686707
MBED_ASSERT(
687708
(count == SPAN_DYNAMIC_EXTENT) ||

0 commit comments

Comments
 (0)