<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.
*
* 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.
*/

#include <librevenge-stream/librevenge-stream.h>

class MWAWStringStreamPrivate;

/** internal class used to create a RVNGInputStream from a unsigned char's pointer

    \note this class (highly inspired from librevenge) does not
    implement the isStructured's protocol, ie. it only returns false.
 */
class MWAWStringStream: public librevenge::RVNGInputStream
{
public:
  //! constructor
  MWAWStringStream(const unsigned char *data, const unsigned int dataSize);
  //! destructor
  ~MWAWStringStream();

  //! append some data at the end of the string
  void append(const unsigned char *data, const unsigned int dataSize);
  /**! reads numbytes data.

   * \return a pointer to the read elements
   */
  const unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead);
  //! returns actual offset position
  long tell();
  /*! \brief seeks to a offset position, from actual, beginning or ending position
   * \return 0 if ok
   */
  int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType);
  //! returns true if we are at the end of the section/file
  bool isEnd();

  /** returns true if the stream is ole

   \sa returns always false*/
  bool isStructured();
  /** returns the number of sub streams.

   \sa returns always 0*/
  unsigned subStreamCount();
  /** returns the ith sub streams name

   \sa returns always 0*/
  const char *subStreamName(unsigned);
  /** returns true if a substream with name exists

   \sa returns always false*/
  bool existsSubStream(const char *name);
  /** return a new stream for a ole zone

   \sa returns always 0 */
  librevenge::RVNGInputStream *getSubStreamByName(const char *name);
  /** return a new stream for a ole zone

   \sa returns always 0 */
  librevenge::RVNGInputStream *getSubStreamById(unsigned);

private:
  MWAWStringStreamPrivate *d;
  MWAWStringStream(const MWAWStringStream &); // copy is not allowed
  MWAWStringStream &operator=(const MWAWStringStream &); // assignment is not allowed
};

// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:<commit_msg>add missing include guard<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.
*
* 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 MWAWSTRINGSTREAM_HXX
#define MWAWSTRINGSTREAM_HXX

#include <librevenge-stream/librevenge-stream.h>

class MWAWStringStreamPrivate;

/** internal class used to create a RVNGInputStream from a unsigned char's pointer

    \note this class (highly inspired from librevenge) does not
    implement the isStructured's protocol, ie. it only returns false.
 */
class MWAWStringStream: public librevenge::RVNGInputStream
{
public:
  //! constructor
  MWAWStringStream(const unsigned char *data, const unsigned int dataSize);
  //! destructor
  ~MWAWStringStream();

  //! append some data at the end of the string
  void append(const unsigned char *data, const unsigned int dataSize);
  /**! reads numbytes data.

   * \return a pointer to the read elements
   */
  const unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead);
  //! returns actual offset position
  long tell();
  /*! \brief seeks to a offset position, from actual, beginning or ending position
   * \return 0 if ok
   */
  int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType);
  //! returns true if we are at the end of the section/file
  bool isEnd();

  /** returns true if the stream is ole

   \sa returns always false*/
  bool isStructured();
  /** returns the number of sub streams.

   \sa returns always 0*/
  unsigned subStreamCount();
  /** returns the ith sub streams name

   \sa returns always 0*/
  const char *subStreamName(unsigned);
  /** returns true if a substream with name exists

   \sa returns always false*/
  bool existsSubStream(const char *name);
  /** return a new stream for a ole zone

   \sa returns always 0 */
  librevenge::RVNGInputStream *getSubStreamByName(const char *name);
  /** return a new stream for a ole zone

   \sa returns always 0 */
  librevenge::RVNGInputStream *getSubStreamById(unsigned);

private:
  MWAWStringStreamPrivate *d;
  MWAWStringStream(const MWAWStringStream &); // copy is not allowed
  MWAWStringStream &operator=(const MWAWStringStream &); // assignment is not allowed
};

#endif

// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
{'fraction_non_alphanumeric': 0.08955962394854032, 'fraction_numerical': 0.005607784924954643, 'mean_word_length': 3.9101214574898786, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6787927', 'n_tokens_mistral': 1753, 'n_tokens_neox': 1702, 'n_words': 745}