Menu

Mixed data types in a row.

2015-03-28
2015-03-28
  • W Semmelink

    W Semmelink - 2015-03-28

    What is the correct procedure to export mixed data types in a row?
    Example code I have is like this:

       vector<CellDataInt> data;   // whole row is now forced to integer type
       CellDataInt def;
       def.style_id = 0;        
       for (int i = 0; i < colNum; i++) {
           def.value = (double)(rand() % 100);
           data.push_back(def);
       }
    

    The vector contains only integer (or other type as specified).
    Is there a way we can have, say column one as string, then a double column, then a date column, then a few integer columns?

    I would suggest if there is not yet a better way, maybe make CellDataStr, CellDataTime, CellDataInt, CellDataUInt, CellDataDbl etc inherit from a common parent class so we can handle it polymorphically... ? or something similar.

     
  • Pavel Akimov

    Pavel Akimov - 2015-03-28

    So far, there are no options to add entire row with mixed typed cells.

    Yes, inheritance can make it work.
    Initially it was made without inheritance feature because of performance reasons as this library targeted generating tonns of data where time becomes a critical factor

    I cannot say when there going to be a next version, but according to the license you can customize it in any way you want

     

Log in to post a comment.