further implementing
This commit is contained in:
parent
248b228dbf
commit
81b4bcd4af
|
@ -109,7 +109,7 @@ open(PyObject *self, PyObject *args)
|
|||
|
||||
reader.setFile(EncodedName.c_str());
|
||||
|
||||
reader.readToc();
|
||||
reader.read();
|
||||
|
||||
|
||||
// create new document and add Import feature
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1,3 +1,35 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) Juergen Riegel <juergen.riegel@web.de> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
#endif
|
||||
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/FileInfo.h>
|
||||
|
||||
#include "TestJtReader.h"
|
||||
|
||||
|
||||
|
@ -12,7 +44,13 @@ TestJtReader::~TestJtReader()
|
|||
|
||||
void TestJtReader::read(void)
|
||||
{
|
||||
readToc();
|
||||
const std::vector<TOC_Entry>& toc = readToc();
|
||||
|
||||
for (std::vector<TOC_Entry>::const_iterator i = TocEntries.begin(); i != TocEntries.end(); ++i){
|
||||
int segType = i->getSegmentType();
|
||||
|
||||
Base::Console().Log(i->toString().c_str());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#pragma once
|
||||
|
||||
#include "JrJt/JtReader.h"
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user