summaryrefslogtreecommitdiff
path: root/files.h
diff options
context:
space:
mode:
authorweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2002-10-06 03:23:16 +0000
committerweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2002-10-06 03:23:16 +0000
commit54aac9c52276331c818cebd420354c5e281d363a (patch)
treeb17efe5fa05ed03b0dff957ebafff5f0427bf02c /files.h
parent518ee466c969f557a66461999fce39c3d3eea352 (diff)
downloadcryptopp-54aac9c52276331c818cebd420354c5e281d363a.tar.gz
bug fixes
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@7 57ff6487-cd31-0410-9ec3-f628ee90f5f0
Diffstat (limited to 'files.h')
-rw-r--r--files.h66
1 files changed, 32 insertions, 34 deletions
diff --git a/files.h b/files.h
index 30f8dd6..0871d1d 100644
--- a/files.h
+++ b/files.h
@@ -1,5 +1,5 @@
-#ifndef CRYPTOPP_FILES_H
-#define CRYPTOPP_FILES_H
+#ifndef CRYPTOPP_FILES_H
+#define CRYPTOPP_FILES_H
#include "cryptlib.h"
#include "filters.h"
@@ -9,31 +9,29 @@
NAMESPACE_BEGIN(CryptoPP)
-//! .
-class FileStore : public Store, private FilterPutSpaceHelper
+//! .
+class FileStore : public Store, private FilterPutSpaceHelper
{
public:
- class Err : public Exception
+ class Err : public Exception
{
public:
- Err(const std::string &s) : Exception(IO_ERROR, s) {}
+ Err(const std::string &s) : Exception(IO_ERROR, s) {}
};
- class OpenErr : public Err {public: OpenErr(const std::string &filename) : Err("FileStore: error opening file for reading: " + filename) {}};
- class ReadErr : public Err {public: ReadErr() : Err("FileStore: error reading file") {}};
+ class OpenErr : public Err {public: OpenErr(const std::string &filename) : Err("FileStore: error opening file for reading: " + filename) {}};
+ class ReadErr : public Err {public: ReadErr() : Err("FileStore: error reading file") {}};
- FileStore() : m_stream(NULL) {}
+ FileStore() : m_stream(NULL) {}
FileStore(std::istream &in)
{StoreInitialize(MakeParameters("InputStreamPointer", &in));}
- FileStore(const char *filename)
+ FileStore(const char *filename)
{StoreInitialize(MakeParameters("InputFileName", filename));}
std::istream* GetStream() {return m_stream;}
unsigned long MaxRetrievable() const;
- unsigned int Peek(byte &outByte) const;
-
- unsigned int TransferTo2(BufferedTransformation &target, unsigned long &transferBytes, const std::string &channel=NULL_CHANNEL, bool blocking=true);
- unsigned int CopyRangeTo2(BufferedTransformation &target, unsigned long &begin, unsigned long end=ULONG_MAX, const std::string &channel=NULL_CHANNEL, bool blocking=true) const;
+ unsigned int TransferTo2(BufferedTransformation &target, unsigned long &transferBytes, const std::string &channel=NULL_CHANNEL, bool blocking=true);
+ unsigned int CopyRangeTo2(BufferedTransformation &target, unsigned long &begin, unsigned long end=ULONG_MAX, const std::string &channel=NULL_CHANNEL, bool blocking=true) const;
private:
void StoreInitialize(const NameValuePairs &parameters);
@@ -45,47 +43,47 @@ private:
bool m_waiting;
};
-//! .
+//! .
class FileSource : public SourceTemplate<FileStore>
{
public:
- typedef FileStore::Err Err;
- typedef FileStore::OpenErr OpenErr;
- typedef FileStore::ReadErr ReadErr;
+ typedef FileStore::Err Err;
+ typedef FileStore::OpenErr OpenErr;
+ typedef FileStore::ReadErr ReadErr;
- FileSource(BufferedTransformation *attachment = NULL)
- : SourceTemplate<FileStore>(attachment) {}
- FileSource(std::istream &in, bool pumpAll, BufferedTransformation *attachment = NULL)
- : SourceTemplate<FileStore>(attachment) {SourceInitialize(pumpAll, MakeParameters("InputStreamPointer", &in));}
- FileSource(const char *filename, bool pumpAll, BufferedTransformation *attachment = NULL, bool binary=true)
- : SourceTemplate<FileStore>(attachment) {SourceInitialize(pumpAll, MakeParameters("InputFileName", filename)("InputBinaryMode", binary));}
+ FileSource(BufferedTransformation *attachment = NULL)
+ : SourceTemplate<FileStore>(attachment) {}
+ FileSource(std::istream &in, bool pumpAll, BufferedTransformation *attachment = NULL)
+ : SourceTemplate<FileStore>(attachment) {SourceInitialize(pumpAll, MakeParameters("InputStreamPointer", &in));}
+ FileSource(const char *filename, bool pumpAll, BufferedTransformation *attachment = NULL, bool binary=true)
+ : SourceTemplate<FileStore>(attachment) {SourceInitialize(pumpAll, MakeParameters("InputFileName", filename)("InputBinaryMode", binary));}
std::istream* GetStream() {return m_store.GetStream();}
};
-//! .
-class FileSink : public Sink
+//! .
+class FileSink : public Sink
{
public:
- class Err : public Exception
+ class Err : public Exception
{
public:
- Err(const std::string &s) : Exception(IO_ERROR, s) {}
+ Err(const std::string &s) : Exception(IO_ERROR, s) {}
};
- class OpenErr : public Err {public: OpenErr(const std::string &filename) : Err("FileSink: error opening file for writing: " + filename) {}};
- class WriteErr : public Err {public: WriteErr() : Err("FileSink: error writing file") {}};
+ class OpenErr : public Err {public: OpenErr(const std::string &filename) : Err("FileSink: error opening file for writing: " + filename) {}};
+ class WriteErr : public Err {public: WriteErr() : Err("FileSink: error writing file") {}};
- FileSink() : m_stream(NULL) {}
+ FileSink() : m_stream(NULL) {}
FileSink(std::ostream &out)
{IsolatedInitialize(MakeParameters("OutputStreamPointer", &out));}
- FileSink(const char *filename, bool binary=true)
+ FileSink(const char *filename, bool binary=true)
{IsolatedInitialize(MakeParameters("OutputFileName", filename)("OutputBinaryMode", binary));}
std::ostream* GetStream() {return m_stream;}
void IsolatedInitialize(const NameValuePairs &parameters);
- unsigned int Put2(const byte *inString, unsigned int length, int messageEnd, bool blocking);
- bool IsolatedFlush(bool hardFlush, bool blocking);
+ unsigned int Put2(const byte *inString, unsigned int length, int messageEnd, bool blocking);
+ bool IsolatedFlush(bool hardFlush, bool blocking);
private:
std::ofstream m_file;