⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ckbytedata.h

📁 DES加密解密算法,西望大家共享.参考学习
💻 H
字号:
// CkByteData.h: interface for the CkByteData class.
//
//////////////////////////////////////////////////////////////////////

#ifndef _CKBYTEDATA_H
#define _CKBYTEDATA_H

#pragma once

#include "CkObject.h"

#include "CkString.h"

// The CkByteData class is a convenient class for holding a block of
// binary data, or non-null terminated text data.

// CLASS: CkByteData
class CkByteData : public CkObject
{
    public:
	CkByteData();
	~CkByteData();

	CkByteData(const CkByteData &);
	CkByteData &operator=(const CkByteData &);

	// BEGIN PUBLIC INTERFACE
	bool get_Utf8(void) const;
	void put_Utf8(bool b);


	// Clears the object of data.
	void clear(void);

	// Get the size in bytes.
        unsigned long getSize(void) const;

	// Get a pointer to the data.
        const unsigned char *getData(void) const;
        const unsigned char *getBytes(void) const;
        const unsigned char *getDataAt(int byteIndex) const;

	unsigned char getByte(int byteIndex) const;
	char getChar(int byteIndex) const;
	unsigned int getUInt(int byteIndex) const;
	int getInt(int byteIndex) const;
	unsigned short getUShort(int byteIndex) const;
	short getShort(int byteIndex) const;

	// Append more data
        void append(const unsigned char *data, unsigned long numBytes);
	void append(const char *byteData, unsigned long numBytes);

	void appendStr(const char *str);
	void appendChar(char ch);

	// Encoding can be "base64", "quoted-printable", "hex", or "url"
	void appendEncoded(const char *str, const char *encoding);
	void encode(const char *encoding, CkString &str);

	// Load a complete file into this object.  The contents of this object
	// are automatically cleared before the file is loaded, so the result
	// is a mirror image (in memory) of the bytes in the file.
        bool loadFile(const char *filename);
	bool saveFile(const char *filename);

	// Create a new file, or append to an existing file.
	bool appendFile(const char *filename);

	// Discards the last numBytes of data.
        void shorten(unsigned long numBytes);

	// The CkByteData will use *your* memory buffer, and will not delete
	// it when the object is destructed.  
	void borrowData(unsigned char *yourData, unsigned long numBytes);

	// Removes the data from the CkByteData object.  The caller will receive
	// a pointer to the memory buffer, and is responsible for deleting it.
	// (Example: 
	//	unsigned char *data = byteData.removeData();
	//	... do something with the data....
	//	delete [] data;
	unsigned char *removeData(void);


        const char *to_s(void);


	// END PUBLIC INTERFACE


    private:
	// Internal implementation.
	void *m_impl;
	bool m_utf8;	// If true, all input "const char *" parameters are utf-8, otherwise they are ANSI strings.
	CkString m_resultString;    // For to_s()

    public:
	// Used internally by Chilkat.
	void *getImpl(void) const;
	const void *getImplC(void) const;

};


#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -