上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 215 下一页
摘要: TMarshaller(结构) 基于 TMarshal(是有一大堆的 class 方法组成的类) 实现.TMarshaller 可以对缓存区进行自动(自动释放)安全地管理, TMarshal 也有前者没有的重要方法, 譬如: TMarshal.Copy() 方法.有了它们, 以后关于内存缓冲区, 字符串转码等操作就更方便了.{测试}procedure TForm1.FormCreate(Sender: TObject);var M: TMarshaller; pw: TPtrWrapper; str: string; bs: TBytes;begin bs := BytesOf('万. 阅读全文
posted @ 2013-06-10 18:27 万一 阅读(2344) 评论(0) 推荐(0) 编辑
摘要: TMemoryStream 的 Position 变化后, 我曾经认为它的 Memory 属性也会变化; 只怪不看源码, 只想当然!procedure TForm1.FormCreate(Sender: TObject);var Stream1,Stream2: TMemoryStream; pw: TPtrWrapper;begin Stream1 := TStringStream.Create('1234567890'); Stream2 := TStringStream.Create('ABCDEFGHIJ'); //想把 Stream1 变成 123DE 阅读全文
posted @ 2013-06-10 12:38 万一 阅读(3845) 评论(1) 推荐(0) 编辑
摘要: 不知什么时候 System 单元有了 TPtrWrapper 结构体, 它提供了非常小的一点功能: 指针(Pointer)与指针地址(NativeInt)的转换.很显然, 以前常用的 Integer(P) 或 Ptr(Number) 已经不适用与 64 位了, 这时使用 TPtrWrapper 应该是更方便,更保险的选择.发现在 Delphi 新的源码中, 几乎就把 TPtrWrapper 当做指针来使用了.{TPtrWrapper 全功能测试}procedure TForm1.FormCreate(Sender: TObject);var num: Integer; p: Pointer.. 阅读全文
posted @ 2013-06-10 12:14 万一 阅读(1724) 评论(3) 推荐(0) 编辑
摘要: 适宽查看 ASP/VBScript CakePHP-1.2 CSS-v1 CSS-v2 French Kings and Queens Linux Command Line NaNoWriMo 2011 Six Noations 2012 Vimeo Advanced API Methods Wikipedia HTML Character Entities HTML JavaScript Microformats Mod Rewrite-v1... 阅读全文
posted @ 2012-03-26 17:02 万一 阅读(4026) 评论(4) 推荐(1) 编辑
摘要: MyClass = function () { this.A = 1;}MyClass.prototype.X = function () { this.B = 2;}MyClass.prototype.Y = function () { this.Z = function () { this.C = 3; }}/* 内部对象的 this ? */obj = new MyClass();alert(obj.A); //1obj1 = new obj.X();alert(obj1.B); //2obj2 = new (new obj... 阅读全文
posted @ 2012-03-19 16:17 万一 阅读(1984) 评论(2) 推荐(0) 编辑
摘要: MyClass = function () { var A = 1; //内部成员 B = 2; //内部成员 this.C = 3; //对象成员}MyClass.prototype.D = 4; //对象成员(通过原型扩展)obj = new MyClass();alert(obj.A); //undefinedalert(obj.B); //undefinedalert(obj.C); //3alert(obj.D); //4alert(obj.hasOwnProperty('C')); //trueal... 阅读全文
posted @ 2012-03-19 13:48 万一 阅读(1548) 评论(3) 推荐(0) 编辑
摘要: /* 类属性、对象属性 */Array.Info1 = "Info1"; //为 Array 增加类属性 Info1Array.prototype.Info2 = "Info2"; //为 Array 增加对象属性 Info2arr = [1, 2, 3];alert(arr.Info1); //undefinedalert(arr.Info2); //Info2alert(Array.Info1); //Info1/* 类方法、对象方法 */Array.ShowMessage = function () { alert("ClassMessa 阅读全文
posted @ 2012-03-19 12:10 万一 阅读(1617) 评论(0) 推荐(0) 编辑
摘要: /* 值类型 */n1 = 123;n2 = n1; //赋值n2 = 456;alert(n1); //123; n1 != n2/* 对象类型 */arr1 = [123];arr2 = arr1; //引用arr2[0] = 456;alert(arr1[0]); //456; arr1 === arr2 阅读全文
posted @ 2012-03-19 10:02 万一 阅读(1589) 评论(2) 推荐(0) 编辑
摘要: /* 函数的定义 */function a() { return 1; }var b = function () { return 1; };var c = function d() { return 1; }; // d === undefinedvar e = new Function("return 1;");alert(typeof a); //functionalert(typeof b); //functionalert(typeof c); //functionalert(typeof d); //undefinedalert(typeof e); //fun 阅读全文
posted @ 2012-03-15 18:13 万一 阅读(1380) 评论(3) 推荐(0) 编辑
摘要: /* 给一个实例化后的空对象添加属性、方法 */obj = {};obj.Name = "张三";obj.Age = 33;obj.ShowInfo = function () { alert(obj.Name + ", " + obj.Age); }obj.ShowInfo(); //张三, 33/* 用函数建立并返回对象 */function GetObj(name, age) { return { Name: name, Age: age, ShowInfo: function () { alert(this.Name + ", &quo 阅读全文
posted @ 2012-03-15 17:21 万一 阅读(1291) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 215 下一页