OpenWalnut  1.3.1
WPropertyHelper.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WPROPERTYHELPER_H
26 #define WPROPERTYHELPER_H
27 
28 #include <boost/shared_ptr.hpp>
29 
30 #include "WPropertyVariable.h"
31 
32 #include "constraints/WPropertyConstraintNotEmpty.h"
33 #include "constraints/WPropertyConstraintPathExists.h"
34 #include "constraints/WPropertyConstraintIsDirectory.h"
35 #include "constraints/WPropertyConstraintSelectOnlyOne.h"
36 #include "constraints/WPropertyConstraintIsValid.h"
37 
38 
39 /**
40  * This namespace contains several utility functions to handle properties. Especially constraint helper to easily create constraints.
41  */
42 namespace WPropertyHelper
43 {
44  /**
45  * Contains functions for easily adding constraints of type PC_SELECTONLYONE to properties compatible with this constraint.
46  */
47  namespace PC_SELECTONLYONE
48  {
49  /**
50  * Add the PC_SELECTONLYONE constraint to the property.
51  *
52  * \param prop the property where to add the constraint.
53  */
54  void addTo( WPropSelection prop );
55  }
56 
57  /**
58  * Contains functions for easily adding constraints of type PC_NOTEMPTY to properties compatible with this constraint.
59  */
60  namespace PC_NOTEMPTY
61  {
62  /**
63  * Add the PC_NOTEMPTY constraint to the property.
64  *
65  * \param prop the property where to add the constraint.
66  */
67  void addTo( WPropSelection prop );
68 
69  /**
70  * Add the PC_NOTEMPTY constraint to the property.
71  *
72  * \param prop the property where to add the constraint.
73  */
74  void addTo( WPropString prop );
75 
76  /**
77  * Add the PC_NOTEMPTY constraint to the property.
78  *
79  * \param prop the property where to add the constraint.
80  */
81  void addTo( WPropFilename prop );
82  }
83 
84  /**
85  * Contains functions for easily adding constraints of type PC_PATHEXISTS to properties compatible with this constraint.
86  */
87  namespace PC_PATHEXISTS
88  {
89  /**
90  * Add the PC_PATHEXISTS constraint to the property.
91  *
92  * \param prop the property where to add the constraint.
93  */
94  void addTo( WPropFilename prop );
95  }
96 
97  /**
98  * Contains functions for easily adding constraints of type PC_ISDIRECTORY to properties compatible with this constraint.
99  */
100  namespace PC_ISDIRECTORY
101  {
102  /**
103  * Add the PC_PATHEXISTS constraint to the property.
104  *
105  * \param prop the property where to add the constraint.
106  */
107  void addTo( WPropFilename prop );
108  }
109 
110  /**
111  * Contains functions for easily adding constraints of type PC_ISVALID to properties compatible with this constraint.
112  */
113  namespace PC_ISVALID
114  {
115  /**
116  * Add the PC_ISVALID constraint to the property.
117  *
118  * \param prop the property where to add the constraint.
119  */
120  void addTo( WPropSelection prop );
121  }
122 }
123 
124 #endif // WPROPERTYHELPER_H
125