Append information to the file @input: - filePath - string with absolute path to csv-file - content - not empty handler of content for csv-file - codec - pointer to codec object that would be used for file writing @output: - bool - True if data was appended to the file, otherwise False
| 58 | // @output: |
| 59 | // - bool - True if data was appended to the file, otherwise False |
| 60 | bool WriterPrivate::appendToFile( |
| 61 | const QString& filePath, |
| 62 | ContentIterator& content, |
| 63 | const QStringConverter::Encoding codec) |
| 64 | { |
| 65 | if (filePath.isEmpty() || content.isEmpty()) { |
| 66 | qDebug() << __FUNCTION__ << "Error - invalid arguments"; |
| 67 | return false; |
| 68 | } |
| 69 | |
| 70 | QFile csvFile(filePath); |
| 71 | if (!csvFile.open(QIODevice::Append | QIODevice::Text)) { |
| 72 | qDebug() << __FUNCTION__ << "Error - can't open file:" << |
| 73 | csvFile.fileName(); |
| 74 | return false; |
| 75 | } |
| 76 | |
| 77 | const auto result = writeToIODevice(csvFile, content, codec); |
| 78 | csvFile.close(); |
| 79 | |
| 80 | return result; |
| 81 | } |
| 82 | |
| 83 | // Overwrite file with new information |
| 84 | // @input: |