Wide Studio Object Reference

Wide Studio Home
Up to

## Class Name

WSCindexData

## Specification of methods

### WSCindexData Function Description

Form
  WSCindexData()
Function
  Constructor of an indexed list data structure. Create an instance of indexed list data.
Description
Parameters
  None.
Return value
  A pointer to an instance of an indexed list data
Notice
Samples

         WSCindexData  indexdata;
         long data1 = 100;
         long data2 = 200;

         //Memorize values by attaching the index
         indexdata["data1"] = (void*)data1;
         indexdata["data2"] = (void*)data2;

         //When you want to do the same using setData():
         indexdata.setData("data1",(void*)data1);
         indexdata.setData("data2",(void*)data2);

         //Obtain memorized data specifying the index
         void* val1 = indexdata["data1"];
         void* val2 = indexdata["data2"];

         //When you want to do the same using getData():
         void* val3 = indexdata.getData("data1");
         void* val4 = indexdata.getData("data2");

         //To obtain the index:
         char* index1 = indexdata.getIndex(0); //"data1" is returned
         char* index2 = indexdata.getIndex(1); //"data2" is returned

         //Obtaining by a position:
         void* val5 = indexdata.getData(0);
         void* val6 = indexdata.getData(1);

         //Obtaining the number of element:
         long num = indexdata.getNum();

         //Deleting data specifying the index
         indexdata.del("data2");

         //Deleting data specifying a position
         indexdata.delPos(0);

         //When you want to clear all data at once:
         indexdata.clear();

### WSCindexData Function Description

Form
  WSCindexData(WSCindexData& src)
Function
  Copy constructor of an indexed list data structure Duplicate a given list
Description
Parameters

  (in)WSCindexData& src | Copy source instance

Return value
  A pointer to an intance of an indexed list data
Notice
Samples

         //Memorize values by attaching the index
         WSCindexData  indexdata;
         indexdata["data1"] = (void*)data1;
         indexdata["data2"] = (void*)data2;
         //Copy another indexdata2 by a copy constructor
         WSCindexData  indexdata2(indexdata);

  ### setData Function Description

  Form
    long setData(char* index,void* data)
  Function
    Store data with a specified index
  Description
  Parameters

    (in)char* index | Index name
    (in)void* data | Data

  Return value
    WS_NO_ERR= Normal, otherwise error
  Notice
  Samples
    Refer to WSCindexData()

  ### getIndex Function Description

  Form
    char* getIndex(long pos)
  Function
    Obtain an index name of a specified position
  Description
  Parameters

    (in)long pos | Data position (Top as 0)

  Return value
    Index name
  Notice
  Samples
    Refer to WSCindexData()

  ### getData Function Description

  Form
    void* getData(char* index)
  Function
    Obtain data corresponding to a specified index
  Description
  Parameters

    (in)char* index | Index

  Return value
    Stored data
  Notice
    When there is not data which corresponds to an index, it returns 0
  Samples
    Refer to WSCindexData()

  ### getData Function Description

  Form
    void* getData(long pos)
  Function
    Obtain specified position data
  Description
  Parameters

    (in)long pos | Data position (Top as 0)

  Return value
    Data
  Notice
  Samples
    Refer to WSCindexData()

  ### getNum Function Description

  Form
    long getNum()
  Function
    Obtain the number of data that has been listed
  Description
  Parameters
    None.
  Return value
    The number of data
  Notice
  Samples
    Refer to WSCindexData()

  ### del Function Description

  Form
    long del(char* index);
  Function
    Delete data corresponding to a specified index
  Description
  Parameters

    (in)char* index | Index

  Return value
    WS_NO_ERR= Normal, otherwise error
  Notice

  ### delPos Function Description

  Form
    long delPos(long pos);
  Function
    Delete a specified position data
  Description
  Parameters

    (in)long pos | Data position (Top as 0)

  Return value
    WS_NO_ERR= Normal, otherwise error
  Notice
  Samples
    Refer to WSCindexData()

  ### clear Function Description

  Form
    void clear();
  Function
    Delete all retained data
  Description
  Parameters
    None.
  Return value
    None.
  Notice
  Samples
    Refer to WSCindexData()

  ### [ ] Operator Description

  Form
    void*& WSCindexData::operator [] (char* index)
  Function
    Obtain data corresponding to a specified index
  Description
  Parameters

    (in)char* index | Index

  Return value
    Data
  Notice
  Samples
    Refer to WSCindexData()

  ### = Operator Description

  Form
    WSCindexData& operator = (WSCindexData& src)
  Function
    Copy operator
  Description
  Parameters

    (in)WSCindexData& src | Copy source instance

  Return value
    Copied instance
  Notice
  Samples

           //Memorize value by attaching the index
           WSCindexData  indexdata;
           indexdata["data1"] = (void*)data1;
           indexdata["data2"] = (void*)data2;
           //Copoy another indexdata2 by a copy constructor
           WSCindexData  indexdata2;
           //Copy operator is executed
           indexdata2 = indexdata;

  Document Release 3.70
  For use with Wide Studio Release 3.70, Spring 2004

  Wide Studio Home | Up to

  Copyright(C) WideStudio Development Team, 1999-2004 |  | Last modified: May 25, 2004