4. Designing and Writing OpenROAD Server Applications : OpenROAD Parameter Data COM Object : DeclareAttribute Method : SetBlankDate, IsBlankDate, SetDateWithoutTime, IsDateWithoutTime Methods
 
Share this page                  
SetBlankDate, IsBlankDate, SetDateWithoutTime, IsDateWithoutTime Methods
Another special case in strongly typed languages is the OpenROAD blank DATE value. This value (an empty string) appears in an attribute that would otherwise contain only valid COM DATE values. Assigning an empty string to a DATE program variable is illegal in many languages; therefore, the IsBlankDate method provides a safe way to test for this special case before attempting an assignment.
These methods are valid only on scalar attributes, and there is no enforced requirement to use these only on DATE attributes. Using SetBlankDate is semantically equivalent to using SetAttribute with an empty string value. Using IsBlankDate is semantically equivalent to using GetAttribute and then testing the result to see whether it is an empty string value. The result of IsBlankDate is an integer, with nonzero meaning TRUE and zero meaning FALSE:
HRESULT SetBlankDate
    (
        [in] BSTR AttributeName,
    );

HRESULT IsBlankDate
    (
        [in] BSTR AttributeName,
        [out, retval] long * IsBlankDate
    );
A new ParameterData method, SetDateWithoutTime, is provided for COM clients to put a date-without-time value into a ParameterData attribute. The input is still given as a COM DATE timestamp, but the method truncates any time portion and stores the date value internally using a special encoding that identifies it as a date-without-time value.
HRESULT SetDateWithoutTime
    (
        [in] BSTR AttributeName,
        [in] VARIANT * AttributeValue
    );
The COM DATE data type does not support the concept of a date-without-time value, so the ParameterData GetAttribute method can only return a timestamp. A new method, IsDateWithoutTime, provides the additional semantics regarding date-without-time values.
HRESULT IsDateWithoutTime
    (
        [in] BSTR AttributeName,
        [out, retval] long * IsDateWithoutTime
    );