OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
OSEd Class Reference

#include <OSEd.hh>

Inheritance diagram for OSEd:
Inheritance graph
Collaboration diagram for OSEd:
Collaboration graph

Public Member Functions

 OSEd ()
 
virtual ~OSEd ()
 
virtual bool OnInit ()
 
virtual int OnExit ()
 
OSEdMainFramemainFrame () const
 
OSEdOptionsoptions () const
 

Private Member Functions

 OSEd (const OSEd &)
 Copying not allowed.
 
OSEdoperator= (const OSEd &)
 Assignment not allowed.
 
void createDefaultOptions ()
 

Private Attributes

OSEdMainFramemainFrame_
 Main window of the application.
 
OSEdOptionsoptions_
 Options of the application.
 

Detailed Description

Main class for OSEd (Operation Set Editor).

Initializes the application.

Definition at line 47 of file OSEd.hh.

Constructor & Destructor Documentation

◆ OSEd() [1/2]

OSEd::OSEd ( )

Constructor.

Definition at line 62 of file OSEd.cc.

62 : mainFrame_(NULL), options_(NULL) {
63}
OSEdMainFrame * mainFrame_
Main window of the application.
Definition OSEd.hh:67
OSEdOptions * options_
Options of the application.
Definition OSEd.hh:69

◆ ~OSEd()

OSEd::~OSEd ( )
virtual

Destructor.

Definition at line 68 of file OSEd.cc.

68 {
69}

◆ OSEd() [2/2]

OSEd::OSEd ( const OSEd )
private

Copying not allowed.

Member Function Documentation

◆ createDefaultOptions()

void OSEd::createDefaultOptions ( )
private

Creates the default options and writes them to the file.

Definition at line 163 of file OSEd.cc.

163 {
165 OSEdOptionsSerializer serializer;
166 string confFile =
168 serializer.setDestinationFile(confFile);
169 try {
170 serializer.writeState(options_->saveState());
171 } catch (const Exception& e) {
172 cerr << "Writing options failed: " << e.errorMessage() << endl;
173 }
174}
static TCEString userConfPath(const std::string &fileName)
std::string errorMessage() const
Definition Exception.cc:123
static const std::string DEFAULT_EDITOR
Default editor name.
static const std::string CONF_FILE_NAME
Configuration file name.
virtual void writeState(const ObjectState *state)
void setDestinationFile(const std::string &fileName)
void setEditor(const std::string &editor)
ObjectState * saveState() const

References OSEdConstants::CONF_FILE_NAME, OSEdConstants::DEFAULT_EDITOR, Exception::errorMessage(), options_, OSEdOptions::saveState(), OSEdOptionsSerializer::setDestinationFile(), OSEdOptions::setEditor(), Environment::userConfPath(), and OSEdOptionsSerializer::writeState().

Referenced by OnInit().

Here is the call graph for this function:

◆ mainFrame()

OSEdMainFrame * OSEd::mainFrame ( ) const

Returns the main frame of the application.

Returns
The main frame of the application.

Definition at line 145 of file OSEd.cc.

145 {
146 return mainFrame_;
147}

References mainFrame_.

◆ OnExit()

int OSEd::OnExit ( )
virtual

Deletes the application level dynamic objects not handled by wxWindows.

This function is called when application is about to exit.

Returns
0.

Definition at line 131 of file OSEd.cc.

131 {
134 delete options_;
135 options_ = NULL;
136 return 0;
137}

References OperationContainer::destroy(), OSEdTextGenerator::destroy(), and options_.

Here is the call graph for this function:

◆ OnInit()

bool OSEd::OnInit ( )
virtual

Initializes the application.

Creates mainframe as well as reads the configure file.

Returns
True.

Definition at line 79 of file OSEd.cc.

79 {
80
82
83 mainFrame_ = new OSEdMainFrame(_T("Operation Set Editor"),
84 wxPoint(50, 50), wxSize(900, 500));
85
87
88 options_ = new OSEdOptions();
89 OSEdOptionsSerializer serializer;
90
92 serializer.setSourceFile(confFile);
93
94 try {
95 options_->loadState(serializer.readState());
96 } catch (const Exception& e) {
97 cerr << "Config file not found, default options will be used." << endl
98 << "OseD may use the editor in your $VISUAL"
99 << " environmental variable." << endl
100 << "If this points to some non-graphical editor, "
101 << "please change the editor from settings." << endl;
103 }
104
106
107 OSEdTreeView* treeView = mainFrame_->treeView();
108 vector<string> results = treeView->constructTree();
109 // if some errors occurred while buildin the tree view, error message is
110 // shown
111 if (results.size() > 0) {
113 ResultDialog result(mainFrame_, results, fmt.str());
114 result.ShowModal();
115 }
116
117 mainFrame_->Show(true);
118 SetTopWindow(mainFrame_);
119
120 return true;
121}
static void initialize()
static TCEString confPath(const std::string &fileName)
OSEdTreeView * treeView() const
virtual ObjectState * readState()
void setSourceFile(const std::string &fileName)
virtual void loadState(const ObjectState *state)
static OSEdTextGenerator & instance()
@ TXT_XML_RESULT_DIALOG_TITLE
XML result dialog title.
std::vector< std::string > constructTree()
void createDefaultOptions()
Definition OSEd.cc:163
virtual boost::format text(int textId)
static char ** toCStringArray(size_t elements, wxChar **source)

References OSEdConstants::CONF_FILE_NAME, Environment::confPath(), OSEdTreeView::constructTree(), createDefaultOptions(), Application::initialize(), OSEdTextGenerator::instance(), OSEdOptions::loadState(), mainFrame_, options_, OSEdOptionsSerializer::readState(), OSEdOptionsSerializer::setSourceFile(), Texts::TextGenerator::text(), WxConversion::toCStringArray(), OSEdMainFrame::treeView(), OSEdTextGenerator::TXT_XML_RESULT_DIALOG_TITLE, and OSEdMainFrame::updateMenuBar().

Here is the call graph for this function:

◆ operator=()

OSEd & OSEd::operator= ( const OSEd )
private

Assignment not allowed.

◆ options()

OSEdOptions * OSEd::options ( ) const

Returns the options of the application.

Returns
The options of the application.

Definition at line 155 of file OSEd.cc.

155 {
156 return options_;
157}

References options_.

Member Data Documentation

◆ mainFrame_

OSEdMainFrame* OSEd::mainFrame_
private

Main window of the application.

Definition at line 67 of file OSEd.hh.

Referenced by mainFrame(), and OnInit().

◆ options_

OSEdOptions* OSEd::options_
private

Options of the application.

Definition at line 69 of file OSEd.hh.

Referenced by createDefaultOptions(), OnExit(), OnInit(), and options().


The documentation for this class was generated from the following files: