OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
EditEnd.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: EditEnd.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.1.1.1 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Class: EditEnd
10 // The class for the OPAL sequence editor ENDEDIT command.
11 //
12 // ------------------------------------------------------------------------
13 //
14 // $Date: 2000/03/27 09:33:38 $
15 // $Author: Andreas Adelmann $
16 //
17 // ------------------------------------------------------------------------
18 
19 #include "Editor/EditEnd.h"
20 #include "Attributes/Attributes.h"
21 #include "Editor/Edit.h"
22 
23 
24 // Class EditEnd
25 // ------------------------------------------------------------------------
26 
27 
29  Editor(1, "ENDEDIT",
30  "The \"ENDEDIT\" sub-command terminates sequence editing mode.") {
32  ("NAME", "New name for the edited sequence (default = old name)");
33 
35 }
36 
37 
38 EditEnd::EditEnd(const std::string &name, EditEnd *parent):
39  Editor(name, parent)
40 {}
41 
42 
44 {}
45 
46 
47 EditEnd *EditEnd::clone(const std::string &name) {
48  return new EditEnd(name, this);
49 }
50 
51 
53  try {
54  std::string newName = Edit::block->itsSequence->getOpalName();
55  if(itsAttr[0]) newName = Attributes::getString(itsAttr[0]);
56  Edit::block->finish(newName);
58  } catch(...) {
60  throw;
61  }
62 }
std::vector< Attribute > itsAttr
The object attributes (see Attribute.hh).
Definition: Object.h:214
The base class for all OPAL sequence editor commands.
Definition: Editor.h:31
Pointer< Sequence > itsSequence
The original sequence.
Definition: Edit.h:121
void stop() const
Set stop flag.
Definition: OpalParser.cpp:637
virtual EditEnd * clone(const std::string &name)
Make clone.
Definition: EditEnd.cpp:47
const std::string & getOpalName() const
Return object name.
Definition: Object.cpp:284
The sequence editor ENDEDIT command.
Definition: EditEnd.h:28
EditEnd()
Exemplar constructor.
Definition: EditEnd.cpp:28
void registerOwnership(const AttributeHandler::OwnerType &itsClass) const
Definition: Object.cpp:194
static Edit * block
Pointer to the edit data.
Definition: Edit.h:134
virtual ~EditEnd()
Definition: EditEnd.cpp:43
const std::string name
void finish(const std::string &newName)
Finish editing.
Definition: Edit.cpp:224
virtual void execute()
Execute the command.
Definition: EditEnd.cpp:52
EditParser parser
The parser used during a sequence edit.
Definition: Edit.h:131
Attribute makeString(const std::string &name, const std::string &help)
Make string attribute.
Definition: Attributes.cpp:296
std::string getString(const Attribute &attr)
Get string value.
Definition: Attributes.cpp:307