You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
2.5 KiB
73 lines
2.5 KiB
#pragma once
|
|
#include <cstdint>
|
|
#include <lloutils.hpp>
|
|
#include <memory>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace llo
|
|
{
|
|
/// <summary>
|
|
/// lloiff class which contains all of the information for representing a file format in a IL format...
|
|
/// </summary>
|
|
class lloiff_t
|
|
{
|
|
public:
|
|
/// <summary>
|
|
/// iff section struct containing IL information about a section...
|
|
/// </summary>
|
|
struct iff_section_t
|
|
{
|
|
/// <summary>
|
|
/// section name, hashed so that there can be multiple...
|
|
/// </summary>
|
|
llo::utils::hash_t< std::string > section_name;
|
|
|
|
/// <summary>
|
|
/// vector of raw bytes containing the original bytes of this section...
|
|
/// </summary>
|
|
std::vector< std::uint8_t > raw;
|
|
};
|
|
|
|
/// <summary>
|
|
/// explicit constructor, must pass a name and the original file as a vector of bytes...
|
|
/// </summary>
|
|
/// <param name="name">name for this iff object...</param>
|
|
/// <param name="raw">vector of raw bytes containing the original file...</param>
|
|
explicit lloiff_t( const std::string &name, const std::vector< std::uint8_t > &raw ) : name( name ), raw( raw )
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// makes a shared pointer containing a llo::lloiff_t...
|
|
/// </summary>
|
|
/// <param name="name">name of the file...</param>
|
|
/// <param name="raw">vector of bytes containing the raw file...</param>
|
|
/// <returns>returns a shared pointer of the new object...</returns>
|
|
static std::shared_ptr< llo::lloiff_t > make( const std::string &name, const std::vector< std::uint8_t > &raw )
|
|
{
|
|
return std::make_shared< llo::lloiff_t >( name, raw );
|
|
}
|
|
|
|
/// <summary>
|
|
/// name of the iff file, hashed so there can be unique objects...
|
|
/// </summary>
|
|
llo::utils::hash_t< std::string > name;
|
|
|
|
/// <summary>
|
|
/// vector of iff sections...
|
|
/// </summary>
|
|
std::vector< iff_section_t > sections;
|
|
|
|
/// <summary>
|
|
/// vector of bytes containing the entire original file...
|
|
/// </summary>
|
|
std::vector< std::uint8_t > raw;
|
|
|
|
/// <summary>
|
|
/// some file formats contain multiple other files inside of them such as LIB...
|
|
/// which is just an archive of OBJ's...
|
|
/// </summary>
|
|
std::vector< std::shared_ptr< llo::lloiff_t > > children;
|
|
};
|
|
} // namespace llo
|