further implementing

This commit is contained in:
jriegel
2014-12-13 11:58:58 +01:00
committed by Stefan Tröger
parent 5a4c14ecc1
commit 6a26cbc2a1
7 changed files with 74 additions and 10 deletions

View File

@@ -23,7 +23,8 @@
#ifndef GUID_HEADER
#define GUID_HEADER
#include <istream>
#include <iostream>
#include <sstream>
#include <stdint.h>
#include "U8.h"
@@ -62,6 +63,12 @@ struct GUID
_C8.read(cont);
}
std::string toString()const{
std::stringstream strm;
strm << "{" << std::hex << _A1 << "-" << _B1 << _B2 << "-" << _C1 << _C2 << _C3 << _C4 << _C5 << _C6 << _C7 << _C8 << "}";
return strm.str();
}
U32 _A1;
U16 _B1;

View File

@@ -30,7 +30,7 @@ void JtReader::setFile(const std::string fileName)
this->_fileName = fileName;
}
void JtReader::readToc()
const std::vector<TOC_Entry>& JtReader::readToc()
{
ifstream strm;
@@ -56,11 +56,11 @@ void JtReader::readToc()
I32 Entry_Count(cont);
vector<TOC_Entry> TocEntries(Entry_Count);
TocEntries.resize(Entry_Count);
for (std::vector<TOC_Entry>::iterator i = TocEntries.begin(); i != TocEntries.end(); ++i)
i->read(cont);
return TocEntries;
}

View File

@@ -1,6 +1,8 @@
#pragma once
#include <string>
#include <vector>
#include "TOC_Entry.h"
class JtReader
@@ -11,11 +13,16 @@ public:
void setFile(const std::string fileName);
void readToc();
const std::vector<TOC_Entry>& readToc();
void readSegment(int tocIndex);
protected:
std::string _fileName;
vector<TOC_Entry> TocEntries;
};

View File

@@ -54,6 +54,18 @@ struct TOC_Entry
Segment_Attributes.read(cont);
};
uint8_t getSegmentType()const
{
return Segment_Attributes << 24;
}
std::string toString()const{
stringstream strm;
strm << getSegmentType() << ":" << Segment_Offset << ":" << Segment_Length << ":" << Segment_ID.toString();
return strm.str();
}
GUID Segment_ID;
I32 Segment_Offset;
I32 Segment_Length;