1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
/***************************************************************************
* Copyright (C) 2006 Nicolas Hadacek <hadacek@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#ifndef OBJECT_VIEW_H
#define OBJECT_VIEW_H
#include "text_editor.h"
#include "coff/base/coff_archive.h"
#include "coff/base/coff_object.h"
namespace Device { class Data; }
class HexEditor;
namespace Coff
{
class Base;
class TextObject;
//-----------------------------------------------------------------------------
class BaseEditor : public SimpleTextEditor, public Log::Base
{
Q_OBJECT
public:
BaseEditor(const PURL::Url &source, const Device::Data *data, QWidget *parent);
virtual ~BaseEditor();
virtual PURL::Url url() const { return _url; }
protected:
PURL::Url _source, _url;
bool _ok;
Coff::Base *_created;
const Device::Data *_device;
};
//-----------------------------------------------------------------------------
class CoffEditor : public BaseEditor
{
Q_OBJECT
public:
CoffEditor(const PURL::Url &source, const Device::Data &data, QWidget *parent);
CoffEditor(const TextObject &object, QWidget *parent);
virtual PURL::FileType fileType() const { return PURL::Coff; }
virtual bool open(const PURL::Url &url);
private:
const TextObject *_provided;
};
//-----------------------------------------------------------------------------
class ObjectEditor : public BaseEditor
{
Q_OBJECT
public:
ObjectEditor(const PURL::Url &source, QWidget *parent);
virtual PURL::FileType fileType() const { return PURL::Unknown; }
virtual bool open(const PURL::Url &url);
private:
const Coff::Object *coff() const { return static_cast<const Coff::Object *>(_created); }
};
//-----------------------------------------------------------------------------
class LibraryEditor : public BaseEditor
{
Q_OBJECT
public:
LibraryEditor(const PURL::Url &source, QWidget *parent);
virtual PURL::FileType fileType() const { return PURL::Unknown; }
virtual bool open(const PURL::Url &url);
private:
const Coff::Archive *coff() const { return static_cast<const Coff::Archive *>(_created); }
};
} // namespace
//-----------------------------------------------------------------------------
class DisassemblyEditor : public SimpleTextEditor, public Log::Base
{
Q_OBJECT
public:
DisassemblyEditor(const PURL::Url &hexUrl, const Device::Data &data, QWidget *parent);
DisassemblyEditor(const HexEditor &e, const Device::Data &data, QWidget *parent);
virtual PURL::FileType fileType() const { return PURL::AsmGPAsm; }
virtual bool open(const PURL::Url &url);
virtual PURL::Url url() const { return _url; }
private:
PURL::Url _source, _url;
const Device::Data &_device;
const HexEditor *_editor;
};
#endif
|