VPTissue Reference Manual
StepSelection.h
Go to the documentation of this file.
1 #ifndef SIMPT_SHELL_STEP_SELECTION_H_INCLUDED
2 #define SIMPT_SHELL_STEP_SELECTION_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 #include <QRegExp>
23 #include <set>
24 #include <string>
25 
26 namespace SimPT_Shell {
27 
33 {
34 public:
36  StepSelection();
37 
39  virtual ~StepSelection();
40 
41 
43  void SetSelectionText(const std::string &ranges);
44 
45 
47  std::set<int> ApplySelection(const std::set<int> &available) const;
48 
50  bool Contains(int step) const;
51 
52 public:
53  static const QRegExp g_range_regex;
54  static const QRegExp g_repeated_regex;
55 
56 private:
57  bool m_all_selected;
58  std::set<int> m_selected_steps;
59 };
60 
61 } // namespace
62 
63 #endif // end_of_include_guard
bool Contains(int step) const
Checks whether the selection contains a specified step.
Namespace for SimPT shell package.
Definition: Client.cpp:50
static const QRegExp g_range_regex
Regex for one range (start[-stop[:step]])
Definition: StepSelection.h:53
void SetSelectionText(const std::string &ranges)
Sets the selected ranges of steps.
std::set< int > ApplySelection(const std::set< int > &available) const
Applies the selection to a set of available steps.
virtual ~StepSelection()
Destructor.
StepSelection()
Constructs a selection with an empty ranges text (ie. everything is selected)
Class handling user input of ranges of steps.
Definition: StepSelection.h:32
static const QRegExp g_repeated_regex
Regex for a series of repeated ranges, separated by , of ;.
Definition: StepSelection.h:54