📄 flexutils.hpp
字号:
bool FFinished;
Classes::TStringList* FDictionary;
int FDicCapacity;
int FDicDeleteCount;
TFlexBinKeyStoreSet FKeyDontStore;
Classes::TStringList* FCmdKeys;
int FCmdKeyCount;
int FCmdKeysSize;
#pragma pack(push, 1)
TFlexBinHeader FCmdReadHeader;
#pragma pack(pop)
int FCmdReadDataSize;
void *FCmdReadUserData;
int FCmdReadUserDataSize;
bool FCmdReadDataAhead;
Classes::TStringList* FReadPropLines;
int FReadPropLine;
int FWritePropType;
AnsiString FWritePropName;
void *FWritePropData;
int FWritePropDataPos;
int FWritePropDataSize;
void __fastcall SetProcess(const TFlexFilerProcess Value);
void __fastcall SetDicCapacity(const int Value);
void __fastcall SetDicDeleteCount(const int Value);
AnsiString __fastcall GetReadKey(int Index);
int __fastcall GetPropertyDataSize(int PropType, const Variant &Value);
bool __fastcall AddKey(const AnsiString Key, int &KeyIndex);
int __fastcall AddWriteKey(const AnsiString Key, bool DontStore = false);
bool __fastcall ReadKey(void);
void __fastcall WriteKey(const AnsiString Key, int KeyIndex, bool DontStore = false);
void __fastcall ResetWriteKeys(void);
bool __fastcall ReadCommandHeaderAndKeys(TFlexBinHeader &Header);
bool __fastcall WriteCommandHeaderAndKeys(Word Command, int DataSize);
bool __fastcall ReadPropertyData(Variant &Value, int &PropType);
void * __fastcall AllocReadData(void);
void __fastcall ClearReadData(void);
void * __fastcall GrowWriteData(int Size);
void __fastcall ClearWriteData(void);
void __fastcall CheckDontStore(Word Command, bool &DontStoreKey1, bool &DontStoreKey2);
void __fastcall ReduceDictionary(int ACount);
public:
__fastcall TFlexBinaryData(TFlexFiler* AOwner);
__fastcall virtual ~TFlexBinaryData(void);
void __fastcall Reset(void);
bool __fastcall LoadStrCheck(/* out */ AnsiString &s);
void __fastcall SaveStr(const AnsiString s);
void __fastcall SaveStrBuf(void * Buf, int BufSize);
bool __fastcall ReadCommand(void);
int __fastcall ReadCommandData(/* out */ Variant &Value);
void * __fastcall ReadCommandUserData(void);
bool __fastcall WritePropertyCommand(const AnsiString PropName, int PropType, const Variant &Value, bool DontStoreValueKey = false);
void __fastcall WriteSimpleCommand(Word Command, int KeyCount = 0x0, const AnsiString Key1 = "", const AnsiString Key2 = "", bool DontStoreKey1 = false, bool DontStoreKey2 = false);
void __fastcall WriteDataCommand(Word Command, void *Data, int DataSize, int KeyCount = 0x0, const AnsiString Key1 = "", const AnsiString Key2 = "", bool DontStoreKey1 = false, bool DontStoreKey2 = false);
int __fastcall GetPropertyType(const Variant &PropValue);
__property TFlexFilerProcess Process = {read=FProcess, nodefault};
__property TFlexBinKeyStoreSet KeyDontStore = {read=FKeyDontStore, write=FKeyDontStore, nodefault};
__property bool Finished = {read=FFinished, nodefault};
__property int DicCapacity = {read=FDicCapacity, write=SetDicCapacity, nodefault};
__property int DicDeleteCount = {read=FDicDeleteCount, write=SetDicDeleteCount, nodefault};
__property Word ReadCmdCommand = {read=FCmdReadHeader.Command, nodefault};
__property int ReadCmdSize = {read=FCmdReadHeader.Size, nodefault};
__property int ReadCmdDataSize = {read=FCmdReadDataSize, nodefault};
__property Word ReadCmdKeyCount = {read=FCmdReadHeader.KeyCount, nodefault};
__property AnsiString ReadCmdKeys[int Index] = {read=GetReadKey};
__property int ReadCmdKeysSize = {read=FCmdKeysSize, nodefault};
};
class DELPHICLASS TIdPool;
class PASCALIMPLEMENTATION TIdPool : public System::TObject
{
typedef System::TObject inherited;
private:
Classes::TList* FPool;
bool __fastcall GetUsed(unsigned Value);
public:
__fastcall TIdPool(void);
__fastcall virtual ~TIdPool(void);
unsigned __fastcall Generate(void);
bool __fastcall Use(unsigned Value);
bool __fastcall Release(unsigned Value);
unsigned __fastcall NextUsed(unsigned Value, int &Index);
void __fastcall Clear(void);
__property bool Used[unsigned Value] = {read=GetUsed};
__property Classes::TList* PoolList = {read=FPool};
};
#pragma option push -b-
enum TNotifyLinkCode { ncInfo, ncDestroy, ncPropBeforeChanged, ncPropChanged, ncControlNotify };
#pragma option pop
struct TNotifyLinkInfo;
typedef TNotifyLinkInfo *PNotifyLinkInfo;
#pragma pack(push, 4)
struct TNotifyLinkInfo
{
TNotifyLinkCode Code;
union
{
struct
{
System::TObject* Control;
TFlexNotify ControlNotify;
};
struct
{
System::TObject* Prop;
};
struct
{
int WParam;
int LParam;
};
};
} ;
#pragma pack(pop)
class DELPHICLASS TNotifyLink;
typedef void __fastcall (__closure *TNotifyLinkEvent)(System::TObject* Sender, TNotifyLink* Source, const TNotifyLinkInfo &Info);
class PASCALIMPLEMENTATION TNotifyLink : public System::TObject
{
typedef System::TObject inherited;
public:
TNotifyLink* operator[](int Index) { return Links[Index]; }
private:
Classes::TList* FLinks;
System::TObject* FOwner;
int FTag;
bool FDestroying;
TNotifyLinkEvent FOnNotify;
TNotifyLinkEvent FOnFreeNotify;
TNotifyLink* __fastcall GetLink(int Index);
int __fastcall GetLinkCount(void);
int __fastcall GetLinkRefCount(int Index);
public:
__fastcall TNotifyLink(System::TObject* AOwner);
__fastcall virtual ~TNotifyLink(void);
int __fastcall IndexOf(TNotifyLink* Link);
int __fastcall Subscribe(TNotifyLink* Link);
int __fastcall Unsubscribe(TNotifyLink* Link);
int __fastcall Notify(const TNotifyLinkInfo &Info);
void __fastcall DestroyNotify(void);
int __fastcall PropNotify(System::TObject* AProp, bool IsBeforeNotify);
int __fastcall ControlNotify(System::TObject* AControl, TFlexNotify ANotify);
__property System::TObject* Owner = {read=FOwner};
__property int LinkCount = {read=GetLinkCount, nodefault};
__property TNotifyLink* Links[int Index] = {read=GetLink/*, default*/};
__property int LinksRefCount[int Index] = {read=GetLinkRefCount};
__property int Tag = {read=FTag, write=FTag, nodefault};
__property bool Destroying = {read=FDestroying, nodefault};
__property TNotifyLinkEvent OnNotify = {read=FOnNotify, write=FOnNotify};
__property TNotifyLinkEvent OnFreeNotify = {read=FOnFreeNotify, write=FOnFreeNotify};
};
typedef int __fastcall (__closure *TSortedListCompare)(void * Item1, void * Item2);
typedef void __fastcall (__closure *TGetLookupInfoEvent)(Classes::TPersistent* &Ancestor, Classes::TComponent* &Root, Classes::TComponent* &LookupRoot, Classes::TComponent* &RootAncestor);
//-- var, const, procedure ---------------------------------------------------
extern PACKAGE Word CF_FLEXDOC;
#define fcDocument "document"
#define fcClipboard "clipboard"
#define fcLibrary "library"
#define fcObject "object"
#define fcProperty "property"
#define fcEnd "end"
#define fcBinary "flexbinary"
extern PACKAGE AnsiString fcReserved[7];
#define IndentStep " "
extern PACKAGE AnsiString BooleanWords[2];
static const Shortint fbcUnknown = 0x0;
static const Shortint fbcDocument = 0x1;
static const Shortint fbcClipboard = 0x2;
static const Shortint fbcLibrary = 0x3;
static const Shortint fbcObject = 0x4;
static const Shortint fbcProperty = 0x5;
static const Shortint fbcComplexProperty = 0x6;
static const Shortint fbcEnd = 0x7;
static const Shortint fbcReduceDictionary = 0x8;
static const Shortint fbcBinaryEnd = 0x9;
static const Word fbcUser = 0x1000;
static const Shortint fbkIndexSizeMask = 0x3;
static const Shortint fbkIndexByte = 0x1;
static const Shortint fbkIndexWord = 0x2;
static const Shortint fbkIndexDWord = 0x3;
static const Shortint fbkIsIndex = 0x4;
static const Shortint fbkDontStore = 0x8;
static const Shortint fbpEmpty = 0x0;
static const Shortint fbpNull = 0x1;
static const Shortint fbpSmallint = 0x2;
static const Shortint fbpInteger = 0x3;
static const Shortint fbpSingle = 0x4;
static const Shortint fbpDouble = 0x5;
static const Shortint fbpCurrency = 0x6;
static const Shortint fbpDate = 0x7;
static const Shortint fbpBoolean = 0xb;
static const Shortint fbpShortInt = 0x10;
static const Shortint fbpByte = 0x11;
static const Shortint fbpWord = 0x12;
static const Shortint fbpLongWord = 0x13;
static const Shortint fbpInt64 = 0x14;
static const Word fbpString = 0x100;
static const Word fbpStrList = 0x200;
static const Word fbpHexData = 0x201;
static const Shortint crShapeCursor = 0x1;
static const Shortint crShapeAddCursor = 0x2;
static const Shortint crShapeDelCursor = 0x3;
static const Shortint crShapeCloseCursor = 0x4;
static const Shortint crShapeMoveCursor = 0x5;
static const Shortint crShapeMoveCurveCursor = 0x6;
static const Shortint crCreateControlCursor = 0x7;
static const Shortint crCreateRectCursor = 0x8;
static const Shortint crCreateEllipseCursor = 0x9;
static const Shortint crCreateTextCursor = 0xa;
static const Shortint crCreatePicCursor = 0xb;
static const Shortint crCreatePolyCursor = 0xc;
static const Shortint crZoomInCursor = 0xd;
static const Shortint crZoomOutCursor = 0xe;
static const Shortint crPanCursor = 0xf;
static const Shortint crPanningCursor = 0x10;
static const Shortint crShapeContinueCursor = 0x11;
static const Shortint crShapeMoveLineCursor = 0x12;
static const Shortint crLastFlexCursor = 0x31;
extern PACKAGE AnsiString FloatDisplayFormat;
static const Word PixelScaleFactor = 0x3e8;
extern PACKAGE bool SysGradientChecked;
extern PACKAGE bool SysGradientEnabled;
extern PACKAGE int SysGradientEllipticSteps;
extern PACKAGE void __fastcall LoadFlexCursors(void);
extern PACKAGE bool __fastcall StrBeginsFrom(const AnsiString S1, const AnsiString S2);
extern PACKAGE bool __fastcall FlexStrNeedQuote(const AnsiString s);
extern PACKAGE AnsiString __fastcall ExtractWord(const AnsiString s, int NumWord, char Delimiter);
extern PACKAGE Byte __fastcall HexCharsToByte(Word cw);
extern PACKAGE Word __fastcall ByteToHexChars(Byte b);
extern PACKAGE int __fastcall RectWidth(const Types::TRect &ARect);
extern PACKAGE int __fastcall RectHeight(const Types::TRect &ARect);
extern PACKAGE void __fastcall GetPicReadWrite(Graphics::TPicture* Picture, /* out */ Classes::TStreamProc &ReadProc, /* out */ Classes::TStreamProc &WriteProc);
extern PACKAGE Types::TRect __fastcall NormalizeRect(const Types::TRect &R);
extern PACKAGE bool __fastcall PointInRect(const Types::TPoint &p, const Types::TRect &R);
extern PACKAGE HRGN __fastcall IntersectClipRgn(Graphics::TCanvas* ACanvas, HRGN ClipRgn);
extern PACKAGE HRGN __fastcall IntersectClipPath(HDC DC);
extern PACKAGE void __fastcall PaintGradient(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, TGradientStyle Style, Graphics::TColor Color, Graphics::TColor EndColor, Graphics::TPenMode PenMode);
extern PACKAGE HRGN __fastcall CreateTransparentClipRgn(HDC DC, int Width, int Height, Types::TRect &Dest, Graphics::TColor TransparentColor);
extern PACKAGE void __fastcall ExcludeBitmapTransparency(Graphics::TBitmap* Bmp, Types::TRect &R, HRGN &ClipRgn);
extern PACKAGE void __fastcall PaintTailed(Graphics::TCanvas* ACanvas, const Types::TRect &PaintRect, const Types::TRect &RefreshRect, Graphics::TBitmap* ABitmap, PTiledBitmapCache BitmapCache = (void *)(0x0));
extern PACKAGE void __fastcall PaintBitmap(Graphics::TCanvas* ACanvas, const Types::TRect &PaintRect, const Types::TRect &RefreshRect, Graphics::TBitmap* ABitmap, TBitmapDisplay BitmapDisplay, PTiledBitmapCache BitmapCache = (void *)(0x0), int Scale = 0x64, bool ClipTransparent = false);
extern PACKAGE int __fastcall ScaleValue(int Value, int Scale);
extern PACKAGE int __fastcall UnScaleValue(int Value, int Scale);
extern PACKAGE int __fastcall ScalePixels(int Value);
extern PACKAGE int __fastcall UnScalePixels(int Value);
extern PACKAGE int __fastcall ListScan(void * Value, void * List, int Count);
extern PACKAGE int __fastcall ListScanEx(void * Value, void * List, int Index, int Count);
extern PACKAGE int __fastcall ListScanLess(void * Value, void * List, int Count);
extern PACKAGE int __fastcall SortedListFind(Classes::PPointerList List, int Count, void * Item, TSortedListCompare Compare, bool Exact);
extern PACKAGE int __fastcall ListSortItem(Classes::PPointerList List, int Count, int ItemIndex, TSortedListCompare Compare);
extern PACKAGE void __fastcall ListQuickSort(Classes::PPointerList List, int L, int R, TSortedListCompare Compare);
extern PACKAGE bool __fastcall IsClassParent(TMetaClass* AClass, TMetaClass* AParentClass);
extern PACKAGE AnsiString __fastcall DotFloatToStr(const Extended Value);
extern PACKAGE Extended __fastcall DotStrToFloat(AnsiString Value);
extern PACKAGE bool __fastcall AncestorIsValid(Classes::TPersistent* Ancestor, Classes::TComponent* Root, Classes::TComponent* RootAncestor);
extern PACKAGE bool __fastcall IsDefaultPropertyValue(System::TObject* Instance, Typinfo::PPropInfo PropInfo, TGetLookupInfoEvent OnGetLookupInfo);
} /* namespace Flexutils */
using namespace Flexutils;
#pragma option pop // -w-
#pragma option pop // -Vx
#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif // FlexUtils
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -