/
lasersquad
/
LogEngine2
Обзор
Документация
Войти
/
lasersquad
/
LogEngine2
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
v1.04
include/Exceptions.h
54 строки
1 KB
lasersquad0
Preparing to release - updated file headers
21 апр 2025, 13:45
21 апр 2025, 13:45
6ba4845
Код
Авторство
О чём код?
/* * Exceptions.h * * Copyright 2025, LogEngine2 Project. All rights reserved. * * See the COPYING file for the terms of usage and distribution. */ #pragma once #include <string> LOGENGINE_NS_BEGIN // 2K should be enough for one format line #define VARIABLE_LIST_BUFFER_SIZE (2*1024) class LogException : public std::exception { private: std::string Text; public: LogException(const char* formatstr, ...) { char res[VARIABLE_LIST_BUFFER_SIZE]; va_list list; va_start(list, formatstr); #ifdef WIN32 // __STDC_SECURE_LIB__ //_MSC_VER < 1400 vsprintf_s(res, VARIABLE_LIST_BUFFER_SIZE, formatstr, list); #else vsprintf(res, formatstr, list); #endif va_end(list); Text = res; } LogException(const std::string& Message) { Text = Message; } LogException(const LogException& ex) { Text = ex.Text; } ~LogException() noexcept override { /*nothing to do */ } LogException& operator=(const LogException& ex) { Text = ex.Text; return *this; } virtual const char* what() const noexcept override //throw() { static std::string s = "[LogException] " + Text; return s.c_str(); } }; LOGENGINE_NS_END