Exemple #1
0
        private void WriteText(Variant text)
        {
            switch (text.Type)
            {
            case VariantBase.EnumType.Any:
            case VariantBase.EnumType.String:
            {
                m_writer.WriteString(text.As <string>());
                break;
            }

            case VariantBase.EnumType.Int32:
            case VariantBase.EnumType.UInt32:
            case VariantBase.EnumType.Int64:
            case VariantBase.EnumType.UInt64:
            case VariantBase.EnumType.Float:
            case VariantBase.EnumType.Double:
            case VariantBase.EnumType.Boolean:
            case VariantBase.EnumType.Date:
            case VariantBase.EnumType.Time:
            case VariantBase.EnumType.DateTime:
            {
                m_writer.WriteString(text.AnyCast().As <string>());
                break;
            }

            default:
                throw new VariantException("Attempt to output non-primitive variant as text: " + text.Type);
            }
        }