[8bcf3f] | 1 | /*
|
---|
| 2 | * Project: MoleCuilder
|
---|
| 3 | * Description: creates and alters molecular systems
|
---|
| 4 | * Copyright (C) 2010 University of Bonn. All rights reserved.
|
---|
| 5 | * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | /*
|
---|
| 9 | * MenuDescription.cpp
|
---|
| 10 | *
|
---|
| 11 | * Created on: Oct 26, 2010
|
---|
| 12 | * Author: heber
|
---|
| 13 | */
|
---|
| 14 |
|
---|
| 15 | #include <map>
|
---|
| 16 | #include <string>
|
---|
| 17 |
|
---|
| 18 | #include "Menu/MenuDescription.hpp"
|
---|
| 19 |
|
---|
| 20 | /** Constructor of class MenuDescription.
|
---|
| 21 | *
|
---|
| 22 | */
|
---|
| 23 | MenuDescription::MenuDescription()
|
---|
| 24 | {
|
---|
| 25 | // put each menu into set
|
---|
| 26 | MenuSet.insert("analysis");
|
---|
| 27 | MenuSet.insert("atom");
|
---|
| 28 | MenuSet.insert("command");
|
---|
| 29 | MenuSet.insert("fragmentation");
|
---|
| 30 | MenuSet.insert("molecule");
|
---|
| 31 | MenuSet.insert("parser");
|
---|
| 32 | MenuSet.insert("selection");
|
---|
| 33 | MenuSet.insert("tesselation");
|
---|
| 34 | MenuSet.insert("world");
|
---|
| 35 |
|
---|
| 36 | // put menu description into each menu category
|
---|
| 37 | MenuDescriptionsMap["analysis"] = "Analysis (pair correlation, volume)";
|
---|
| 38 | MenuDescriptionsMap["atom"] = "Edit atoms";
|
---|
| 39 | MenuDescriptionsMap["command"] = "Configuration";
|
---|
| 40 | MenuDescriptionsMap["fragmentation"] = "Fragmentation";
|
---|
| 41 | MenuDescriptionsMap["molecule"] = "Parse files into system";
|
---|
| 42 | MenuDescriptionsMap["parser"] = "Edit molecules (load, parse, save)";
|
---|
| 43 | MenuDescriptionsMap["selection"] = "Select atoms/molecules";
|
---|
| 44 | MenuDescriptionsMap["tesselation"] = "Tesselate molecules";
|
---|
| 45 | MenuDescriptionsMap["world"] = "Edit world";
|
---|
| 46 |
|
---|
| 47 | // put menu name into each menu category
|
---|
| 48 | MenuNameMap["analysis"] = "Analysis";
|
---|
| 49 | MenuNameMap["atom"] = "Atoms";
|
---|
| 50 | MenuNameMap["command"] = "configuration options";
|
---|
| 51 | MenuNameMap["fragmentation"] = "Fragmentation";
|
---|
| 52 | MenuNameMap["molecule"] = "Molecules";
|
---|
| 53 | MenuNameMap["parser"] = "Input/Output";
|
---|
| 54 | MenuNameMap["selection"] = "Selection";
|
---|
| 55 | MenuNameMap["tesselation"] = "Tesselation";
|
---|
| 56 | MenuNameMap["world"] = "Globals";
|
---|
| 57 | }
|
---|
| 58 |
|
---|
| 59 | /** Destructor of class MenuDescription.
|
---|
| 60 | *
|
---|
| 61 | */
|
---|
| 62 | MenuDescription::~MenuDescription()
|
---|
| 63 | {}
|
---|
| 64 |
|
---|
| 65 | /** Getter for MenuDescriptionsMap.
|
---|
| 66 | * \param token name of menu
|
---|
| 67 | * \return description string of the menu or empty
|
---|
| 68 | */
|
---|
| 69 | const std::string MenuDescription::getDescription(std::string token) const
|
---|
| 70 | {
|
---|
| 71 | if (MenuDescriptionsMap.find(token) != MenuDescriptionsMap.end())
|
---|
| 72 | return MenuDescriptionsMap.find(token)->second;
|
---|
| 73 | else
|
---|
| 74 | return std::string();
|
---|
| 75 | }
|
---|
| 76 |
|
---|
| 77 | /** Getter for MenuNameMap.
|
---|
| 78 | * \param token name of menu
|
---|
| 79 | * \return description string of the menu or empty
|
---|
| 80 | */
|
---|
| 81 | const std::string MenuDescription::getName(std::string token) const
|
---|
| 82 | {
|
---|
| 83 | if (MenuNameMap.find(token) != MenuNameMap.end())
|
---|
| 84 | return MenuNameMap.find(token)->second;
|
---|
| 85 | else
|
---|
| 86 | return std::string();
|
---|
| 87 | }
|
---|
| 88 |
|
---|
| 89 | /** Forward iterator from beginning of list of descriptions.
|
---|
| 90 | * \return iterator
|
---|
| 91 | */
|
---|
| 92 | MenuDescription::iterator MenuDescription::getBeginIter()
|
---|
| 93 | {
|
---|
| 94 | return MenuSet.begin();
|
---|
| 95 | }
|
---|
| 96 |
|
---|
| 97 | /** Forward iterator at end of list of descriptions.
|
---|
| 98 | * \return iterator
|
---|
| 99 | */
|
---|
| 100 | MenuDescription::iterator MenuDescription::getEndIter()
|
---|
| 101 | {
|
---|
| 102 | return MenuSet.end();
|
---|
| 103 | }
|
---|
| 104 |
|
---|
| 105 | /** Constant forward iterator from beginning of list of descriptions.
|
---|
| 106 | * \return constant iterator
|
---|
| 107 | */
|
---|
| 108 | MenuDescription::const_iterator MenuDescription::getBeginIter() const
|
---|
| 109 | {
|
---|
| 110 | return MenuSet.begin();
|
---|
| 111 | }
|
---|
| 112 |
|
---|
| 113 | /** Constant forward iterator at end of list of descriptions.
|
---|
| 114 | * \return constant iterator
|
---|
| 115 | */
|
---|
| 116 | MenuDescription::const_iterator MenuDescription::getEndIter() const
|
---|
| 117 | {
|
---|
| 118 | return MenuSet.end();
|
---|
| 119 | }
|
---|
| 120 |
|
---|
| 121 |
|
---|