/// <summary> /// CSV データを書き出し、ファイルをクローズします。 /// </summary> /// <returns> /// なし /// </returns> void close() { if (!isOpened()) { return; } if (!m_isHead) { nextLine(); } m_writer.close(); }
XtgIm::XtgIm(QString fileName, QString enc, PageItem *textItem, bool textOnly) { PrefsContext* prefs = PrefsManager::instance()->prefsFile->getPluginContext("XtgIm"); bool prefix = prefs->getBool("prefix", true); bool ask = prefs->getBool("askAgain", true); encoding = enc; qDebug()<<"Encoding = "<<encoding; in_Buffer = ""; TextWriter *writer = new TextWriter(textItem->doc()); writer->open(textItem); if (!textOnly) { if (ask) { XtgDialog* xtgdia = new XtgDialog(prefix); if (xtgdia->exec()) { prefix = xtgdia->usePrefix(); prefs->set("prefix", xtgdia->usePrefix()); prefs->set("askAgain", xtgdia->askAgain()); delete xtgdia; } else { delete xtgdia; return; } } } filename = fileName; /** This will load the xtg file into a QByte Array which will be used for furthur parsing */ loadFiletoArray(); in_Buffer = toUnicode(buffer); QString docname = filename.right(filename.length() - filename.lastIndexOf("/") - 1); docname = docname.left(docname.lastIndexOf(".")); XtgScanner *scanner = new XtgScanner(docname,writer,in_Buffer,textOnly,prefix); scanner->xtgParse(); writer->close(); }