STX  1.0.0
Classes | Namespaces | Macros | Functions | Variables
report.h File Reference
#include <cinttypes>
#include <cstdio>
#include <string>
#include <string_view>
#include "stx/common.h"
Include dependency graph for report.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  stx::ReportQuery
 Tag type for dispatching reports. More...
 
class  stx::FixedReport
 
class  stx::SpanReport
 
class  stx::ReportPayload
 

Namespaces

 stx
 

Macros

#define STX_INTERNAL_MAKE_REPORT_(STX_ARG_SIZE, STX_ARG_FORMAT, STX_ARG_VALUE)
 

Functions

template<typename T >
SpanReport stx::operator>> (ReportQuery, T const &) noexcept
 
template<typename T >
FixedReport stx::operator>> (ReportQuery, T const *const &ptr) noexcept
 
template<typename T >
FixedReport stx::operator>> (ReportQuery, T *const &ptr) noexcept
 
FixedReport stx::operator>> (ReportQuery, int8_t const &v) noexcept
 
FixedReport stx::operator>> (ReportQuery, uint8_t const &v) noexcept
 
FixedReport stx::operator>> (ReportQuery, int16_t const &v) noexcept
 
FixedReport stx::operator>> (ReportQuery, uint16_t const &v) noexcept
 
FixedReport stx::operator>> (ReportQuery, int32_t const &v) noexcept
 
FixedReport stx::operator>> (ReportQuery, uint32_t const &v) noexcept
 
SpanReport stx::operator>> (ReportQuery, std::string_view const &v) noexcept
 
SpanReport stx::operator>> (ReportQuery, std::string const &v) noexcept
 

Variables

constexpr size_t stx::kReportReserveSize = 128
 
constexpr char const stx::kReportTruncationMessage []
 
constexpr ReportQuery const stx::report_query {}
 Tag value for dispatching reports. More...
 
constexpr char const stx::kFormatError [] = "<format error>"
 
constexpr size_t const stx::kFormatErrorSize = sizeof(kFormatError) - 1
 

Detailed Description

Author
Basit Ayantunde rlama.nosp@m.rrr@.nosp@m.gmail.nosp@m..com
Date
2020-05-22

Copyright (c) 2020 Basit Ayantunde

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Macro Definition Documentation

◆ STX_INTERNAL_MAKE_REPORT_

#define STX_INTERNAL_MAKE_REPORT_ (   STX_ARG_SIZE,
  STX_ARG_FORMAT,
  STX_ARG_VALUE 
)
Value:
/* string size + terminating null character */ \
char fmt_buffer[STX_ARG_SIZE + 1]; \
int fmt_buffer_size = std::snprintf(fmt_buffer, STX_ARG_SIZE + 1, \
STX_ARG_FORMAT, STX_ARG_VALUE); \
if (fmt_buffer_size < 0 || fmt_buffer_size >= STX_ARG_SIZE + 1) { \
return FixedReport(kFormatError, kFormatErrorSize); \
} else { \
return FixedReport(fmt_buffer, fmt_buffer_size); \
}
constexpr size_t const kFormatErrorSize
Definition: report.h:328
constexpr char const kFormatError[]
Definition: report.h:327