<commit_before>#ifndef EXCEPTIONNYA_HPP
#define EXCEPTIONNYA_HPP

#include <exception>
#include <sstream>
#include <nya/format.hpp>


/**
 * Exception throwing with std::ostringstream. Stream allows using boost::format.
 *
 * \code{.cpp}
 *    // example
 *    throw_nya &lt;&lt; "File %s is not found"s % fileName;
 * \endcode
 */
#define throw_nya throw nya::exception() = std::ostringstream() << "exception:\n\t" << __FILE__ << ":" << __LINE__ << " >> "


namespace nya
{
class exception : public std::exception
{
	std::string message;
public:
	// can be used only in throw_nya — no idea how to do it better
	nya::exception& operator =(std::ostream& other)
	{
		message = std::move(((std::ostringstream&) other).str());
		return *this;
	}
	
	operator std::string() const { return message; }
	const char* what() const noexcept override { return message.c_str(); }
};
}

#endif //EXCEPTIONNYA_HPP

<commit_msg>message string shortening<commit_after>#ifndef EXCEPTIONNYA_HPP
#define EXCEPTIONNYA_HPP

#include <cstring>
#include <exception>
#include <sstream>
#include <nya/format.hpp>

#ifdef _WIN32
	#define __DELIM_CHAR__ '\\'
#else
	#define __DELIM_CHAR__ '/'
#endif
#define __FILENAME__ (strrchr(__FILE__, __DELIM_CHAR__) ? strrchr(__FILE__, __DELIM_CHAR__) + 1 : __FILE__)

/**
 * Exception throwing with std::ostringstream. Stream allows using boost::format.
 *
 * \code{.cpp}
 *    // example
 *    throw_nya &lt;&lt; "File %s is not found"s % fileName;
 * \endcode
 */
#define throw_nya throw nya::exception() = std::ostringstream() << __FILENAME__ << ":" << __LINE__ << " -- "


namespace nya
{
class exception : public std::exception
{
	std::string message;
public:
	// can be used only in throw_nya — no idea how to do it better
	nya::exception& operator =(std::ostream& other)
	{
		message = std::move(((std::ostringstream&) other).str());
		return *this;
	}
	
	operator std::string() const { return message; }
	const char* what() const noexcept override { return message.c_str(); }
};
}

#endif //EXCEPTIONNYA_HPP


{'fraction_non_alphanumeric': 0.15179891572203055, 'fraction_numerical': 0.0014785608674223755, 'mean_word_length': 4.53133514986376, 'pattern_counts': {'":': 2, '<': 28, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6162366', 'n_tokens_mistral': 720, 'n_tokens_neox': 680, 'n_words': 187}