From b8345246dcc2121bcb6d1515a9341789de20199f Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Sun, 27 Oct 2024 09:04:05 -0500 Subject: First crack at file objects. --- source/fud_assert.cpp | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'source/fud_assert.cpp') diff --git a/source/fud_assert.cpp b/source/fud_assert.cpp index 0c4d7cf..a7c9d76 100644 --- a/source/fud_assert.cpp +++ b/source/fud_assert.cpp @@ -1,11 +1,27 @@ +/* + * libfud + * Copyright 2024 Dominick Allen + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "fud_assert.hpp" #include "fud_format.hpp" -#include "fud_string.hpp" +#include "fud_string.hpp" // DrainResult +#include "fud_string_view.hpp" -#include #include -#include namespace fud { @@ -24,6 +40,7 @@ DrainResult BufferSink::drain(StringView source) result.status = FudStatus::Success; return result; } + /* TODO: give users control over this functionality */ result.bytesWritten = fwrite(reinterpret_cast(source.m_data), 1, source.m_length, stderr); if (result.bytesWritten != source.m_length) { result.status = FudStatus::Full; @@ -43,7 +60,14 @@ void assertFailMessage(const char* assertion, const std::source_location sourceL if (functionName == nullptr) { functionName = "Unknown Function"; } - format(sink, FormatCharMode::Unchecked, "{}:{}:{}: {}\n", fileName, functionName, sourceLocation.line(), assertion); + static_cast(format( + sink, + FormatCharMode::Unchecked, + "{}:{}:{}: {}\n", + fileName, + functionName, + sourceLocation.line(), + assertion)); } } // namespace impl -- cgit v1.2.3