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.

76 lines
2.4 KiB

#pragma once
#include <cstdint>
#include <memory>
#include <string>
#include <vector>
#include <llosymbol/llosymbol_base.hpp>
#include <lloutils.hpp>
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>
/// opaque value, lifted from the original file format...
/// this is should only be used by code that understands what the underlying file
/// format was...
/// </summary>
std::uint64_t characteristics;
/// <summary>
/// vector of symbols for this section...
/// </summary>
std::vector< std::shared_ptr< llo::symbol::symbol_base_t > > symbols;
/// <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>
/// entry point, where code execution begins....
/// this is lifted from the underlying file format...
/// </summary>
std::shared_ptr< disposition_t > entry;
/// <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;
};
} // namespace llo