Example #1
0
void DefaultDetail::Store(wxString& filename)
{
    wxFile file(filename, wxFile::write);
    wxString names, values;
    Descriptor* descriptor = GetDescriptor();
    int k;

    for (size_t n=0; n<descriptor->GetSize(); n++) {
                names += descriptor->GetElementDescriptor(n)->GetName();
                names += DEFAULT_COLUMN_SEPARATOR;
    }
    file.Write(names + DEFAULT_LINE_SEPARATOR);
    
    for (int i=0; i<GetNumberRows(); i++) {
        k = 0;
        values = "";
        for (size_t j=0; j<descriptor->GetSize(); j++) {
            ElementDescriptor* ed = descriptor->GetElementDescriptor(j);
            if ( ed->IsEnabled() ) {
                values += GetValue(i, k++);
            } else {
                values += ed->GetDefaultValue();
            }
            values += DEFAULT_COLUMN_SEPARATOR;
        }
        file.Write(values + DEFAULT_LINE_SEPARATOR);
    }
    file.Close();
}