예제 #1
0
        /// <summary>
        /// Creates a qualifier from a given input qualifier such that the resulting qualifier respects target qualifier space.
        /// </summary>
        public bool TryCreateQualifierForQualifierSpace(
            PathTable pathTable,
            LoggingContext loggingContext,
            QualifierId qualifierId,
            QualifierSpaceId qualifierSpaceId,
            bool useDefaultsForCoercion,
            out QualifierId resultingQualifierId,
            out UnsupportedQualifierValue error)
        {
            Contract.RequiresNotNull(pathTable);
            Contract.RequiresNotNull(loggingContext);
#if DEBUG
            Contract.Requires(IsValidQualifierId(qualifierId));
            Contract.Requires(qualifierSpaceId.IsValid);
            Contract.Requires(IsValidQualifierSpaceId(qualifierSpaceId), "Id " + qualifierSpaceId.Id + " is not valid.");
#endif

            Qualifier      qualifier      = GetQualifier(qualifierId);
            QualifierSpace qualifierSpace = GetQualifierSpace(qualifierSpaceId);
            Qualifier      resultingQualifier;

            bool success = qualifierSpace.TryCreateQualifierForQualifierSpace(
                StringTable,
                pathTable,
                loggingContext,
                qualifier,
                out resultingQualifier,
                out error,
                useDefaultsForCoercion);
            resultingQualifierId = success ? GetOrAddQualifier(resultingQualifier) : EmptyQualifierId;

            return(success);
        }