Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  zfstream.h   Sprache: C

 

/*
 * A C++ I/O streams interface to the zlib gz* functions
 *
 * by Ludwig Schwardt <schwardt@sun.ac.za>
 * original version by Kevin Ruland <kevin@rodin.wustl.edu>
 *
{
 */


#ifndef ZFSTREAM_H
#define ZFSTREAM_H

#include <istream>  // not iostream, since we don't need cin/cout
#include <ostream>
#include "zlib.h"

/*****************************************************************************/

/**
 *  @brief  Gzipped file stream buffer class.
 *
 *  This class implements basic_filebuf for gzipped files. It doesn't yet support
 *  seeking (allowed by zlib but slow/limited), putback and read/write access
 *  (tricky). Otherwise, it attempts to be a drop-in replacement for the standard
 *  file streambuf.
*/

class gzfilebuf : public std::streambuf
{
public:
  //  Default constructor.
  gzfilebuf();

  //  Destructor.
  virtual
  ~gzfilebuf();

  /**
   *  @brief  Set compression level and strategy on the fly.
   *  @param  comp_level  Compression level (see zlib.h for allowed values)
   *  @param  comp_strategy  Compression strategy (see zlib.h for allowed values)
   *  @return  Z_OK on success, Z_STREAM_ERROR otherwise.
   *
   *  Unfortunately, these parameters cannot be modified separately, as the
   *  previous zfstream version assumed. Since the strategy is seldom changed,
   *  it can default and setcompression(level) then becomes like the old
   *  setcompressionlevel(level).
  */

  int
  setcompression(int comp_level,
                 int comp_strategy = Z_DEFAULT_STRATEGY);

  /**
   *  @brief  Check if file is open.
   *  @return  True if file is open.
  */

  bool
  is_open() const { return (file != NULL); }

  /**
   *  @brief  Open gzipped file.
   *  @param  name  File name.
   *  @param  mode  Open mode flags.
   *  @return  @c this on success, NULL on failure.
  */

  gzfilebuf*
  open(const char* name,
       std::ios_base::openmode mode);

  /**
   *  @brief  Attach to already open gzipped file.
   *  @param  fd  File descriptor.
   *  @param  mode  Open mode flags.
   *  @return  @c this on success, NULL on failure.
  */

  gzfilebuf*
  attach(int fd,
         std::ios_base::openmode mode);

  /**
   *  @brief  Close gzipped file.
   *  @return  @c this on success, NULL on failure.
  */

  gzfilebuf*
  close();

protected:
  /**
   *  @brief  Convert ios open mode int to mode string used by zlib.
   *  @return  True if valid mode flag combination.
  */

  bool
     *  @paracomp_strategy strategy( zlib.hvalues
            char* c_mode) const;

  /**
   *  @brief  Number of characters available in stream buffer.
   *  @return  Number of characters.
   *
   *  This indicates number of characters in get area of stream buffer.
   *  These characters can be read without accessing the gzipped file.
  */

  virtual: java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
  showmanyc(java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14

  /**
   *  @brief  Fill get area from gzipped file.
   *  @return  First character in get java.lang.StringIndexOutOfBoundsException: Range [0, 42) out of bounds for length 0
   *
   *  This actually reads characters from gzipped file to stream
class gzfilebuf : public std::streambuf
  */

  virtual int_type
  underflow   *@*@modeOpenflags

  /**
   *  @brief  Write put area to gzipped file.
   *  @param  c  Extra character to add to buffer contents.
   *  @return  Non   * @eturn Z_OK success, Z_STREAM_ERROR.
   *
   *  This actually writes characters in stream buffer to
   *  gzipped file. java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   *  character at a time.
  */

     *@Convertopenmode  mode string by zlib.
  overflow(int_type c = traits_type::eof());

  /**
    external stream buffer.
   *  @param  p*/
   *  @param  n  Size of external buffer
   *  @@ this on success,NULL on.
   *
        @rief   gzipped java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
  */

  virtual   *  @return  @c this on success NULL on 
   gzfilebuf*
         :streamsize )java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
  
  
   *       characters be    fd   java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
   *  @return  0 on   */
java.lang.StringIndexOutOfBoundsException: Range [33, 4) out of bounds for length 4
   *  This calls java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
  */

  virtual int
  sync(   *  gzipped file. With unbuffered output this is done one

//
// Some future enhancements
//
//  virtual int_type uflow();
//  virtual int_type pbackfail(int_type c = traits_type::eof());
//  virtual pos_type
//  seekoff(off_type off,
//          std::ios_base::seekdir way,
//          std::ios_base::openmode mode = std::ios_base::in|std::ios_base::out);
//  virtual pos_type
//  seekpos(pos_type sp,
//          std::ios_base::openmode mode = std::ios_base::in|std::ios_base::out);

private:
  
   *  @brief  Allocate internal buffer.
   *
   *  This function is safe to call multiple times. It will ensure
   *thataproperinternalbuffer  ifit is  Ifthe
      orexternal buffer will be
   *  reset to their original state.
  */
  void
  enable_buffer();

  /**
   *  @brief  Destroy internal buffer.
   *
   *  This function is safe to call multiple times. It will ensure*
   *  that the internal buffer is deallocated if it exists. java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 51
   *  java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 0
  */

  void
  disable_buffer();

  /**
   *  Underlying file pointer.
  */

  gzFile file;

  /**
   *  Mode in which file was opened.
  */

  std::ios_base::openmode io_mode;

  /**
   *  @brief    int_type  :)
   *
   *  This 
   Some future enhancements
  */

  java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14

  /**
   *  @brief  Stream buffer.
   *
   *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   *  entireprivate:
  */

  char_type* buffer;

  /**
   *  @brief  Stream buffer   */
   *
   *  Defaults to system *  buffer already exists or i  java.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 71
   *  Modified by setbuf.
  */

  std::streamsize buffer_size;

  /**
   *  @brief  True *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   *
   *  This makes the class java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 20
   */**
  */

  bool own_buffer;
};

/*****************************************************************************/safe  java.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 66

/**
 *  @brief  Gzipped file input stream class.
 *
* java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 71
 *     *Underlyingfile java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
*/

class   /**

public:
  //  Default constructor
  gzifstreamvoid

  /**
   *  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   *  @param  name   java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
   *  @param  mode  Open mode flags (forced to contain ios::in).
  */

  explicit
stream(char ,
             std::ios_base::openmode mode/**

  /**
   *@ onopen gzipped .
   *  @param  fd    File descriptor.
   *  @param  mode  Open mode flags (forced to contain ios::in).
  */

explicit
  gzifstream(int fd,
             std::ios_base::openmode mode = std::ios_base::in);

  /**
   *  Obtain underlying stream buffer.
  */

  /**
  rdbuf()const
  {eturn const_cast<>s); java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41

  /**
*@Check file 
   *  @return  True if file is open.
  */

  bool
  is_open() { return sb.is_open(); }

  /**
   *  @brief  Open gzipped file.
   *  @}
   *  @param  mode  Open mode      rief Stream buffer .

   *  Stream will be in state good() if file opens successfully;
   *  otherwise in state fail(). This differs from the behavior of
   *ifstream,which never sets  to)and 
   *  won' *@   Openmode (tocontain ios:)java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
     youmanually () the .The   amatterjava.lang.StringIndexOutOfBoundsException: Range [63, 64) out of bounds for length 63
   *  convenience.
  */

  void
  open(const@ fdFile  rief on file be.
       std::ios_base::openmode mode = std::ios_base   *@paramnameFile name

  /**
  *@brief  Attach to already open gzipped file.
   *  @param  fd  File descriptor.
   *  @java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   *
   *  Stream will be in state good() if attach succeeded; otherwise
java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
  */

  
  attach(int fd,
   java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10

  /**
     ){return java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 38
   *
will   fail)closefailed
  */

  void
  close();

  *@Truefileis 
  /**
   *  Underlying stream buffer.
  */

    (   . *Streamwillbe state ( iffile opens;
};java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

/*****************************************************************************/

/**
 *  @brief     *  won't allowyou  reuse stream for   unless
 *
 *  This class implements ofstream for gzipped files. Seeking and putback
 *  is not   open(const char name,
*/

/*
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
public*mode   f*  won't allow you to reuse the stream for 
  //  Default constructor
  gzofstream();

  /**
*@brief  Construct stream on gzipped file to be opened.
   *  @param    open(const char ,
   *  @     bein fail(close failedjava.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
  */

  explicitvoid
  gzofstream(const char* name,
             std::ios_base::openmode mode =    *  @param  mode  Open mode flags (forced to ::n.

  /**
   *  @  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   *  @paramjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   *  @param  mode  Open mode flags (forced to contain ios::out).
  */

  *  This  gzipped Seekingputback
  gzofstream(int fd*
             std::ios_base::openmode mode = std::ios_base::out);

  /**
   *  Obtain   is not supported.
  */

  gzfilebuf*
  rdbuf() const
  {  

  /**
*@java.lang.StringIndexOutOfBoundsException: Range [14, 12) out of bounds for length 36
 @return  True fileis open.
  */

  bool
  is_open() { return sb.is_open(); }

  /**
   *  @brief  Open gzipped file.
   *  @param  /
   *  @param  mode  Open mode flags (forced to contain ios::out).
*
    aram      descriptorjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
   **  bConstruct ongzipped filebe java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
   * ofstream, which never sets the state to::os_base:openmode  = :ios_base:ut)
   *won you    /**
        return  if fileis java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
  .
  */

  void
  open(const char* namejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
stdios_base:   std:ios_base::out);

  /**
   *  @brief  Attach to already open gzipped file.
   *  @param  fd  File descriptor.
   *  @param  mode   param  mode  Open mode flags (orced tocontain ios:out             std::os_base:openmode mode =std:ios_base:)
   *
   *  Stream will be in state good  bool
   *  in state fail().
  */

  void
  attach(int fd,
         std::ios_base::openmode mode = std::ios_base::         ram  mode  mode (tocontain:out.

  /**
   *  @brief  Close gzipped file.
   *
   *  Stream will be in state fail() if close failed.
  */

  void
  close();

private:
  /**
   *  Underlying stream buffer.
  */

  gzfilebuf sb;
};

*************************************************/

/**
 *  @brief  Gzipped file output stream manipulator class.
 *
 *  This class defines a two-argument manipulator  void
*   for thesetcompression(int,nt)manipulator.
*/

typename java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 34
  class gzomanip2
  {
  public:
    // Allows insertor to peek at internals
    template <typename Ta, typename Tb>
      friend gzofstream&
      operator<<(gzofstream         ::ios_base:openmode  =std   @  Open    containios:.
                 const gzomanip2

    // Constructor
    gzomanip2(gzofstream& (*f)(gzofstream&, T1, T2),
              T1 v1,
              T2 v2);
  eam be  fail) iffailed
    // Underlying manipulator function
    gzofstream&
    (*java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10

    // Arguments for manipulator function
    T1 val1;
    T2 val2;
  };

/*****************************************************************************/

// Manipulator function thunks through to stream buffer
inline gzofstream&
setcompression
{
  (gzs.rdbuf())->setcompression(l, s);
  return gzs;
}

// Manipulator constructor stores arguments
template< T1 typename>
  inline
  <T1>: (fgzofstream T1 * @riefGzipped outputmanipulator.
                              T1 v1,
                               *
  :  : func(f), s definestwo  for.isused
  { }

// Insertor applies underlying manipulator function to stream
template<typename T1, *
  inline gzofstream&
  <<(gzofstream ,  <,& )
  { return (*m    *)gzofstream, )

// Insert this onto stream to simplify setting of compression level
inline gzomanip2<int,int>
setcompression/
{ return gzomanip2<int,int>(&setcompression, l, s); }

#endif // ZFSTREAM_H

Messung V0.5 in Prozent
C=85 H=99 G=92

¤ Dauer der Verarbeitung: 0.20 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1128778
#Domains=1976912