OpenASIP  2.0
ProDeOptions.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 ProDeOptions.cc
26  *
27  * Implementation of class ProDeOptions.
28  *
29  * @author Veli-Pekka Jääskeläinen 2005 (vjaaskel-no.spam-cs.tut.fi)
30  * @note rating: red
31  */
32 
33 #include <cassert>
34 
35 #include "ProDeOptions.hh"
36 #include "Conversion.hh"
37 #include "SequenceTools.hh"
38 #include "ObjectState.hh"
39 
40 using std::string;
41 
42 // initialization of static data members
43 const string ProDeOptions::CONFIGURATION_NAME = "prode-configuration";
44 const string ProDeOptions::OSKEY_UNDO_STACK_SIZE = "undosize";
45 
46 
47 /**
48  * Constructor.
49  */
51  GUIOptions(CONFIGURATION_NAME),
52  undoStackSize_(10) {
53 }
54 
55 
56 /**
57  * Constructor.
58  *
59  * Loads the state from the given ObjectState tree.
60  *
61  * @param state The ObjectState tree.
62  * @exception ObjectStateLoadingException If the given ObjectState tree is
63  * invalid.
64  */
66  : GUIOptions(CONFIGURATION_NAME) {
67  loadState(state);
68 }
69 
70 /**
71  * Copy constructor.
72  *
73  * This constructor creates identical options with the given options class.
74  */
76  GUIOptions(old) {
77 
79 }
80 
81 
82 /**
83  * Destructor.
84  */
86 }
87 
88 
89 /**
90  * Returns the size of the undo stack.
91  *
92  * @return The size of the undo stack.
93  */
94 int
96  return undoStackSize_;
97 }
98 
99 
100 /**
101  * Sets the size of the undo stack.
102  *
103  * @param size The new size.
104  */
105 void
107  undoStackSize_ = size;
108 }
109 
110 
111 /**
112  * Loads the state of the object from the given ObjectState object.
113  *
114  * @param state ObjectState from which the state is loaded.
115  * @exception ObjectStateLoadingException If the given ObjectState instance
116  * is invalid.
117  */
118 void
122 
123  const string procName = "ProDeOptions::loadState";
124 
125  GUIOptions::loadState(state);
126 
127  try {
129  } catch (...) {
132  throw ObjectStateLoadingException(__FILE__, __LINE__, procName);
133  }
134 }
135 
136 /**
137  * Creates an ObjectState object and saves the state of the object into it.
138  *
139  * @return The created ObjectState object.
140  */
145  return state;
146 }
GUIOptions::deleteAllKeyboardShortcuts
void deleteAllKeyboardShortcuts()
Definition: GUIOptions.cc:745
ProDeOptions
Definition: ProDeOptions.hh:44
ObjectStateLoadingException
Definition: Exception.hh:551
GUIOptions::saveState
virtual ObjectState * saveState() const
Definition: GUIOptions.cc:700
SequenceTools.hh
ObjectState
Definition: ObjectState.hh:59
GUIOptions::deleteAllToolbarButtons
void deleteAllToolbarButtons()
Definition: GUIOptions.cc:754
ProDeOptions::setUndoStackSize
void setUndoStackSize(int size)
Definition: ProDeOptions.cc:106
ProDeOptions::undoStackSize_
int undoStackSize_
Undo stack size.
Definition: ProDeOptions.hh:65
ProDeOptions::ProDeOptions
ProDeOptions()
Definition: ProDeOptions.cc:50
ProDeOptions::loadState
void loadState(const ObjectState *state)
Definition: ProDeOptions.cc:119
GUIOptions::loadState
virtual void loadState(const ObjectState *state)
Definition: GUIOptions.cc:645
Conversion.hh
ObjectState.hh
ProDeOptions::OSKEY_UNDO_STACK_SIZE
static const std::string OSKEY_UNDO_STACK_SIZE
ObjectState attribute key for the size of the undo stack.
Definition: ProDeOptions.hh:61
ProDeOptions::saveState
ObjectState * saveState() const
Definition: ProDeOptions.cc:142
ProDeOptions::~ProDeOptions
virtual ~ProDeOptions()
Definition: ProDeOptions.cc:85
GUIOptions
Definition: GUIOptions.hh:58
ProDeOptions.hh
ProDeOptions::undoStackSize
int undoStackSize() const
Definition: ProDeOptions.cc:95
ObjectState::intAttribute
int intAttribute(const std::string &name) const
Definition: ObjectState.cc:276
ObjectState::setAttribute
void setAttribute(const std::string &name, const std::string &value)
Definition: ObjectState.cc:100
ProDeOptions::CONFIGURATION_NAME
static const std::string CONFIGURATION_NAME
ObjectState name for ProDeOptions.
Definition: ProDeOptions.hh:59