<commit_before>/* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */

/* libmwaw
* Version: MPL 2.0 / LGPLv2+
*
* The contents of this file are subject to the Mozilla Public License Version
* 2.0 (the "License"); you may not use this file except in compliance with
* the License or as specified alternatively below. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* Major Contributor(s):
* Copyright (C) 2002 <NAME> (<EMAIL>)
* Copyright (C) 2002,2004 <NAME> (<EMAIL>)
* Copyright (C) 2004-2006 <NAME> (<EMAIL>)
* Copyright (C) 2006, 2007 <NAME>
* Copyright (C) 2011, 2012 <NAME> (<EMAIL>)
*
*
* All Rights Reserved.
*
* For minor contributions see the git repository.
*
* Alternatively, the contents of this file may be used under the terms of
* the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
* in which case the provisions of the LGPLv2+ are applicable
* instead of those above.
*/

#ifndef CSV_GENERATOR_H
#define CSV_GENERATOR_H

#include <fstream>
#include <ostream>
#include <vector>

#include <librevenge/librevenge.h>

class CSVGenerator : public librevenge::RVNGTextInterface
{
public:
  CSVGenerator(char const *fName=0);
  virtual ~CSVGenerator();

  virtual void setDocumentMetaData(const librevenge::RVNGPropertyList &) {};

  virtual void startDocument(const librevenge::RVNGPropertyList &) {}
  virtual void endDocument() {}

  virtual void definePageStyle(const librevenge::RVNGPropertyList &) {}
  virtual void openPageSpan(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void closePageSpan() {}
  virtual void openHeader(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void closeHeader() {}
  virtual void openFooter(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void closeFooter() {}

  virtual void defineSectionStyle(const librevenge::RVNGPropertyList &) {}
  virtual void openSection(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void closeSection() {}

  virtual void defineParagraphStyle(const librevenge::RVNGPropertyList &) {}
  virtual void openParagraph(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void closeParagraph() {}

  virtual void defineCharacterStyle(const librevenge::RVNGPropertyList &) {}
  virtual void openSpan(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void closeSpan() {}

  virtual void insertTab();
  virtual void insertText(const librevenge::RVNGString &text);
  virtual void insertSpace();
  virtual void insertLineBreak();
  virtual void insertField(const librevenge::RVNGPropertyList &/*propList*/) {}
  virtual void openLink(const librevenge::RVNGPropertyList &/*propList*/) {}
  virtual void closeLink() {}

  virtual void defineOrderedListLevel(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void defineUnorderedListLevel(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void openOrderedListLevel(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void openUnorderedListLevel(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void closeOrderedListLevel() {}
  virtual void closeUnorderedListLevel() {}
  virtual void openListElement(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void closeListElement() {}

  virtual void openFootnote(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void closeFootnote() {}
  virtual void openEndnote(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void closeEndnote() {}
  virtual void openComment(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void closeComment() {}
  virtual void openTextBox(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void closeTextBox() {}

  virtual void openTable(const librevenge::RVNGPropertyList & /* propList */);
  virtual void openTableRow(const librevenge::RVNGPropertyList & /* propList */);
  virtual void closeTableRow();
  virtual void openTableCell(const librevenge::RVNGPropertyList & /* propList */);
  virtual void closeTableCell();
  virtual void insertCoveredTableCell(const librevenge::RVNGPropertyList & /* propList */) {};
  virtual void closeTable();

  virtual void openFrame(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void closeFrame() {}

  virtual void insertBinaryObject(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void insertEquation(const librevenge::RVNGPropertyList & /* propList */) {}

private:
  std::ostream &getOutput();

  std::fstream m_output;
  bool m_outputInit;

  bool m_dataStarted;
  bool m_firstFieldSend;

  // Unimplemented to prevent compiler from creating crasher ones
  CSVGenerator(const CSVGenerator &);
  CSVGenerator &operator=(const CSVGenerator &);
};

#endif /* CSV_GENERATOR_H */
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:<commit_msg>CSVGenerator: update to the new RVNGTextInterface ABI...<commit_after>/* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */

/* libmwaw
* Version: MPL 2.0 / LGPLv2+
*
* The contents of this file are subject to the Mozilla Public License Version
* 2.0 (the "License"); you may not use this file except in compliance with
* the License or as specified alternatively below. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* Major Contributor(s):
* Copyright (C) 2002 <NAME> (<EMAIL>)
* Copyright (C) 2002,2004 <NAME> (<EMAIL>)
* Copyright (C) 2004-2006 <NAME> (<EMAIL>)
* Copyright (C) 2006, 2007 <NAME>
* Copyright (C) 2011, 2012 <NAME> (<EMAIL>)
*
*
* All Rights Reserved.
*
* For minor contributions see the git repository.
*
* Alternatively, the contents of this file may be used under the terms of
* the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
* in which case the provisions of the LGPLv2+ are applicable
* instead of those above.
*/

#ifndef CSV_GENERATOR_H
#define CSV_GENERATOR_H

#include <fstream>
#include <ostream>
#include <vector>

#include <librevenge/librevenge.h>

class CSVGenerator : public librevenge::RVNGTextInterface
{
public:
  CSVGenerator(char const *fName=0);
  virtual ~CSVGenerator();

  virtual void setDocumentMetaData(const librevenge::RVNGPropertyList &) {};

  virtual void startDocument(const librevenge::RVNGPropertyList &) {}
  virtual void endDocument() {}

  virtual void definePageStyle(const librevenge::RVNGPropertyList &) {}
  virtual void openPageSpan(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void closePageSpan() {}
  virtual void openHeader(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void closeHeader() {}
  virtual void openFooter(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void closeFooter() {}

  virtual void defineSectionStyle(const librevenge::RVNGPropertyList &) {}
  virtual void openSection(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void closeSection() {}

  virtual void defineParagraphStyle(const librevenge::RVNGPropertyList &) {}
  virtual void openParagraph(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void closeParagraph() {}

  virtual void defineCharacterStyle(const librevenge::RVNGPropertyList &) {}
  virtual void openSpan(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void closeSpan() {}

  virtual void insertTab();
  virtual void insertText(const librevenge::RVNGString &text);
  virtual void insertSpace();
  virtual void insertLineBreak();
  virtual void insertField(const librevenge::RVNGPropertyList &/*propList*/) {}
  virtual void openLink(const librevenge::RVNGPropertyList &/*propList*/) {}
  virtual void closeLink() {}

  virtual void defineOrderedListLevel(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void defineUnorderedListLevel(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void openOrderedListLevel(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void openUnorderedListLevel(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void closeOrderedListLevel() {}
  virtual void closeUnorderedListLevel() {}
  virtual void openListElement(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void closeListElement() {}

  virtual void openFootnote(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void closeFootnote() {}
  virtual void openEndnote(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void closeEndnote() {}
  virtual void openComment(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void closeComment() {}
  virtual void openTextBox(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void closeTextBox() {}

  virtual void openTable(const librevenge::RVNGPropertyList & /* propList */);
  virtual void openTableRow(const librevenge::RVNGPropertyList & /* propList */);
  virtual void closeTableRow();
  virtual void openTableCell(const librevenge::RVNGPropertyList & /* propList */);
  virtual void closeTableCell();
  virtual void insertCoveredTableCell(const librevenge::RVNGPropertyList & /* propList */) {};
  virtual void closeTable();

  virtual void openFrame(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void closeFrame() {}

  virtual void openGroup(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void closeGroup() {}

  virtual void defineGraphicStyle(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void drawRectangle(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void drawEllipse(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void drawPolygon(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void drawPolyline(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void drawPath(const librevenge::RVNGPropertyList & /* propList */) {}

  virtual void insertBinaryObject(const librevenge::RVNGPropertyList & /* propList */) {}
  virtual void insertEquation(const librevenge::RVNGPropertyList & /* propList */) {}

private:
  std::ostream &getOutput();

  std::fstream m_output;
  bool m_outputInit;

  bool m_dataStarted;
  bool m_firstFieldSend;

  // Unimplemented to prevent compiler from creating crasher ones
  CSVGenerator(const CSVGenerator &);
  CSVGenerator &operator=(const CSVGenerator &);
};

#endif /* CSV_GENERATOR_H */
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
{'fraction_non_alphanumeric': 0.11684684684684685, 'fraction_numerical': 0.008828828828828829, 'mean_word_length': 5.2400224845418775, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2823175', 'n_tokens_mistral': 3303, 'n_tokens_neox': 3222, 'n_words': 929}