1 /** 2 This module provides D versions of xlf Excel functions 3 */ 4 module xlld.xlf; 5 6 import xlld.framework: excel12; 7 import xlld.xlcall: XLOPER12; 8 9 10 // should be pure but can't due to calling Excel12 11 int year(double date) @safe @nogc nothrow { 12 import xlld.xlcall: xlfYear; 13 return datePart(date, xlfYear); 14 } 15 16 // should be pure but can't due to calling Excel12 17 int month(double date) @safe @nogc nothrow { 18 import xlld.xlcall: xlfMonth; 19 return datePart(date, xlfMonth); 20 } 21 22 // should be pure but can't due to calling Excel12 23 int day(double date) @safe @nogc nothrow { 24 import xlld.xlcall: xlfDay; 25 return datePart(date, xlfDay); 26 } 27 28 // should be pure but can't due to calling Excel12 29 int hour(double date) @safe @nogc nothrow { 30 import xlld.xlcall: xlfHour; 31 return datePart(date, xlfHour); 32 } 33 34 // should be pure but can't due to calling Excel12 35 int minute(double date) @safe @nogc nothrow { 36 import xlld.xlcall: xlfMinute; 37 return datePart(date, xlfMinute); 38 } 39 40 // should be pure but can't due to calling Excel12 41 int second(double date) @safe @nogc nothrow { 42 import xlld.xlcall: xlfSecond; 43 return datePart(date, xlfSecond); 44 } 45 46 private int datePart(double date, int xlfn) @safe @nogc nothrow { 47 try 48 return cast(int)excel12!double(xlfn, date); 49 catch(Exception ex) 50 return 0; 51 } 52 53 54 double date(int year, int month, int day) @safe @nogc nothrow { 55 import xlld.xlcall: xlfDate; 56 try 57 return cast(int)excel12!double(xlfDate, year, month, day); 58 catch(Exception ex) 59 return 0; 60 } 61 62 double time(int year, int month, int day) @safe @nogc nothrow { 63 import xlld.xlcall: xlfTime; 64 try 65 return cast(int)excel12!double(xlfTime, year, month, day); 66 catch(Exception ex) 67 return 0; 68 } 69 70 int rtd(XLOPER12 comId, 71 XLOPER12 server, 72 XLOPER12 topic0 = XLOPER12(), 73 XLOPER12 topic1 = XLOPER12(), 74 XLOPER12 topic2 = XLOPER12(), 75 XLOPER12 topic3 = XLOPER12(), 76 XLOPER12 topic4 = XLOPER12(), 77 XLOPER12 topic5 = XLOPER12(), 78 XLOPER12 topic6 = XLOPER12(), 79 XLOPER12 topic7 = XLOPER12(), 80 XLOPER12 topic8 = XLOPER12(), 81 XLOPER12 topic9 = XLOPER12()) 82 { 83 import xlld.xlcall: xlfRtd; 84 import xlld.framework: Excel12f; 85 86 XLOPER12 result; 87 return Excel12f(xlfRtd, &result, comId, server, 88 topic0, topic1, topic2, topic3, topic4, topic5, topic6, topic7, topic8, topic9); 89 }