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

📄 ckxml.h

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

#ifndef _CKXML_H
#define _CKXML_H

#pragma once

class CkByteData;
class CkCert;
#include "CkString.h"

#include "CkObject.h"

/*
    IMPORTANT: Objects returned by methods as non-const pointers must be deleted
    by the calling application. 

  */


// CLASS: CkXml
class CkXml : public CkObject
{
    private:
	void *m_impl;
	bool m_utf8;	// If true, all input "const char *" parameters are utf-8, otherwise they are ANSI strings.

	// Don't allow assignment or copying these objects.
	CkXml(const CkXml &) { } 
	CkXml &operator=(const CkXml &) { return *this; }
	CkXml(void *impl) : m_impl(impl) { }

    public:
	void *getImpl(void) const { return m_impl; } 

	CkXml();
	virtual ~CkXml();

	bool SetBinaryContent(const char *data, unsigned long dataLen,bool zipFlag, bool encryptFlag, const char *password);

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

        CkXml *HttpGet(const char *url);
        CkXml *HttpPost(const char *url);

	bool SetBinaryContent(const unsigned char *data, unsigned long dataLen,bool zipFlag, bool encryptFlag, const char *password);
	bool SetBinaryContent(const CkByteData &data, bool zipFlag, bool encryptFlag, const char *password);

	bool GetBinaryContent(CkByteData &data, bool unzipFlag, bool decryptFlag, const char *password);

	bool ZipTree();
	bool ZipContent();
	bool UnzipTree();
	bool UnzipContent();

	bool EncryptContent(const char *password);
	bool DecryptContent(const char *password);

	void GetRoot2(void);

	CkXml *GetRoot(void);
	CkXml *GetChildWithTag(const char *tag);
	CkXml *GetChildWithContent(const char *content);
	CkXml *GetChildExact(const char *tag, const char *content);

	long get_TreeId(void);
	CkXml *PreviousSibling(void);
	CkXml *NextSibling(void);
	bool PreviousSibling2(void);
	bool NextSibling2(void);
	CkXml *LastChild(void);
	CkXml *FirstChild(void);
	bool Clear();
	void Copy(CkXml *node);
	CkXml *GetParent(void);
	bool GetParent2(void);
	bool FirstChild2(void);
	bool LastChild2(void);

	CkXml *SearchForAttribute(const CkXml *after, const char *tag, const char *attr, const char *valuePattern);
	CkXml *SearchAllForContent(const CkXml *after, const char *contentPattern);
	CkXml *SearchForContent(const CkXml *after, const char *tag, const char *contentPattern);
	CkXml *SearchForTag(const CkXml *after, const char *tag);

	bool SearchForAttribute2(const CkXml *after, const char *tag, const char *attr, const char *valuePattern);
	bool SearchAllForContent2(const CkXml *after, const char *contentPattern);
	bool SearchForContent2(const CkXml *after, const char *tag, const char *contentPattern);
	bool SearchForTag2(const CkXml *after, const char *tag);
	bool GetNthChildWithTag2(const char *tag, long n);


	CkXml *SearchForAttribute(const CkXml &after, const char *tag, const char *attr, const char *valuePattern)
	    { return SearchForAttribute(&after,tag,attr,valuePattern); }
	CkXml *SearchAllForContent(const CkXml &after, const char *contentPattern)
	    { return SearchAllForContent(&after,contentPattern); }
	CkXml *SearchForContent(const CkXml &after, const char *tag, const char *contentPattern)
	    { return SearchForContent(&after,tag,contentPattern); }
	CkXml *SearchForTag(const CkXml &after, const char *tag)
	    { return SearchForTag(&after,tag); }

	bool SearchForAttribute2(const CkXml &after, const char *tag, const char *attr, const char *valuePattern)
	    { return SearchForAttribute2(&after,tag,attr,valuePattern); }
	bool SearchAllForContent2(const CkXml &after, const char *contentPattern)
	    { return SearchAllForContent2(&after,contentPattern); }
	bool SearchForContent2(const CkXml &after, const char *tag, const char *contentPattern)
	    { return SearchForContent2(&after,tag,contentPattern); }
	bool SearchForTag2(const CkXml &after, const char *tag)
	    { return SearchForTag2(&after,tag); }


	CkXml *FindChild(const char *tag);
	CkXml *FindOrAddNewChild(const char *tag);
	CkXml *NewChildBefore(int index, const char *tag, const char *content);
	CkXml *NewChildAfter(int index, const char *tag, const char *content);
	CkXml *NewChild(const char *tag, const char *content);
	void NewChild2(const char *tag, const char *content);
	void NewChildInt2(const char *tag, int value);
	CkXml *GetNthChildWithTag(const char *tag, long n);
	long NumChildrenHavingTag(const char *tag);
	CkXml *ExtractChildByName(const char *tag, const char *attrName, const char *attrValue);

	CkXml *ExtractChildByIndex(long index);
	void RemoveFromTree(void);
	CkXml *GetChild(long index);
	bool GetChild2(long index);
	bool AddChildTree(const CkXml *tree);
	bool SwapTree(const CkXml *tree);
	bool SwapNode(const CkXml *node);

	bool AddChildTree(const CkXml &tree) { return AddChildTree(&tree); }

	bool InsertChildTreeAfter(int index, const CkXml &tree);
	bool InsertChildTreeBefore(int index, const CkXml &tree);

	bool SwapTree(const CkXml &tree) { return SwapTree(&tree); }
	bool SwapNode(const CkXml &node) { return SwapNode(&node); }

	bool HasAttrWithValue(const char *name, const char *value);

	bool GetAttrValue(const char *name, CkString &str);
	bool GetAttributeValue(long index, CkString &str);
	bool GetAttributeName(long index, CkString &str);

	bool RemoveAllAttributes();

	void RemoveChild(const char *tag);

	bool RemoveAttribute(const char *name);
	bool AddAttribute(const char *name, const char *value);
	bool AppendToContent(const char *str);

	bool GetXml(CkString &str);

	bool SaveXml(const char *fileName);
	bool LoadXmlFile(const char *fileName);
	bool LoadXml(const char *xmlData);
	bool LoadXmlFile2(const char *fileName, bool autoTrim);
	bool LoadXml2(const char *xmlData, bool autoTrim);

	const char *get_Version(void) const;
	bool get_Version(CkString &str);

	bool get_Cdata();
	bool put_Cdata(bool newVal);

	bool get_SortCaseInsensitive();
	void put_SortCaseInsensitive(bool newVal);

	long get_NumChildren();

	bool get_Content(CkString &str);
	bool put_Content(const char *newVal);

	bool GetChildContent(const char *tag, CkString &str);

	// Replace the content of the child having a specific tag,
	// or if it doesn't already exist, create a new child having the tag/value.
	void UpdateChildContent(const char *tag, const char *value);

	// Return true if the node's content matches the wildcarded pattern.
	// A '*' matches 0 or more of any character, a '?' matches any one character.
	bool ContentMatches(const char *pattern, bool caseSensitive);

	// Same as ContentMatches, but matches the content of the child having a specific tag.
	bool ChildContentMatches(const char *tag, const char *pattern, bool caseSensitive);

	bool get_Tag(CkString &str);
	bool put_Tag(const char *newVal);

	long get_NumAttributes();

	bool get_Standalone(CkString &str);  // yes or no
	bool put_Standalone(const char *newVal);

	bool get_Encoding(CkString &str);  // such as iso-8859-1
	bool put_Encoding(const char *newVal);

	// Error log retrieval and saving (these methods are common to all Chilkat VC++ classes.)
	bool SaveLastError(const char *filename);
        void LastErrorXml(CkString &str);
        void LastErrorHtml(CkString &str);
        void LastErrorText(CkString &str);

	bool QEncodeContent(const char *charset, const CkByteData &db);
	bool BEncodeContent(const char *charset, const CkByteData &db);
	bool DecodeContent(CkByteData &db);

	bool UpdateAttribute(const char *attrName, const char *attrValue);

	bool GetChildIntValue(const char *tag, int &value);

	void SortByTag(long ascending);
	void SortByContent(long ascending);
	void SortByAttribute(const char *attrName, long ascending);

	void SortRecordsByContent(const char *sortTag, long ascending);
	void SortRecordsByAttribute(const char *sortTag, const char *attrName, long ascending);
	CkXml *FindNextRecord(const char *tag, const char *contentPattern);

	bool HasChildWithTag(const char *tag);



	void RemoveChildWithContent(const char *content);
	bool HasChildWithTagAndContent(const char *tag, const char *content);
	bool HasChildWithContent(const char *content);
	void RemoveAllChildren(void);
	void RemoveChildByIndex(long index);
	void AccumulateTagContent(const char *tag, const char *skipTags, CkString &str);
	bool GetChildContentByIndex(long index, CkString &str);
	bool GetChildTag(long index, CkString &str);
	void AddToAttribute(const char *name, long amount);
	void AddToContent(long amount);
	void AddToChildContent(const char *tag, long amount);
	void AddOrUpdateAttributeI(const char *name, long value);
	void AddOrUpdateAttribute(const char *name, const char *value);
	bool HasAttribute(const char *name);

	CkString m_resultString;
	const char *tag(void);
	const char *content(void);
	const char *encoding(void);
	const char *getXml(void);
        const char *lastErrorText(void);
        const char *lastErrorXml(void);
        const char *lastErrorHtml(void);
	const char *getChildContent(const char *tag);
	const char *getAttrValue(const char *name);
	const char *getAttributeValue(long index);
	const char *getAttributeName(long index);
	const char *version(void);
	const char *standalone(void);  // yes or no
	const char *accumulateTagContent(const char *tag, const char *skipTags);
	const char *getChildContentByIndex(long index);
	const char *getChildTag(long index);

	const char *childContent(const char *tag)
	    { return getChildContent(tag); }
	const char *attr(const char *name)
	    { return getAttrValue(name); }
	const char *attrValue(long index)
	    { return getAttributeValue(index); }
	const char *attrName(long index)
	    { return getAttributeName(index); }
	const char *xml(void)
	    { return getXml(); }

	// END PUBLIC INTERFACE



};


#endif


⌨️ 快捷键说明

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