OpenASIP 2.2
Loading...
Searching...
No Matches
OSEdOptions.cc
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2009 Tampere University.
3
4 This file is part of TTA-Based Codesign Environment (TCE).
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23 */
24/**
25 * @file OSEdOptions.cc
26 *
27 * Definition of OSEdOptions class.
28 *
29 * @author Jussi Nykänen 2004 (nykanen-no.spam-cs.tut.fi)
30 * @note rating: red
31 */
32
33#include "OSEdOptions.hh"
34#include "ObjectState.hh"
35
36using std::string;
37
38const string OSED_CONF = "osed-configuration";
39const string OSED_EDITOR = "editor";
40
41/**
42 * Constructor.
43 */
44OSEdOptions::OSEdOptions() : editor_("") {
45}
46
47/**
48 * Destructor.
49 */
52
53/**
54 * Returns the editor.
55 *
56 * @return The editor.
57 */
58string
60 return editor_;
61}
62
63/**
64 * Sets the editor.
65 *
66 * @param editor. Editor to be set.
67 */
68void
69OSEdOptions::setEditor(const std::string& editor) {
71}
72
73/**
74 * Loads the state from the object tree.
75 *
76 * @param state The to be loaded.
77 */
78void
80 try {
81 for (int i = 0; i < state->childCount(); i++) {
82 ObjectState* child = state->child(i);
83 if (child->name() == OSED_EDITOR) {
84 editor_ = child->stringValue();
85 }
86 }
87 } catch (const Exception& e) {
88 string method = "OSEdOptions::loadState()";
89 string msg = "Problems loading state: " + e.errorMessage();
90 throw ObjectStateLoadingException(__FILE__, __LINE__, method, msg);
91 }
92}
93
94/**
95 * Saves the state of the options in ObjectState tree.
96 *
97 * @return The created ObjectState tree.
98 */
101 ObjectState* root = new ObjectState(OSED_CONF);
103 editor->setValue(editor_);
104 root->addChild(editor);
105 return root;
106}
const string OSED_EDITOR
const string OSED_CONF
std::string errorMessage() const
Definition Exception.cc:123
virtual ~OSEdOptions()
void setEditor(const std::string &editor)
virtual void loadState(const ObjectState *state)
std::string editor_
Editor used to edit operation behavior files.
ObjectState * saveState() const
std::string editor() const
ObjectState * child(int index) const
void addChild(ObjectState *child)
std::string stringValue() const
std::string name() const
int childCount() const