OpenASIP  2.0
GUIOptionsSerializer.hh
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 GUIOptionsSerializer.hh
26  *
27  * Declaration of GUIOptionsSerializer class.
28  *
29  * @author Lasse Laasonen 2004 (lasse.laasonen-no.spam-tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef GUI_OPTIONS_SERIALIZER_HH
34 #define GUI_OPTIONS_SERIALIZER_HH
35 
36 #include <string>
37 
38 #include "XMLSerializer.hh"
39 #include "Exception.hh"
40 
41 class GUIOptions;
42 
43 /**
44  * Reads and writes options of a graphical user interface from an XML file.
45  *
46  * This is a base class which provides storing of options common to all
47  * GUIs, such as window size and position, toolbar contents and list of
48  * keyboard shortcuts. If a GUI needs application specific options,
49  * a custom options serializer can be derived from this class. See design
50  * documentation for details.
51  */
53 public:
54  GUIOptionsSerializer(std::string configurationName);
55  virtual ~GUIOptionsSerializer();
56 
57  void writeState(const ObjectState* optionsState);
59  void writeOptions(const GUIOptions& options);
61 
62 protected:
64  const ObjectState* options) const;
66  const ObjectState* root) const;
67 
68 private:
70  const ObjectState* windowElem,
71  ObjectState* options) const;
73  const ObjectState* toolbarElem,
74  ObjectState* options) const;
76  const ObjectState* ksElem,
77  ObjectState* options) const;
78 
79  /// Copying not allowed.
81  /// Assignment not allowed.
83  /// Name of the configuration to read/write.
84  std::string configurationName_;
85 };
86 
87 #endif
GUIOptionsSerializer::readOptions
GUIOptions * readOptions()
Definition: GUIOptionsSerializer.cc:178
GUIOptionsSerializer::setWindowProperties
void setWindowProperties(const ObjectState *windowElem, ObjectState *options) const
Definition: GUIOptionsSerializer.cc:390
GUIOptionsSerializer::operator=
GUIOptionsSerializer & operator=(const GUIOptionsSerializer &)
Assignment not allowed.
Exception.hh
ObjectState
Definition: ObjectState.hh:59
GUIOptionsSerializer::readState
ObjectState * readState()
Definition: GUIOptionsSerializer.cc:149
GUIOptionsSerializer::convertToConfigFileFormat
virtual ObjectState * convertToConfigFileFormat(const ObjectState *options) const
Definition: GUIOptionsSerializer.cc:194
XMLSerializer.hh
GUIOptionsSerializer::setToolbarProperties
void setToolbarProperties(const ObjectState *toolbarElem, ObjectState *options) const
Definition: GUIOptionsSerializer.cc:430
options
static MachInfoCmdLineOptions options
Definition: MachInfo.cc:46
GUIOptions
Definition: GUIOptions.hh:58
GUIOptionsSerializer::addKeyboardShortcut
void addKeyboardShortcut(const ObjectState *ksElem, ObjectState *options) const
Definition: GUIOptionsSerializer.cc:495
GUIOptionsSerializer::convertToOptionsObjectFormat
virtual ObjectState * convertToOptionsObjectFormat(const ObjectState *root) const
Definition: GUIOptionsSerializer.cc:343
GUIOptionsSerializer::writeOptions
void writeOptions(const GUIOptions &options)
Definition: GUIOptionsSerializer.cc:163
GUIOptionsSerializer::configurationName_
std::string configurationName_
Name of the configuration to read/write.
Definition: GUIOptionsSerializer.hh:84
XMLSerializer
Definition: XMLSerializer.hh:62
GUIOptionsSerializer::~GUIOptionsSerializer
virtual ~GUIOptionsSerializer()
Definition: GUIOptionsSerializer.cc:122
GUIOptionsSerializer::writeState
void writeState(const ObjectState *optionsState)
Definition: GUIOptionsSerializer.cc:135
GUIOptionsSerializer::GUIOptionsSerializer
GUIOptionsSerializer(std::string configurationName)
Definition: GUIOptionsSerializer.cc:113
GUIOptionsSerializer
Definition: GUIOptionsSerializer.hh:52