<commit_before>///
/// @file      ar/internal/extractor.h
/// @copyright (c) 2015 by <NAME> (<EMAIL>) and contributors
/// @license   MIT, see the @c LICENSE file for more details
/// @brief     Extractor of files from an archive.
///

#ifndef AR_INTERNAL_EXTRACTOR_H
#define AR_INTERNAL_EXTRACTOR_H

#include <cstdint>
#include <memory>
#include <string>

namespace ar {

class Files;

namespace internal {

///
/// Extractor of files from an archive.
///
class Extractor {
public:
	Extractor();
	~Extractor();

	Files extract(const std::string& archiveContent);

	/// @name Disabled
	/// @{
	Extractor(const Extractor&) = delete;
	Extractor(Extractor&&) = delete;
	Extractor& operator=(const Extractor&) = delete;
	Extractor& operator=(Extractor&&) = delete;
	/// @}

private:
	void readMagicString();
	void readLookupTable();
	Files readFiles();
	std::unique_ptr<File> readFile();
	std::string readFileName();
	void readFileTimestamp();
	void readFileOwnerId();
	void readFileGroupId();
	void readFileMode();
	std::size_t readFileSize();
	void readUntilEndOfFileHeader();
	std::string readFileContent(std::size_t fileSize);

	void skipSpaces();
	std::size_t readNumber(const std::string& name);

	void ensureContainsSlashOnPosition(std::string::size_type pos);
	void ensureContainsFileHeaderOnPosition(std::string::size_type pos);
	void ensureContentOfGivenSizeWasRead(std::size_t readContentSize,
		std::size_t expectedContentSize);
	void ensureNumberWasRead(const std::string& numAsStr,
		const std::string& name);

private:<commit_msg>Put private Extractor member functions into groups (doxygen).<commit_after>///
/// @file      ar/internal/extractor.h
/// @copyright (c) 2015 by <NAME> (<EMAIL>) and contributors
/// @license   MIT, see the @c LICENSE file for more details
/// @brief     Extractor of files from an archive.
///

#ifndef AR_INTERNAL_EXTRACTOR_H
#define AR_INTERNAL_EXTRACTOR_H

#include <cstdint>
#include <memory>
#include <string>

namespace ar {

class Files;

namespace internal {

///
/// Extractor of files from an archive.
///
class Extractor {
public:
	Extractor();
	~Extractor();

	Files extract(const std::string& archiveContent);

	/// @name Disabled
	/// @{
	Extractor(const Extractor&) = delete;
	Extractor(Extractor&&) = delete;
	Extractor& operator=(const Extractor&) = delete;
	Extractor& operator=(Extractor&&) = delete;
	/// @}

private:
	/// @name Reading
	/// @{
	void readMagicString();
	void readLookupTable();
	Files readFiles();
	std::unique_ptr<File> readFile();
	std::string readFileName();
	void readFileTimestamp();
	void readFileOwnerId();
	void readFileGroupId();
	void readFileMode();
	std::size_t readFileSize();
	void readUntilEndOfFileHeader();
	std::string readFileContent(std::size_t fileSize);

	/// @name Utilities
	/// @{
	void skipSpaces();
	std::size_t readNumber(const std::string& name);
	/// @}

	/// @name Validation
	/// @{
	void ensureContainsSlashOnPosition(std::string::size_type pos);
	void ensureContainsFileHeaderOnPosition(std::string::size_type pos);
	void ensureContentOfGivenSizeWasRead(std::size_t readContentSize,
		std::size_t expectedContentSize);
	void ensureNumberWasRead(const std::string& numAsStr,
		const std::string& name);
	/// @}

private:
{'fraction_non_alphanumeric': 0.14294554455445543, 'fraction_numerical': 0.0024752475247524753, 'mean_word_length': 5.0092936802973975, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '3374052', 'n_tokens_mistral': 1075, 'n_tokens_neox': 1035, 'n_words': 260}