惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Hacker News - Newest:
Hacker News - Newest: "LLM"
AI
AI
T
Troy Hunt's Blog
GbyAI
GbyAI
H
Hacker News: Front Page
SecWiki News
SecWiki News
V2EX - 技术
V2EX - 技术
A
About on SuperTechFans
人人都是产品经理
人人都是产品经理
Hacker News: Ask HN
Hacker News: Ask HN
S
Secure Thoughts
Last Week in AI
Last Week in AI
MyScale Blog
MyScale Blog
L
LINUX DO - 最新话题
C
CERT Recently Published Vulnerability Notes
C
Cyber Attacks, Cyber Crime and Cyber Security
O
OpenAI News
S
SegmentFault 最新的问题
Y
Y Combinator Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
The Cloudflare Blog
P
Proofpoint News Feed
Engineering at Meta
Engineering at Meta
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
美团技术团队
Google DeepMind News
Google DeepMind News
Simon Willison's Weblog
Simon Willison's Weblog
Know Your Adversary
Know Your Adversary
K
Kaspersky official blog
T
The Exploit Database - CXSecurity.com
S
Securelist
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
B
Blog RSS Feed
L
Lohrmann on Cybersecurity
Spread Privacy
Spread Privacy
博客园 - 司徒正美
Stack Overflow Blog
Stack Overflow Blog
博客园 - Franky
The GitHub Blog
The GitHub Blog
B
Blog
F
Fortinet All Blogs
I
InfoQ
C
Check Point Blog
Webroot Blog
Webroot Blog
博客园 - 叶小钗
P
Privacy International News Feed
Latest news
Latest news
Forbes - Security
Forbes - Security
博客园 - 三生石上(FineUI控件)
N
News | PayPal Newsroom

博客园 - 云水浮萍

结构体和类中属性定义需要static地方 十万个为什么收集 群里人问的消息切换分页问题,我就标记一下 AnsiString类型定义的时候可以直接指定代码页,比如950繁体字,936日文 CopyMemory Move使用笔记 System.Length 函数 Delphi Helper Record Class 向量定义笔记 关于日期与字符串转换时出错的分隔符,小记一下容易忘记 http://docwiki.embarcadero.com/RADStudio/XE7/en/Delphi_Data_Types Delphi中GUID相等检查中经典指针应用 test是否被执行? 每次看到某个数据结构的时候,有两个指针,一个起始,一个结束,一直没想明白为何是起始与结束,不是起始加数量,是怎么操作的? 给自己一个书单 pureMVC学习之一 泛型与无聊 队列与DelphiXe新语法 猫儿山之行计划书 一个错误,一个教训,关于堆栈平衡 - 云水浮萍 - 博客园
类型与泛型标记
云水浮萍 · 2015-03-28 · via 博客园 - 云水浮萍

uses System.TypInfo;

  // Sync with compiler internals
  TTypeKind = (tkUnknown, tkInteger, tkChar, tkEnumeration, tkFloat,
    tkString, tkSet, tkClass, tkMethod, tkWChar, tkLString, tkWString,
    tkVariant, tkArray, tkRecord, tkInterface, tkInt64, tkDynArray, tkUString,
    tkClassRef, tkPointer, tkProcedure {, tkMRecord});

type
{$IFDEF NEXTGEN}
  TSymbolName = Byte;
{$ELSE  NEXTGEN}
  TSymbolNameBase = string[255];
  TSymbolName = type TSymbolNameBase;
{$ENDIF NEXTGEN}

  TTypeInfoFieldAccessor = record
  strict private                   //静态?私有
    FData: PByte;
  public
    procedure SetData(const Data: PByte); inline;
    class operator Equal(const Left, Right: TTypeInfoFieldAccessor): Boolean; inline;
    function UTF8Length: integer; inline;
    function ToString: string;
{$IFNDEF NEXTGEN}
    function ToShortUTF8String: ShortString; inline;
{$ENDIF !NEXTGEN}
    function ToByteArray: TBytes;
    function Tail: PByte; inline;
  end;

-------------------TypeInfo (T)-------------------

  PTypeInfo = ^TTypeInfo;
  TTypeInfo = record
    Kind: TTypeKind;
    Name: TSymbolName;
    function NameFld: TTypeInfoFieldAccessor; inline;
   {TypeData: TTypeData}
    function TypeData: PTypeData; inline;
  end;

function TSampleClass<T>.GetDataName: string;
var
 Kind: TTypeKind;
begin
  Result := GetTypeName (TypeInfo (T));
  Kind := PTypeInfo(TypeInfo(T))^.Kind;
  case Kind of
    tkInteger: ShowMessage('I');
    tkFloat: ShowMessage('F');
    tkString,tkUString: ShowMessage('S');
    tkChar:   ShowMessage('C');
    tkClass:  ShowMessage('Class');
    else ShowMessage(Result);
  end;
end;