00001 00002 /************************************************************************/ 00003 /* This file is part of openMask(c) INRIA, CNRS, Universite de Rennes 1 */ 00004 /* 1993-2002, thereinafter the Software */ 00005 /* */ 00006 /* The Software has been developped within the Siames Project. */ 00007 /* INRIA, the University of Rennes 1 and CNRS jointly hold intellectual */ 00008 /* property rights */ 00009 /* */ 00010 /* The Software has been registered with the Agence pour la Protection */ 00011 /* des Programmes (APP) under registration number */ 00012 /* IDDN.FR.001.510008.00.S.P.2001.000.41200 */ 00013 /* */ 00014 /* This file may be distributed under the terms of the Q Public License */ 00015 /* version 1.0 as defined by Trolltech AS of Norway and appearing in */ 00016 /* the file LICENSE.QPL included in the packaging of this file. */ 00017 /* */ 00018 /* Licensees holding valid specific licenses issued by INRIA, CNRS or */ 00019 /* Universite Rennes 1 for the software may use this file in */ 00020 /* acordance with that specific license */ 00021 /************************************************************************/ 00022 00023 #include "OMKAccessRule.h" 00024 #include "OMKParametersAccessor.inl" 00025 00026 using namespace OMK ; 00027 using namespace OMK::Iii ; 00028 using namespace OMK::Type ; 00029 00030 REGISTER_ACCESS_RULE_FACTORY( AccessRule, "GrpLevel" ) ; 00031 00032 //----------------------------------------------------------------------------- 00033 AccessRule::AccessRule( const ConfigurationParameterDescriptor* node ) 00034 : IAccessRule( node ) 00035 { 00036 } 00037 00038 //----------------------------------------------------------------------------- 00039 AccessRule::~AccessRule() 00040 { 00041 } 00042 00043 //----------------------------------------------------------------------------- 00044 void AccessRule::setCurrentLevel( const AccessGroupLevel& level, AccessLevel toolLevel ) 00045 { 00046 AccessLevel maxLevel = 2147483647 ; 00047 switch( _freezableType ) 00048 { 00049 case UNFREEZABLE: 00050 // Nothing to do 00051 break ; 00052 case FREEZABLE_AT_TOOL_LEVEL: 00053 maxLevel = toolLevel + 1 ; 00054 // no break 00055 case FREEZABLE_AT_ANY_LEVEL: 00056 if( level.empty() ) 00057 { 00058 _currentLevel.clear() ; 00059 _currentLevel[ "*" ] = -1 ; 00060 } 00061 else 00062 { 00063 _currentLevel = level ; 00064 for( AccessGroupLevel::iterator entry = _currentLevel.begin() ; 00065 entry != _currentLevel.end() ; 00066 entry++ ) 00067 { 00068 entry->second = entry->second <= maxLevel ? entry->second : maxLevel ; 00069 } 00070 } 00071 break ; 00072 default: 00073 OMASSERTM( false, "Not a valid state !" ) ; 00074 } 00075 }
Documentation generated on Mon Jun 9 11:45:55 2008 |
Generated with doxygen by Dimitri van Heesch , 1997-2007 |