#####################################################################
#####################################################################
## Versavant Topic Map Application Bus / Subject Addressing Engine ##
## Copyright 2005 Steven R. Newcomb                                ##
##                                                                 ##
## This software is licensed under the Apache License, Version 2.0 ##
## (the "License"); you may not use this file except in compliance ##
## with the License.  Copies of the License are available at       ##
##        http://www.apache.org/licenses/LICENSE-2.0               ##
##                                                                 ##
## Unless required by applicable law or agreed to in writing,      ##
## software distributed under the License is distributed on an "AS ##
## IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either ##
## express or implied.  See the License for the specific language  ##
## governing permissions and limitations under the License.        ##
##                                                                 ##
## Copies of the source code and the license are available at      ##
##        http://www.versavant.org                                 ##
#####################################################################
#####################################################################


#############################################
## "boolean" value type implementation ##
#############################################

## This property class can have only the values Python "True" and
## Pythonic "False".

import types

#######################################################
def ValueIsNotOfType_boolean_(vsv, propertyValue, propertyClass, propertyInstance = None, **args):
    if not isinstance( propertyValue, types.BooleanType):
        vsv.errMsg( 'Value "%s" is not boolean.' % ( propertyValue))
        return True

    return False  ## all's well, presumably.                    

#######################################################
def InstanceOf_boolean_ValueTypeToXMLContentString(vsv, propertyInstance):
    return vsv.cPickleDumpObjectAsXMLContentString( propertyInstance._value)

#######################################################
def XMLContentStringToInstanceOf_boolean_ValueType(vsv, string, propertyClass):
    return vsv.cPickleLoadObjectFromXMLContentString( string)
