OpenWalnut  1.4.0
WPropertyHelper.h
00001 //---------------------------------------------------------------------------
00002 //
00003 // Project: OpenWalnut ( http://www.openwalnut.org )
00004 //
00005 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
00006 // For more information see http://www.openwalnut.org/copying
00007 //
00008 // This file is part of OpenWalnut.
00009 //
00010 // OpenWalnut is free software: you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as published by
00012 // the Free Software Foundation, either version 3 of the License, or
00013 // (at your option) any later version.
00014 //
00015 // OpenWalnut is distributed in the hope that it will be useful,
00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 // GNU Lesser General Public License for more details.
00019 //
00020 // You should have received a copy of the GNU Lesser General Public License
00021 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
00022 //
00023 //---------------------------------------------------------------------------
00024 
00025 #ifndef WPROPERTYHELPER_H
00026 #define WPROPERTYHELPER_H
00027 
00028 #include <boost/shared_ptr.hpp>
00029 
00030 #include "WPropertyVariable.h"
00031 
00032 #include "constraints/WPropertyConstraintNotEmpty.h"
00033 #include "constraints/WPropertyConstraintPathExists.h"
00034 #include "constraints/WPropertyConstraintIsDirectory.h"
00035 #include "constraints/WPropertyConstraintSelectOnlyOne.h"
00036 #include "constraints/WPropertyConstraintIsValid.h"
00037 
00038 
00039 /**
00040  * This namespace contains several utility functions to handle properties. Especially constraint helper to easily create constraints.
00041  */
00042 namespace WPropertyHelper
00043 {
00044     /**
00045      * Contains functions for easily adding constraints of type PC_SELECTONLYONE to properties compatible with this constraint.
00046      */
00047     namespace PC_SELECTONLYONE
00048     {
00049         /**
00050          * Add the PC_SELECTONLYONE constraint to the property.
00051          *
00052          * \param prop the property where to add the constraint.
00053          */
00054         void addTo( WPropSelection prop );
00055     }
00056 
00057     /**
00058      * Contains functions for easily adding constraints of type PC_NOTEMPTY to properties compatible with this constraint.
00059      */
00060     namespace PC_NOTEMPTY
00061     {
00062         /**
00063          * Add the PC_NOTEMPTY constraint to the property.
00064          *
00065          * \param prop the property where to add the constraint.
00066          */
00067         void addTo( WPropSelection prop );
00068 
00069         /**
00070          * Add the PC_NOTEMPTY constraint to the property.
00071          *
00072          * \param prop the property where to add the constraint.
00073          */
00074         void addTo( WPropString prop );
00075 
00076         /**
00077          * Add the PC_NOTEMPTY constraint to the property.
00078          *
00079          * \param prop the property where to add the constraint.
00080          */
00081         void addTo( WPropFilename prop );
00082     }
00083 
00084     /**
00085      * Contains functions for easily adding constraints of type PC_PATHEXISTS to properties compatible with this constraint.
00086      */
00087     namespace PC_PATHEXISTS
00088     {
00089         /**
00090          * Add the PC_PATHEXISTS constraint to the property.
00091          *
00092          * \param prop the property where to add the constraint.
00093          */
00094         void addTo( WPropFilename prop );
00095     }
00096 
00097     /**
00098      * Contains functions for easily adding constraints of type PC_ISDIRECTORY to properties compatible with this constraint.
00099      */
00100     namespace PC_ISDIRECTORY
00101     {
00102         /**
00103          * Add the PC_PATHEXISTS constraint to the property.
00104          *
00105          * \param prop the property where to add the constraint.
00106          */
00107         void addTo( WPropFilename prop );
00108     }
00109 
00110     /**
00111      * Contains functions for easily adding constraints of type PC_ISVALID  to properties compatible with this constraint.
00112      */
00113     namespace PC_ISVALID
00114     {
00115         /**
00116          * Add the PC_ISVALID constraint to the property.
00117          *
00118          * \param prop the property where to add the constraint.
00119          */
00120         void addTo( WPropSelection prop );
00121     }
00122 }
00123 
00124 #endif  // WPROPERTYHELPER_H
00125