#include "../../config/pathan_config.h" /* * Copyright (c) 2001, DecisionSoft Limited All rights reserved. * Please see LICENSE.TXT for more information. */ #include "ATHexBinaryOrDerivedImpl.hpp" #include #include #include #include #include // defines X() and XMLCh* #include #include ATHexBinaryOrDerivedImpl:: ATHexBinaryOrDerivedImpl(const XMLCh* typeURI, const XMLCh* typeName, const XMLCh* value, XPath2MemoryManager* memMgr, const DynamicContext* context): ATHexBinaryOrDerived(memMgr), _typeName(typeName), _typeURI(typeURI) { // revisit: have to cast away the const. a bit nasty. XERCES_CPP_NAMESPACE_QUALIFIER XMLString::upperCase(const_cast(value)); _hexBinaryData = getMemoryManager()->getPooledString(value); } /* Get the name of the primitive type (basic type) of this type * (ie "decimal" for xs:decimal) */ const XMLCh* ATHexBinaryOrDerivedImpl::getPrimitiveTypeName() const { return this->getPrimitiveName(); } const XMLCh* ATHexBinaryOrDerivedImpl::getPrimitiveName() { return XERCES_CPP_NAMESPACE_QUALIFIER SchemaSymbols::fgDT_HEXBINARY; } /* Get the name of this type (ie "integer" for xs:integer) */ const XMLCh* ATHexBinaryOrDerivedImpl::getTypeName() const { return _typeName; } /* Get the namespace URI for this type */ const XMLCh* ATHexBinaryOrDerivedImpl::getTypeURI() const { return _typeURI; } AnyAtomicType::AtomicObjectType ATHexBinaryOrDerivedImpl::getTypeIndex() { return AnyAtomicType::HEX_BINARY; } /* returns the XMLCh* (canonical) representation of this type */ const XMLCh* ATHexBinaryOrDerivedImpl::asString(const DynamicContext* context) const { return _hexBinaryData; } /* returns true if the two objects' URI are equal (string comparison) * false otherwise */ bool ATHexBinaryOrDerivedImpl::equals(const AnyAtomicType* target, const DynamicContext* context) const { if(this->getPrimitiveTypeIndex() != target->getPrimitiveTypeIndex()) { DSLthrow(IllegalArgumentException,X("ATHexBinaryOrDerivedImpl::equals"), X("Equality operator for given types not supported")); } return XPath2Utils::equals(((ATHexBinaryOrDerivedImpl*)target)->_hexBinaryData, _hexBinaryData); } AnyAtomicType::AtomicObjectType ATHexBinaryOrDerivedImpl::getPrimitiveTypeIndex() const { return this->getTypeIndex(); } /** Releases the memory used by this Item */ void ATHexBinaryOrDerivedImpl::release() const { //TODO needs to check for ownership before releasing! getMemoryManager()->deallocate((void*)this); }