/////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance"). // All rights reserved. // // This software and its documentation and related materials are owned by // the Alliance. The software may only be incorporated into application // programs owned by members of the Alliance, subject to a signed // Membership Agreement and Supplemental Software License Agreement with the // Alliance. The structure and organization of this software are the valuable // trade secrets of the Alliance and its suppliers. The software is also // protected by copyright law and international treaty provisions. Application // programs incorporating this software must include the following statement // with their copyright notices: // // This application incorporates Open Design Alliance software pursuant to a license // agreement with Open Design Alliance. // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance. // All rights reserved. // // By use of this software, its documentation or related materials, you // acknowledge and accept the above terms. /////////////////////////////////////////////////////////////////////////////// #ifndef TNW_VARIANT_UTILS_H_ #define TNW_VARIANT_UTILS_H_ #include "NwExport.h" #include "NwDataType.h" class OdNwVariant; class OdString; /** \details Utils of variant value using. */ namespace NwVariantUtils { /** \details Returns the data type of property value for specified variant value. \param value [in] OdNwVariant value for type detection. \returns value data type of property as enumeration type. \remarks Return type can be one of the following: Name Value Description NwDataType::dt_NONE 0 Default value type. NwDataType::dt_DOUBLE 0x01 Double value type. NwDataType::dt_INT32 0x02 32-bit integer value type. NwDataType::dt_BOOL 0x03 Boolean value type. NwDataType::dt_DISPLAY_STRING 0x04 Display end-user string value type. NwDataType::dt_DATETIME 0x05 Date time value type. NwDataType::dt_DOUBLE_LENGTH 0x06 Double value type for length (in length's units). NwDataType::dt_DOUBLE_ANGLE 0x07 Double value type for angle (in radians). NwDataType::dt_NAME 0x08 Name value type (with pointer to OdNwName object). NwDataType::dt_IDENTIFIER_STRING 0x09 Programmatic identifier string value type. NwDataType::dt_DOUBLE_AREA 0x0A Double value type for area. NwDataType::dt_DOUBLE_VOLUME 0x0B Double value type for volume. NwDataType::dt_POINT3D 0x0C Point3d value type. NwDataType::dt_POINT2D 0x0D Point2d value type.
*/ NwDataType::Enum NWDBEXPORT variant2DataType(const OdNwVariant& value); /** \details Returns string interpretation for specified variant value. \param nwVariant [in] OdNwVariant value for string conversion. \returns string view of variant value format. */ OdString NWDBEXPORT variant2Str(const OdNwVariant& nwVariant); /** \details Returns variant value interpretation from string view. \param sValue [in] OdString value with string value for conversion. \param valueType [in] data type for correct conversion into variant value. \returns OdNwVariant with serialized string value. \remarks valueType can be one of the following: Name Value Description NwDataType::dt_NONE 0 Default value type. NwDataType::dt_DOUBLE 0x01 Double value type. NwDataType::dt_INT32 0x02 32-bit integer value type. NwDataType::dt_BOOL 0x03 Boolean value type. NwDataType::dt_DISPLAY_STRING 0x04 Display end-user string value type. NwDataType::dt_DATETIME 0x05 Date time value type. NwDataType::dt_DOUBLE_LENGTH 0x06 Double value type for length (in length's units). NwDataType::dt_DOUBLE_ANGLE 0x07 Double value type for angle (in radians). NwDataType::dt_NAME 0x08 Name value type (with pointer to OdNwName object). NwDataType::dt_IDENTIFIER_STRING 0x09 Programmatic identifier string value type. NwDataType::dt_DOUBLE_AREA 0x0A Double value type for area. NwDataType::dt_DOUBLE_VOLUME 0x0B Double value type for volume. NwDataType::dt_POINT3D 0x0C Point3d value type. NwDataType::dt_POINT2D 0x0D Point2d value type.
Currently, the types like the following are not supported: NwDataType::dt_POINT3D, NwDataType::dt_POINT2D, NwDataType::dt_DATETIME. String value for NwDataType::dt_NAME must look like "_internalName_(_displayName_)". */ OdNwVariant NWDBEXPORT str2Variant(const OdString& sValue, NwDataType::Enum valueType); } #endif // TNW_VARIANT_UTILS_H_