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

📄 secparamed.hpp

📁 SecurityLib一个user-rights系统控件
💻 HPP
字号:
#ifndef _SecurityParamEditorInt_HPP
#define _SecurityParamEditorInt_HPP

// if it's SecurityLib dll
#if defined (__DLL__) && defined(SECURITYADM_DLL)
#	define _DLL_EXP __export
#else
#	define _DLL_EXP __import
#endif

#include <s.h>
#include "Rights.h"


namespace Security {

class TSecuritySmpDlgBaseFrm;
class TSecurityDlgBaseFrm;

class _DLL_EXP TSecParamEd;
class _DLL_EXP TSecSmpParamEd;
typedef bool (__stdcall *SecItrFnc  )(const TSecSmpParamEd &co, const char *name);

struct TSecFncNames {
	smallstr255 Ins;
	smallstr255 Ren;
	smallstr255 Show;
	smallstr255 Itr;
	smallstr255 KeyFnc;
	PswdString  Key;

};

class _DLL_EXP TSecSmpParamEd {
	public:
		enum Reasons { None, Iteration, ShowDlg, Insert, Rename };

		Reasons Reason;

		/* it is not guarateed, that all fields will be filled.
		 only these meaningful for reason:
			- iterat  : paramid, paramtypeid, name, paramtypename, fnc, Data, paramkey amd paramtypekey
			- showdlg : all except newname and fnc
			- insert  : all except newname, value, paramid, userkey, userparamkey and fnc
			- rename  : paramid, paramtypeid, name, newname, paramtypename , paramkey amd paramtypekey

		*/

		int ParamTypeID;
		int ParamID;

		int ParamKey;
		int UserKey;
		int UserParamKey;
		int ParamTypeKey;

		const char *Name;

		union {
			const char *NewName;
			const char *Value;
			void *Data;          // data for itr fnc
		};

		const char *ParamTypeName;
		const char *FullName;
		const char *Default;

		const char *Desc;    // description


		bool UserCanModify;
		bool Hidden;
		bool Protected;

		SecItrFnc Fnc;
		HWND App;

		TSecRights Rights;

	private:
		bool del;  // delete in desctructor ?

	protected:
		TSecuritySmpDlgBaseFrm *s;

		//mutable SecString key;
		void DoBasicFill(byte count = 2);

	public:
		TSecuritySmpDlgBaseFrm *Sec() const { return s; }

		// None
		__fastcall TSecSmpParamEd(TSecuritySmpDlgBaseFrm *co) ;

		// rename
		__fastcall TSecSmpParamEd(TSecuritySmpDlgBaseFrm *co, const char *newname) ;

		// iteration
		__fastcall TSecSmpParamEd(TSecuritySmpDlgBaseFrm *co, SecItrFnc fnc, void *data = NULL) ;

		// ShowDlg
		__fastcall TSecSmpParamEd(TSecuritySmpDlgBaseFrm *co, const char *fname, const char *val, const char *desc, const char *def, bool hid,bool canm, bool ac, HWND app) ;

		// Insert
		__fastcall TSecSmpParamEd(TSecuritySmpDlgBaseFrm *co, int ptypeid, const char *ptypename, const char *name, const char *fname, const char *desc, const char *def, bool hid, bool canm, bool ac, HWND app) ;


		__fastcall TSecSmpParamEd(const TSecSmpParamEd &co);

	#ifdef DbHPP
		// none
		__fastcall TSecSmpParamEd(TSecuritySmpDlgBaseFrm *co, TDataSet *d, Reasons reas, HWND app );
		// showdlg
		__fastcall TSecSmpParamEd(TSecuritySmpDlgBaseFrm *co, TDataSet *d, const char *value, HWND app );
	#endif

		__fastcall ~TSecSmpParamEd();

/*		void SetKey(SecString k) const { key = k; }*/


		SecString  __fastcall GetParam    (const char *name) const;
		PswdString __fastcall GetPswdParam(const char *name) const;
		bool       __fastcall GetBoolParam(const char *name) const;
		int        __fastcall GetIntParam (const char *name) const;

		bool __fastcall GetBoolDBParam(const char *name)  const;
		SecString __fastcall GetDBParam(const char *name) const;


		void   __fastcall SetParam    (const char *name,const char *val) const;
		void   __fastcall SetPswdParam(const char *name,const PswdString &val) const;
		void   __fastcall SetBoolParam(const char *name,bool) const;
		void   __fastcall SetIntParam (const char *name,int) const;

		void __fastcall SetDBParam(const char *name, const char *val);
		void __fastcall SetBoolDBParam(const char *name, bool val);
		void __fastcall SetPswdDBParam(const char *name, const PswdString &val);

		SecRightsMask __fastcall GetRight(const char *name) const;
		void   __fastcall SetRight(const char *name, SecRightsMask val) const;

		//    //

		SecString  __fastcall GetSubParam(const char *co) const;
		PswdString __fastcall GetPswdSubParam(const char *co) const;
		bool __fastcall GetBoolSubParam(const char *co) const;

		void __fastcall SetSubParam(const char *co,const char *val) const;
		void __fastcall SetPswdSubParam(const char *co,const PswdString &val) const;
		void __fastcall SetBoolSubParam(const char *co,bool val) const;


		SecRightsMask __fastcall GetSubRight(const char *name) const;
		void __fastcall SetSubRight(const char *name, SecRightsMask val) const ;

		bool __fastcall DefSubParam(const char *co) const;
		bool __fastcall DefParam(const char *co) const;

};

class _DLL_EXP TSecParamEd : public TSecSmpParamEd {
	public:
		TSecurityDlgBaseFrm *Sec() const { return (TSecurityDlgBaseFrm *)s; }

	public:

		// None
		__fastcall TSecParamEd(TSecurityDlgBaseFrm *co) ;

		// rename
		__fastcall TSecParamEd(TSecurityDlgBaseFrm *co, const char *newname) ;

		// iteration
		__fastcall TSecParamEd(TSecurityDlgBaseFrm *co, SecItrFnc fnc, void *data = NULL) ;

		// ShowDlg
		__fastcall TSecParamEd(TSecurityDlgBaseFrm *co, const char *fname, const char *val, const char *desc, const char *def, bool hid,bool canm, bool ac, HWND app) ;

		// Insert
		__fastcall TSecParamEd(TSecurityDlgBaseFrm *co, int ptypeid, const char *ptypename, const char *name, const char *fname, const char *desc, const char *def, bool hid, bool canm, bool ac, HWND app) ;


		__fastcall TSecParamEd(const TSecParamEd &co);

	#ifdef DbHPP
		// none
		__fastcall TSecParamEd(TSecurityDlgBaseFrm *co, TDataSet *d, Reasons reas, HWND app );
		// showdlg
		__fastcall TSecParamEd(TSecurityDlgBaseFrm *co, TDataSet *d, const char *value, HWND app );
	#endif

		bool __fastcall InsParam(const char *name,const char *fullname, const char *type,const char *defval, bool hidden, bool usercanmodify, bool Protected, const char *memo ) const;
		bool __fastcall DelParam(const char *name) const;
		bool __fastcall RenParam(const char *name, const char *newname) const;

		bool __fastcall ShowParam(const char *name) const; // shows param's dialog

		bool __fastcall DelSubParam(const char *co) const;
		bool __fastcall RenSubParam(const char *co, const char *val) const;
		bool __fastcall InsSubParam(const char *name, const char *fullname, const char *type, const char *defval, const char *memo) const;  // appends name to co->Name
		// make copy of TSecpareditorint, change some of it's properties, and then call above function
};


} // namespace Security

#undef _DLL_EXP

using namespace Security;
#endif

⌨️ 快捷键说明

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