company logo

Value :: Value - Constructor

The value (handle) constructor creates and opens a value handle for a persistent or transient property instance. Usually, a value handles an elementary instance or instance array. In some cases, a value handle may also handle complex instances. Since value handle do not have got iteration functions, they cannot handle collections, except arrays. A data source contains the data for a property of a specific object. Except for the dummy constructor (no parameter), value handles are opened when being constructed successfully. In order to check the success one may use the isValid() or isAccessible() function.

When constructing a subsequent value handle (passing the parent property handle and the property name to the constructor), the parent must be opened. The data source provided in the subsequent property handle depends on the parents property handle current selection and will be provided automatically whenever the parent property handle changes its current selection.

You can create static value handles for constants or other elementary data sources as well as for structured instances using the appropriate constructor function. This also provides implicit data conversion, i.e. one may use standard data types in value operations as long as the left operand is a value handle.

// fragment: Property    person;

  Value    name(person,"name");

  Value    income(person,"income");

  

  name += " *";

  income += 200;

Implementation overview

Implementation details

  1. Create value handle for a 64-bit integer value
    Value  :: Value ( int64 i64Value )

    The function opens an application transient value handle for a platform independent 64-bit integer value (int64, INT(17)).

    • i64Value - Big integer value

      Big integer values are 64 bit integer values.

  2. to list
  3. Create value handle for a boolean value
    Value  :: Value ( bool bValue )

    The function opens an application transient value handle for a Boolean value (bool, LOGICAL).

    • bValue - Boolean value

      Valid values for Boolean values are true and false.

  4. to list
  5. Open value handle for a date value
    Value  :: Value ( odaba::Date &cDate )

    The function opens an application transient value handle for a date value (DATE).

    • cDate - Date

      The date contains day, month and year, but not the time.

  6. to list
  7. Open value handle for a date/time value
    Value  :: Value ( odaba::DateTime &cDateTime )

    The function opens an application transient value handle for a timestamp value (DateTime).

    • cDateTime - Time stamp

      A time stamp combines date and time

  8. to list
  9. Open value handle for a double value
    Value  :: Value ( double vDouble )

    The function opens an application transient value handle for a double value (REAL(15)).

    • vDouble - Double value
  10. to list
  11. Create an unbound property handle with type name
    Value  :: Value ( odaba::ObjectSpace &cObjectSpace, odaba::String &sTypeName )

    The constructor opens an application transient value handle for the complex data type passed in sTypeName. An instance is allocated and initialized.

    • cObjectSpace - Object space reference

      The reference refers to an opened or not opened object space handle.

    • sTypeName - Type name

      The type name is the name of a data type (usually) defined in the database. The type name might be passed as simple identifier or as scoped name with preceding namespace names separated by double colon '::'.

      In order to pass no type name, an empty string ( String() ) may be passed.

  12. to list
  13. Open value handle for a 32-bit integer value
    Value  :: Value ( int32 iValue )

    The function opens an application transient value handle for a platform independent 32-bit integer value (int32, INT(10)).

    • iValue - Integer value

      The value is passed as platform independent 32-bit integer value.

  14. to list
  15. Open value handle for fixed string value
    Value  :: Value ( odaba::String &sString, int32 iLength )

    The function opens an application transient value handle for a string value (STRING). The string area is allocated with the size passed in iLength. The string is copied into the instance area owned by the value handle.

    In order to create variable size text values, open(sString) should be used, instead.

    • sString - String value
    • iLength - Length

      The length is the size allocated for an instance or area.

  16. to list
  17. Open value handle for a string value
    Value  :: Value ( odaba::String &sString )

    The function opens an application transient value handle for a string value (STRING). The string area is allocated with the current size of the string passed in sString. The string is copied into the instance area owned by the value handle.

    In order to create fixed size text values, open(sString,iLength) should be used.

    • sString - String value
  18. to list
  19. Open value handle for a time value
    Value  :: Value ( odaba::Time &cTime )

    The function opens an application transient value handle for a time value (TIME).

    • cTime - Time value

      The time value is passed in the ODABA Interface::Time format and provides time in 1/100th seconds.

  20. to list
  21. Open cursor copy for a property handle
    Value  :: Value ( odaba::Value &cValue )

    The function creates a copy of the value handle passed in cValue. Both, the copy and the origin, share the the value instance, i.e. changing the value in one of the value handles will automatically change the value in the other.

    • cValue - Value handle

      A value handle refers to a (usually) opened value. Invalid value handles may cause an exception.

  22. to list
  23. Open an undefined value handle
    Value  :: Value (  )

    The function opens an invalid value handle. Before using the handle handle definition and instance area has to be set (open(...))..

  24. to list
  25. Create value for parent property handle
    Value  :: Value ( odaba::Property &cProperty, odaba::String &vAccessPath )

    The function has been provided for convenience in order to create a value handle by means of a parent property handle. Usually, value handles are created by appropriate property handle functions.

    // fragment: Property  person;

      Value   name(person,"name");

    // same as

      Value   name;

      name.use(person.value("name");

    • cProperty - Property reference

      A property handle refers to a (usually) opened property. Invalid properties may cause an exception.

    • vAccessPath - Access path

      An access path may simply refer to an extent or property, but also to a calculated result. Thus, an access path may contain just a name, but also a sequence of path elements separated by '.' in order to refer to far properties or complex operations.

      The access path may start with two dots (.), which indicates, that the path starts in an upper property handle. One dot indicates, that the path starts in the current property handle. This distinction becomes necessary, when a property has the same name as an extent. To access a property in this case, one dot must precede the property name. The first dot can be omitted, when the property name is not an extent name.

      Forcing to a path to start in a parent property handle requires two dots (..), the parents parent three and so on.

      In order to pass no access path, an empty string ( String() ) has to be passed.

      address.street      // property path

      .address.street     // property path

      ..address.street    // address in parent property instance

      children(0).Age()   // operation path

      Person().children() // path property

      children('Anton')   // path property

  26. to list
  27. Create value for subattribute
    Value  :: Value ( odaba::Value &cValue, odaba::String &vAccessPath )

    The function creates a value for a sub attribute in a complex attribute.

    • cValue - Value handle

      A value handle refers to a (usually) opened value. Invalid value handles may cause an exception.

    • vAccessPath - Access path

      An access path may simply refer to an extent or property, but also to a calculated result. Thus, an access path may contain just a name, but also a sequence of path elements separated by '.' in order to refer to far properties or complex operations.

      The access path may start with two dots (.), which indicates, that the path starts in an upper property handle. One dot indicates, that the path starts in the current property handle. This distinction becomes necessary, when a property has the same name as an extent. To access a property in this case, one dot must precede the property name. The first dot can be omitted, when the property name is not an extent name.

      Forcing to a path to start in a parent property handle requires two dots (..), the parents parent three and so on.

      In order to pass no access path, an empty string ( String() ) has to be passed.

      address.street      // property path

      .address.street     // property path

      ..address.street    // address in parent property instance

      children(0).Age()   // operation path

      Person().children() // path property

      children('Anton')   // path property

  28. to list