Exemplo n.º 1
0
bool InternalComposer::ComposeDetail(Descriptor* descriptor, Matrix* matrix)
{
    bool result = true;
    GetTrailer().TotalRecords = GetDetail()->GetNumberRows();
    size_t numberRows = GetDetail()->GetNumberRows();
    for (size_t i=0; i<numberRows; i++) {
        BufferClean();
        wxArrayString row;
        // prepare row
        for (size_t j=0, k=0; j<descriptor->GetSize(); j++) {
            XmlElementDescriptor* colDesc = (XmlElementDescriptor*)descriptor->GetElementDescriptor(j);
            if ( colDesc->IsEnabled() ) {
                row.Add(GetDetail()->GetValue(i, k++));
            } else {
                row.Add(colDesc->GetDefaultValue());
            }
        }
        // transformation for not enabled dependence
        for (size_t l=0; l<descriptor->GetSize(); l++) {
            XmlElementDescriptor* colDesc = (XmlElementDescriptor*)descriptor->GetElementDescriptor(l);
            ElementDependence* dep = colDesc->GetDependence();
            if ( NULL != dep ) {
                size_t index = dep->GetFieldIndex();
                if ( index >= 0 
                     && index < descriptor->GetSize()
                     && !descriptor->GetElementDescriptor(index)->IsEnabled() ) {
                    row[index] = colDesc->DependenceValue(row[l]);
                }
            }
        }
        // writing row to file
        wxString rowStr;
        for (size_t m=0; m<descriptor->GetSize(); m++) {
            ElementDescriptor* ed = GetDetail()->GetDescriptor()->GetElementDescriptor(m);
            bool dataCheck = CheckAndWriteData(ed, row[m]);
            if ( !dataCheck ) {
                LOG_MESSAGE(INFO_MESSAGE_LEVEL, wxString::Format(" Row is [%d].\n", i));
            }
            result = result && dataCheck;
        }
        UpdateTrailer(row[0]);
        BufferFlush();
    }
    return result;
};
Exemplo n.º 2
0
bool EdiComposer::ComposeDetail(const Document& doc) {
    bool result = true;

    GetTrailer().TotalRecords = doc.GetNumberRows();
    bool fillTrailer = true;

    for (size_t i=0; i<doc.GetNumberRows(); i++) {

        if ( fillTrailer )  {
            UpdateTrailer(doc.GetValue(i,0));
        }
        BufferClean();
        for (size_t j=0; j<doc.GetColCount(); j++) {
            WriteData(doc.GetColumnDescriptor(j), doc.GetValue(i,j));
        }
        BufferFlush();
    }
    return result;
};
Exemplo n.º 3
0
void CPDF_CrossRefTable::Update(
    std::unique_ptr<CPDF_CrossRefTable> new_cross_ref) {
  UpdateInfo(std::move(new_cross_ref->objects_info_));
  UpdateTrailer(std::move(new_cross_ref->trailer_));
}