VPTissue Reference Manual
WorkspaceChanged.h
Go to the documentation of this file.
1 #ifndef WS_EVENT_WORKSPACECHANGED_H_INCLUDED
2 #define WS_EVENT_WORKSPACECHANGED_H_INCLUDED
3 /*
4  * Copyright 2011-2016 Universiteit Antwerpen
5  *
6  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
7  * the European Commission - subsequent versions of the EUPL (the "Licence");
8  * You may not use this work except in compliance with the Licence.
9  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the Licence is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the Licence for the specific language governing
15  * permissions and limitations under the Licence.
16  */
22 namespace SimShell {
23 namespace Ws {
24 namespace Event {
25 
32 {
33 public:
34  enum Type {
35  ProjectAdded,
36  ProjectRenamed,
37  ProjectRemoved
38  };
39 
40  WorkspaceChanged(Type type, const std::string& name)
41  : m_name(name), m_old_name(""), m_type(type) {}
42 
43  WorkspaceChanged(const std::string& old_name, const std::string& name)
44  : m_name(name), m_old_name(old_name), m_type(ProjectRenamed) {}
45 
46  ~WorkspaceChanged() {}
47 
49  Type GetType() const { return m_type;}
50 
53  const std::string GetName() const
54  {
55  return (m_type==Type::ProjectAdded || m_type==Type::ProjectRemoved) ? m_name : "";
56  }
57 
60  const std::string GetOldName() const
61  {
62  return (m_type==Type::ProjectRenamed) ? m_old_name : "";
63  }
64 
67  const std::string GetNewName() const
68  {
69  return (m_type==Type::ProjectRenamed) ? m_name : "";
70  }
71 
72 private:
73  std::string m_name;
74  std::string m_old_name;
75  Type m_type;
76 };
77 
78 } // namespace
79 } // namespace
80 } // namespace
81 
82 #endif // end_of_inclde_guard
Event used to inform some observer that the workspace has changed.
const std::string GetOldName() const
In case type is ProjectRenamed, get old name of renamed project.
Namespace for generic graphical shell for simulators.
Definition: SimSession.h:32
const std::string GetName() const
In case type is ProjectAdded or ProjectRemoved, get name of project.
const std::string GetNewName() const
In case type is ProjectRenamed, get new name of renamed project.