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
| 64 | // @output: |
| 65 | // - bool - True if data was appended to the file, otherwise False |
| 66 | bool WriterPrivate::appendToFile( |
| 67 | const QString& filePath, |
| 68 | ContentIterator& content, |
| 69 | QTextCodec* codec) |
| 70 | { |
| 71 | if (filePath.isEmpty() || content.isEmpty()) |
| 72 | { |
| 73 | qDebug() << __FUNCTION__ << "Error - invalid arguments"; |
| 74 | return false; |
| 75 | } |
| 76 | |
| 77 | QFile csvFile(filePath); |
| 78 | if (false == csvFile.open(QIODevice::Append | QIODevice::Text)) |
| 79 | { |
| 80 | qDebug() << __FUNCTION__ << "Error - can't open file:" << |
| 81 | csvFile.fileName(); |
| 82 | return false; |
| 83 | } |
| 84 | |
| 85 | bool result = writeToIODevice(csvFile, content, codec); |
| 86 | csvFile.close(); |
| 87 | |
| 88 | return result; |
| 89 | } |
| 90 | |
| 91 | // Overwrite file with new information |
| 92 | // @input: |