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

#include <GUIOptionsSerializer.hh>

Inheritance diagram for GUIOptionsSerializer:
Inheritance graph
Collaboration diagram for GUIOptionsSerializer:
Collaboration graph

Public Member Functions

 GUIOptionsSerializer (std::string configurationName)
 
virtual ~GUIOptionsSerializer ()
 
void writeState (const ObjectState *optionsState)
 
ObjectStatereadState ()
 
void writeOptions (const GUIOptions &options)
 
GUIOptionsreadOptions ()
 
- Public Member Functions inherited from XMLSerializer
 XMLSerializer ()
 
virtual ~XMLSerializer ()
 
void setSourceFile (const std::string &fileName)
 
void setSourceString (const std::string &source)
 
void setDestinationFile (const std::string &fileName)
 
void setDestinationString (std::string &destination)
 
void setSchemaFile (const std::string &fileName)
 
void setUseSchema (bool useSchema)
 
void setXMLNamespace (std::string nsUri)
 
- Public Member Functions inherited from TCETools::Serializer
virtual ~Serializer ()
 

Protected Member Functions

virtual ObjectStateconvertToConfigFileFormat (const ObjectState *options) const
 
virtual ObjectStateconvertToOptionsObjectFormat (const ObjectState *root) const
 
- Protected Member Functions inherited from XMLSerializer
std::string sourceFile () const
 

Private Member Functions

void setWindowProperties (const ObjectState *windowElem, ObjectState *options) const
 
void setToolbarProperties (const ObjectState *toolbarElem, ObjectState *options) const
 
void addKeyboardShortcut (const ObjectState *ksElem, ObjectState *options) const
 
 GUIOptionsSerializer (const GUIOptionsSerializer &)
 Copying not allowed.
 
GUIOptionsSerializeroperator= (const GUIOptionsSerializer &)
 Assignment not allowed.
 

Private Attributes

std::string configurationName_
 Name of the configuration to read/write.
 

Detailed Description

Reads and writes options of a graphical user interface from an XML file.

This is a base class which provides storing of options common to all GUIs, such as window size and position, toolbar contents and list of keyboard shortcuts. If a GUI needs application specific options, a custom options serializer can be derived from this class. See design documentation for details.

Definition at line 52 of file GUIOptionsSerializer.hh.

Constructor & Destructor Documentation

◆ GUIOptionsSerializer() [1/2]

GUIOptionsSerializer::GUIOptionsSerializer ( std::string  name)

Constructor.

Parameters
nameName of the configuration.

Definition at line 113 of file GUIOptionsSerializer.cc.

113 :
115 configurationName_(name) {
116}
std::string configurationName_
Name of the configuration to read/write.

◆ ~GUIOptionsSerializer()

GUIOptionsSerializer::~GUIOptionsSerializer ( )
virtual

Destructor.

Definition at line 122 of file GUIOptionsSerializer.cc.

122 {
123}

◆ GUIOptionsSerializer() [2/2]

GUIOptionsSerializer::GUIOptionsSerializer ( const GUIOptionsSerializer )
private

Copying not allowed.

Member Function Documentation

◆ addKeyboardShortcut()

void GUIOptionsSerializer::addKeyboardShortcut ( const ObjectState ksElem,
ObjectState options 
) const
private

Adds a keyboard shortcut to the given options according to the given keyboard-shortcut element.

Parameters
ksElemObjectState representing a keyboard-shortcut element in options file.
optionsOptions ObjectState which is modified.

Definition at line 495 of file GUIOptionsSerializer.cc.

497 {
498
499 ObjectState* shortcut =
501 options->addChild(shortcut);
502
503 ObjectState* keyCombElem = ksElem->childByName(KS_KEY_COMBINATION);
504 if (keyCombElem->hasChild(KEY_COMB_CTRL)) {
506 } else {
508 }
509
510 if (keyCombElem->hasChild(KEY_COMB_ALT)) {
512 } else {
514 }
515
516 if (keyCombElem->hasChild(KEY_COMB_KEY)) {
517 ObjectState* keyElem = keyCombElem->childByName(KEY_COMB_KEY);
518 string key = keyElem->stringAttribute(KEY_VALUE);
519 char keyChar = 0;
520
521 // delete key requires extra checking
522 if (key == DELETE_KEY) {
523 keyChar = 127; // ASCII 127 = DEL
524 } else {
525 keyChar = *(key.c_str());
526 }
527
528 shortcut->setAttribute(KeyboardShortcut::OSKEY_KEY, keyChar);
529 }
530
531 if (keyCombElem->hasChild(KEY_COMB_FKEY)) {
532 ObjectState* fKeyElem = keyCombElem->childByName(KEY_COMB_FKEY);
533 int number = fKeyElem->intAttribute(FKEY_NUMBER);
535 }
536
537 ObjectState* actionElem = ksElem->childByName(KS_ACTION);
538 string action = actionElem->stringValue();
540}
const string DELETE_KEY
String to mean delete key.
const string KEY_VALUE
Name of the attribute which declares the actual key of the key element.
const string KS_KEY_COMBINATION
Name of the element declaring key combination.
const string KEY_COMB_KEY
Name of the element meaning some other key in key combination.
const string KEY_COMB_ALT
Name of the element meaning alt key in key combination.
const string KEY_COMB_FKEY
Name of the element meaning some function key in key combination.
const string FKEY_NUMBER
Name of the attribute declaring function key number.
const string KS_ACTION
Name of the element declaring the action performed by the keyboard shortcut.
const string KEY_COMB_CTRL
Name of the element meaning ctrl key in key combination.
static MachInfoCmdLineOptions options
Definition MachInfo.cc:46
static const std::string OSKEY_KEY
ObjectState attribute key for normal letter or number key.
static const std::string OSKEY_ALT
ObjectState attribute key for alt key.
static const std::string OSKEY_FKEY
ObjectState attribute key for function key number.
static const std::string OSKEY_ACTION
ObjectState attribute key for action name.
static const std::string OSKEY_CTRL
ObjectState attribute key for ctrl key.
static const std::string OSNAME_KEYBOARD_SHORTCUT
ObjectState name for keyboard shortcut.
ObjectState * childByName(const std::string &name) const
void setAttribute(const std::string &name, const std::string &value)
bool hasChild(const std::string &name) const
std::string stringAttribute(const std::string &name) const
int intAttribute(const std::string &name) const
std::string stringValue() const

References ObjectState::childByName(), DELETE_KEY, FKEY_NUMBER, ObjectState::hasChild(), ObjectState::intAttribute(), KEY_COMB_ALT, KEY_COMB_CTRL, KEY_COMB_FKEY, KEY_COMB_KEY, KEY_VALUE, KS_ACTION, KS_KEY_COMBINATION, options, KeyboardShortcut::OSKEY_ACTION, KeyboardShortcut::OSKEY_ALT, KeyboardShortcut::OSKEY_CTRL, KeyboardShortcut::OSKEY_FKEY, KeyboardShortcut::OSKEY_KEY, KeyboardShortcut::OSNAME_KEYBOARD_SHORTCUT, ObjectState::setAttribute(), ObjectState::stringAttribute(), and ObjectState::stringValue().

Referenced by convertToOptionsObjectFormat().

Here is the call graph for this function:

◆ convertToConfigFileFormat()

ObjectState * GUIOptionsSerializer::convertToConfigFileFormat ( const ObjectState options) const
protectedvirtual

Converts the given ObjectState tree created by GUIOptions::saveState to the format of configuration file.

Parameters
optionsObjectState tree to be converted.
Returns
The newly created ObjectState tree which matches with configuration file format.

Reimplemented in ProDeOptionsSerializer.

Definition at line 194 of file GUIOptionsSerializer.cc.

195 {
196
198
199 // add window element
200 ObjectState* window = new ObjectState(WINDOW);
201 root->addChild(window);
202
203 ObjectState* fullScreen = new ObjectState(WI_FULLSCREEN);
204 window->addChild(fullScreen);
205 if (options->intAttribute(GUIOptions::OSKEY_FULL_SCREEN)) {
206 fullScreen->setValue(TRUE);
207 } else {
208 fullScreen->setValue(FALSE);
209 }
210
211 ObjectState* width = new ObjectState(WI_WIDTH);
212 window->addChild(width);
213 width->setValue(options->stringAttribute(GUIOptions::OSKEY_WINDOW_WIDTH));
214
215 ObjectState* height = new ObjectState(WI_HEIGHT);
216 window->addChild(height);
217 height->setValue(
218 options->stringAttribute(GUIOptions::OSKEY_WINDOW_HEIGHT));
219
221 window->addChild(xPos);
222 xPos->setValue(options->stringAttribute(GUIOptions::OSKEY_X_POS));
223
225 window->addChild(yPos);
226 yPos->setValue(options->stringAttribute(GUIOptions::OSKEY_Y_POS));
227
228 // add toolbar element
229 ObjectState* toolbar = new ObjectState(TOOLBAR);
230 root->addChild(toolbar);
231
232 ObjectState* layout = new ObjectState(TB_LAYOUT);
233 toolbar->addChild(layout);
234
235 string toolbarLayout = options->
236 stringAttribute(GUIOptions::OSKEY_TOOLBAR_LAYOUT);
237 if (toolbarLayout == GUIOptions::OSVALUE_TEXT) {
238 layout->addChild(new ObjectState(TB_LA_TEXT));
239 } else if (toolbarLayout == GUIOptions::OSVALUE_ICON) {
240 layout->addChild(new ObjectState(TB_LA_ICON));
241 } else {
242 layout->addChild(new ObjectState(TB_LA_TEXT));
243 layout->addChild(new ObjectState(TB_LA_ICON));
244 }
245
246 ObjectState* visible = new ObjectState(TB_VISIBLE);
247 toolbar->addChild(visible);
248 int vis =
250 if (vis) {
251 visible->setValue(TRUE);
252 } else {
253 visible->setValue(FALSE);
254 }
255
256 // add toolbar buttons
257 for (int i = 0; i < options->childCount(); i++) {
258 ObjectState* child = options->child(i);
260 ObjectState* slot = new ObjectState(TB_SLOT);
261 toolbar->addChild(slot);
263 child->stringAttribute(
266 slot->addChild(action);
267 action->setValue(child->stringAttribute(
269 }
270 }
271
272 // add toolbar separators
273 for (int i = 0; i < options->childCount(); i++) {
274 ObjectState* child = options->child(i);
275 if (child->name() == GUIOptions::OSNAME_SEPARATOR) {
276 ObjectState* separator = new ObjectState(TB_SEPARATOR);
277 toolbar->addChild(separator);
279 child->stringAttribute(
281 }
282 }
283
284 // add keyboard shortcuts
285 for (int i = 0; i < options->childCount(); i++) {
286 ObjectState* child = options->child(i);
287 if (child->name() !=
289 continue;
290 }
292 root->addChild(sc);
294 sc->addChild(keyComb);
295
297 keyComb->addChild(new ObjectState(KEY_COMB_CTRL));
298 }
300 keyComb->addChild(new ObjectState(KEY_COMB_ALT));
301 }
304 keyComb->addChild(fKey);
306 child->stringAttribute(
308 }
311 keyComb->addChild(key);
312 char charKey = child->intAttribute(
314 string stringKey;
315
316 // check if key is 'del'
317 if (charKey == 127) {
318 stringKey = DELETE_KEY;
319 } else {
320 stringKey = Conversion::toString(charKey);
321 }
322
323 key->setAttribute(KEY_VALUE, stringKey);
324 }
325 ObjectState* action = new ObjectState(KS_ACTION);
326 sc->addChild(action);
327 action->setValue(child->stringAttribute(
329 }
330
331 return root;
332}
const string TB_VISIBLE
Name of the element declaring toolbar visibility.
const string KEYBOARD_SHORTCUT
Name of the element declaring a keyboard shortcut.
const string TB_SEPARATOR
Name of the element declaring a toolbar separator.
const string WI_WIDTH
Name of the element declaring window width.
const string FALSE
Value used for false in attribute and element values.
const string SEPARATOR_POSITION
Name of the attribute of the separator element.
const string TRUE
Value used for true in attribute and element values.
const string SLOT_POSITION
Name of the attribute of the slot element.
const string WI_X_POSITION
Name of the element declaring x position of the window.
const string TB_SLOT
Name of the element declaring a toolbar button.
const string TOOLBAR
Name of the element containing toolbar declaration.
const string TB_LA_ICON
Name of the icon element insie layout element.
const string WINDOW
Name of the element containing window declaration.
const string WI_Y_POSITION
Name of the element declaring y position of the window.
const string TB_LAYOUT
Name of the element containing toolbar layout declaration.
const string TB_LA_TEXT
Name of the text element inside layout element.
const string TB_SLOT_ACTION
Name of the element declaring action name inside slot element.
const string WI_FULLSCREEN
Name of the full-screen element inside window element.
const string WI_HEIGHT
Name of the element declaring window height.
static std::string toString(const T &source)
static const std::string OSKEY_X_POS
ObjectState attribute key for window x position.
static const std::string OSKEY_POSITION
ObjectState attribute key for separator position.
static const std::string OSKEY_WINDOW_WIDTH
ObjectState attribute key for window width.
static const std::string OSVALUE_TEXT
ObjectState attribute value for text layout.
static const std::string OSKEY_TOOLBAR_VISIBILITY
ObjectState attribute key for toolbar visibility.
static const std::string OSKEY_FULL_SCREEN
ObjectState attribute key for full screen feature.
static const std::string OSKEY_TOOLBAR_LAYOUT
ObjectState attribute key for toolbar layout.
static const std::string OSKEY_WINDOW_HEIGHT
ObjectState attribute key for window height.
static const std::string OSNAME_SEPARATOR
ObjectState name for separator.
static const std::string OSKEY_Y_POS
ObjectState attribute key for window y position.
static const std::string OSVALUE_ICON
ObjectState attribute value for icon layout.
bool hasAttribute(const std::string &name) const
void setValue(const std::string &value)
void addChild(ObjectState *child)
std::string name() const
static const std::string OSKEY_SLOT
ObjectState attribute key for slot position.
static const std::string OSKEY_ACTION
ObjectState attribute key for action name.
static const std::string OSNAME_TOOLBAR_BUTTON
ObjectState name for ToolbarButton.

References ObjectState::addChild(), configurationName_, DELETE_KEY, FALSE, FKEY_NUMBER, ObjectState::hasAttribute(), ObjectState::intAttribute(), KEY_COMB_ALT, KEY_COMB_CTRL, KEY_COMB_FKEY, KEY_COMB_KEY, KEY_VALUE, KEYBOARD_SHORTCUT, KS_ACTION, KS_KEY_COMBINATION, ObjectState::name(), options, KeyboardShortcut::OSKEY_ACTION, ToolbarButton::OSKEY_ACTION, KeyboardShortcut::OSKEY_ALT, KeyboardShortcut::OSKEY_CTRL, KeyboardShortcut::OSKEY_FKEY, GUIOptions::OSKEY_FULL_SCREEN, KeyboardShortcut::OSKEY_KEY, GUIOptions::OSKEY_POSITION, ToolbarButton::OSKEY_SLOT, GUIOptions::OSKEY_TOOLBAR_LAYOUT, GUIOptions::OSKEY_TOOLBAR_VISIBILITY, GUIOptions::OSKEY_WINDOW_HEIGHT, GUIOptions::OSKEY_WINDOW_WIDTH, GUIOptions::OSKEY_X_POS, GUIOptions::OSKEY_Y_POS, KeyboardShortcut::OSNAME_KEYBOARD_SHORTCUT, GUIOptions::OSNAME_SEPARATOR, ToolbarButton::OSNAME_TOOLBAR_BUTTON, GUIOptions::OSVALUE_ICON, GUIOptions::OSVALUE_TEXT, SEPARATOR_POSITION, ObjectState::setAttribute(), ObjectState::setValue(), SLOT_POSITION, ObjectState::stringAttribute(), TB_LA_ICON, TB_LA_TEXT, TB_LAYOUT, TB_SEPARATOR, TB_SLOT, TB_SLOT_ACTION, TB_VISIBLE, TOOLBAR, Conversion::toString(), TRUE, WI_FULLSCREEN, WI_HEIGHT, WI_WIDTH, WI_X_POSITION, WI_Y_POSITION, and WINDOW.

Referenced by ProDeOptionsSerializer::convertToConfigFileFormat(), and writeState().

Here is the call graph for this function:

◆ convertToOptionsObjectFormat()

ObjectState * GUIOptionsSerializer::convertToOptionsObjectFormat ( const ObjectState root) const
protectedvirtual

Creates a new ObjectState tree which can be given to GUIOptions constructor. The tree is created according to the given tree which matches with the syntax of the options file.

Parameters
rootRoot node of the ObjectState tree to be converted.

Reimplemented in ProDeOptionsSerializer.

Definition at line 343 of file GUIOptionsSerializer.cc.

344 {
345
347
348 // set window properties
349 if (root->hasChild(WINDOW)) {
350 ObjectState* window = root->childByName(WINDOW);
352 } else {
353 options->setAttribute(GUIOptions::OSKEY_FULL_SCREEN, true);
358 }
359
360 // set toolbar properties
361 if (root->hasChild(TOOLBAR)) {
362 ObjectState* toolbar = root->childByName(TOOLBAR);
364 } else {
365 options->setAttribute(GUIOptions::OSKEY_TOOLBAR_VISIBILITY, false);
368 }
369
370 // set keyboard shortcuts
371 for (int i = 0; i < root->childCount(); i++) {
372 ObjectState* child = root->child(i);
373 if (child->name() == KEYBOARD_SHORTCUT) {
375 }
376 }
377
378 return options;
379}
const int DEFAULT_HEIGHT
Default window height.
const int DEFAULT_Y_POS
Default y position.
const int DEFAULT_X_POS
Default x position.
const int DEFAULT_WIDTH
Default window width.
void setToolbarProperties(const ObjectState *toolbarElem, ObjectState *options) const
void setWindowProperties(const ObjectState *windowElem, ObjectState *options) const
void addKeyboardShortcut(const ObjectState *ksElem, ObjectState *options) const
static const std::string OSVALUE_BOTH
ObjectState attribute value for text & icon layout.
static const std::string OSNAME_OPTIONS
ObjectState name for the options.
ObjectState * child(int index) const
int childCount() const

References addKeyboardShortcut(), ObjectState::child(), ObjectState::childByName(), ObjectState::childCount(), DEFAULT_HEIGHT, DEFAULT_WIDTH, DEFAULT_X_POS, DEFAULT_Y_POS, ObjectState::hasChild(), KEYBOARD_SHORTCUT, ObjectState::name(), options, GUIOptions::OSKEY_FULL_SCREEN, GUIOptions::OSKEY_TOOLBAR_LAYOUT, GUIOptions::OSKEY_TOOLBAR_VISIBILITY, GUIOptions::OSKEY_WINDOW_HEIGHT, GUIOptions::OSKEY_WINDOW_WIDTH, GUIOptions::OSKEY_X_POS, GUIOptions::OSKEY_Y_POS, GUIOptions::OSNAME_OPTIONS, GUIOptions::OSVALUE_BOTH, setToolbarProperties(), setWindowProperties(), TOOLBAR, and WINDOW.

Referenced by ProDeOptionsSerializer::convertToOptionsObjectFormat(), and readState().

Here is the call graph for this function:

◆ operator=()

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

Assignment not allowed.

◆ readOptions()

GUIOptions * GUIOptionsSerializer::readOptions ( )

Reads the current input file and creates GUIOptions according to it.

Returns
The newly created GUIOptions instance.
Exceptions
SerializerExceptionIf an error occurs while reading the file.
ObjectStateLoadingExceptionIf an error occurs while creating options.

Definition at line 178 of file GUIOptionsSerializer.cc.

178 {
179 ObjectState* optionsState = readState();
180 GUIOptions* options = new GUIOptions(optionsState);
181 delete optionsState;
182 return options;
183}

References options, and readState().

Here is the call graph for this function:

◆ readState()

ObjectState * GUIOptionsSerializer::readState ( )
virtual

Reads the options from the current XML file set and creates an ObjectState tree which can be read by GUIOptions::loadState.

Returns
The newly created ObjectState tree.
Exceptions
SerializerExceptionIf an error occurs while reading the file.

Reimplemented from XMLSerializer.

Definition at line 149 of file GUIOptionsSerializer.cc.

149 {
151 ObjectState* converted = convertToOptionsObjectFormat(state);
152 delete state;
153 return converted;
154}
virtual ObjectState * convertToOptionsObjectFormat(const ObjectState *root) const
virtual ObjectState * readState()

References convertToOptionsObjectFormat(), and XMLSerializer::readState().

Referenced by Proxim::loadOptions(), ProDe::OnInit(), and readOptions().

Here is the call graph for this function:

◆ setToolbarProperties()

void GUIOptionsSerializer::setToolbarProperties ( const ObjectState toolbarElem,
ObjectState options 
) const
private

Sets the toolbar properties for the given options according to the given toolbar element.

Parameters
toolbarElemObjectState representing toolbar element in options file.
optionsOptions ObjectState which is modified.

Definition at line 430 of file GUIOptionsSerializer.cc.

432 {
433
434 // set layout
435 ObjectState* layoutElem = toolbarElem->childByName(TB_LAYOUT);
436 if (layoutElem->hasChild(TB_LA_TEXT) &&
437 layoutElem->hasChild(TB_LA_ICON)) {
440 } else if (layoutElem->hasChild(TB_LA_TEXT)) {
443 } else if (layoutElem->hasChild(TB_LA_ICON)) {
446 } else {
447 assert(false);
448 }
449
450 // set visibility
451 ObjectState* visibleElem = toolbarElem->childByName(TB_VISIBLE);
452 if (visibleElem->stringValue() == TRUE) {
454 true);
455 } else if (visibleElem->stringValue() == FALSE) {
457 false);
458 }
459
460 // set buttons and separators
461 for (int i = 0; i < toolbarElem->childCount(); i++) {
462 ObjectState* child = toolbarElem->child(i);
463 if (child->name() == TB_SLOT) {
464 ObjectState* button = new ObjectState(
466 options->addChild(button);
467
468 string slot = child->stringAttribute(SLOT_POSITION);
470
471 ObjectState* action = child->childByName(TB_SLOT_ACTION);
472 string actionString = action->stringValue();
473 button->setAttribute(ToolbarButton::OSKEY_ACTION, actionString);
474
475 } else if (child->name() == TB_SEPARATOR) {
476 ObjectState* separator =
478 options->addChild(separator);
479 string position = child->stringAttribute(SEPARATOR_POSITION);
480 separator->setAttribute(GUIOptions::OSKEY_POSITION, position);
481 }
482 }
483}
#define assert(condition)

References assert, ObjectState::child(), ObjectState::childByName(), ObjectState::childCount(), FALSE, ObjectState::hasChild(), ObjectState::name(), options, ToolbarButton::OSKEY_ACTION, GUIOptions::OSKEY_POSITION, ToolbarButton::OSKEY_SLOT, GUIOptions::OSKEY_TOOLBAR_LAYOUT, GUIOptions::OSKEY_TOOLBAR_VISIBILITY, GUIOptions::OSNAME_SEPARATOR, ToolbarButton::OSNAME_TOOLBAR_BUTTON, GUIOptions::OSVALUE_BOTH, GUIOptions::OSVALUE_ICON, GUIOptions::OSVALUE_TEXT, SEPARATOR_POSITION, ObjectState::setAttribute(), SLOT_POSITION, ObjectState::stringAttribute(), ObjectState::stringValue(), TB_LA_ICON, TB_LA_TEXT, TB_LAYOUT, TB_SEPARATOR, TB_SLOT, TB_SLOT_ACTION, TB_VISIBLE, and TRUE.

Referenced by convertToOptionsObjectFormat().

Here is the call graph for this function:

◆ setWindowProperties()

void GUIOptionsSerializer::setWindowProperties ( const ObjectState windowElem,
ObjectState options 
) const
private

Sets the window properties for the given options according to the given window element.

Parameters
windowElemObjectState representing window element in options file.
optionsOptions ObjectState which is modified.

Definition at line 390 of file GUIOptionsSerializer.cc.

392 {
393
394 ObjectState* fullscreenElem = windowElem->childByName(WI_FULLSCREEN);
395 if (fullscreenElem->stringValue() == TRUE) {
396 options->setAttribute(GUIOptions::OSKEY_FULL_SCREEN, true);
397 } else if (fullscreenElem->stringValue() == FALSE) {
398 options->setAttribute(GUIOptions::OSKEY_FULL_SCREEN, false);
399 } else {
400 assert(false);
401 }
402
403 ObjectState* widthElem = windowElem->childByName(WI_WIDTH);
405 widthElem->stringValue());
406
407 ObjectState* heightElem = windowElem->childByName(WI_HEIGHT);
409 heightElem->stringValue());
410
411 ObjectState* xPosElem = windowElem->childByName(WI_X_POSITION);
412 options->setAttribute(GUIOptions::OSKEY_X_POS,
413 xPosElem->stringValue());
414
415 ObjectState* yPosElem = windowElem->childByName(WI_Y_POSITION);
416 options->setAttribute(GUIOptions::OSKEY_Y_POS,
417 yPosElem->stringValue());
418}

References assert, ObjectState::childByName(), FALSE, options, GUIOptions::OSKEY_FULL_SCREEN, GUIOptions::OSKEY_WINDOW_HEIGHT, GUIOptions::OSKEY_WINDOW_WIDTH, GUIOptions::OSKEY_X_POS, GUIOptions::OSKEY_Y_POS, ObjectState::stringValue(), TRUE, WI_FULLSCREEN, WI_HEIGHT, WI_WIDTH, WI_X_POSITION, and WI_Y_POSITION.

Referenced by convertToOptionsObjectFormat().

Here is the call graph for this function:

◆ writeOptions()

void GUIOptionsSerializer::writeOptions ( const GUIOptions options)

Serializes the given options to the file set.

Parameters
optionsThe options to be serialized.
Exceptions
SerializerExceptionIf an error occurs while serializing.

Definition at line 163 of file GUIOptionsSerializer.cc.

163 {
164 ObjectState* optionsState = options.saveState();
165 writeState(optionsState);
166 delete optionsState;
167}
void writeState(const ObjectState *optionsState)

References options, and writeState().

Referenced by ProximQuitCmd::Do(), and SaveOptionsCmd::Do().

Here is the call graph for this function:

◆ writeState()

void GUIOptionsSerializer::writeState ( const ObjectState optionsState)
virtual

Serializes the given ObjectState tree created by GUIOptions::saveState to an XML file.

Parameters
optionsStateObjectState tree created by GUIOptions::saveState.
Exceptions
SerializerExceptionIf the current destination file cannot be written.

Reimplemented from XMLSerializer.

Definition at line 135 of file GUIOptionsSerializer.cc.

135 {
136 ObjectState* converted = convertToConfigFileFormat(optionsState);
137 XMLSerializer::writeState(converted);
138 delete converted;
139}
virtual ObjectState * convertToConfigFileFormat(const ObjectState *options) const
virtual void writeState(const ObjectState *rootState)

References convertToConfigFileFormat(), and XMLSerializer::writeState().

Referenced by writeOptions().

Here is the call graph for this function:

Member Data Documentation

◆ configurationName_

std::string GUIOptionsSerializer::configurationName_
private

Name of the configuration to read/write.

Definition at line 84 of file GUIOptionsSerializer.hh.

Referenced by convertToConfigFileFormat().


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