1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314
|
//------------------------------------------------------------------------------
// <auto-generated />
//
// This file was automatically generated by SWIG (http://www.swig.org).
// Version 3.0.12
//
// Do not make changes to this file unless you know what you are doing--modify
// the SWIG interface file instead.
//------------------------------------------------------------------------------
namespace QuantLib {
public class Date : global::System.IDisposable {
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
protected bool swigCMemOwn;
internal Date(global::System.IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Date obj) {
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
~Date() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
NQuantLibcPINVOKE.delete_Date(swigCPtr);
}
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
global::System.GC.SuppressFinalize(this);
}
}
public static Date operator+(Date d, int i) {
return new Date(d.serialNumber() + i);
}
public static Date operator-(Date d, int i) {
return new Date(d.serialNumber() - i);
}
public static bool operator==(Date d1, Date d2) {
object o1 = (object)d1;
object o2 = (object)d2;
if (o1 == null && o2 == null)
return true;
if (o1 == null || o2 == null)
return false;
return d1.serialNumber() == d2.serialNumber();
}
public static bool operator!=(Date d1, Date d2) {
object o1 = (object)d1;
object o2 = (object)d2;
if (o1 == null && o2 == null)
return false;
if (o1 == null || o2 == null)
return true;
return d1.serialNumber() != d2.serialNumber();
}
public static bool operator>(Date d1, Date d2) {
object o1 = (object)d1;
object o2 = (object)d2;
if (o1 == null || o2 == null)
return false;
return d1.serialNumber() > d2.serialNumber();
}
public static bool operator<(Date d1, Date d2) {
object o1 = (object)d1;
object o2 = (object)d2;
if (o1 == null || o2 == null)
return false;
return d1.serialNumber() < d2.serialNumber();
}
public override bool Equals(object o)
{
try
{
Date d = (Date)o;
return this.serialNumber() == d.serialNumber();
}
catch
{
return false;
}
}
public override int GetHashCode()
{
return this.serialNumber();
}
public Date() : this(NQuantLibcPINVOKE.new_Date__SWIG_0(), true) {
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
}
public Date(int d, Month m, int y) : this(NQuantLibcPINVOKE.new_Date__SWIG_1(d, (int)m, y), true) {
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
}
public Date(int d, Month m, int y, int hours, int minutes, int seconds, int millisec, int microsec) : this(NQuantLibcPINVOKE.new_Date__SWIG_2(d, (int)m, y, hours, minutes, seconds, millisec, microsec), true) {
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
}
public Date(int d, Month m, int y, int hours, int minutes, int seconds, int millisec) : this(NQuantLibcPINVOKE.new_Date__SWIG_3(d, (int)m, y, hours, minutes, seconds, millisec), true) {
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
}
public Date(int d, Month m, int y, int hours, int minutes, int seconds) : this(NQuantLibcPINVOKE.new_Date__SWIG_4(d, (int)m, y, hours, minutes, seconds), true) {
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
}
public Date(int serialNumber) : this(NQuantLibcPINVOKE.new_Date__SWIG_5(serialNumber), true) {
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
}
public Weekday weekday() {
Weekday ret = (Weekday)NQuantLibcPINVOKE.Date_weekday(swigCPtr);
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public int dayOfMonth() {
int ret = NQuantLibcPINVOKE.Date_dayOfMonth(swigCPtr);
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public int dayOfYear() {
int ret = NQuantLibcPINVOKE.Date_dayOfYear(swigCPtr);
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public Month month() {
Month ret = (Month)NQuantLibcPINVOKE.Date_month(swigCPtr);
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public int year() {
int ret = NQuantLibcPINVOKE.Date_year(swigCPtr);
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public int hours() {
int ret = NQuantLibcPINVOKE.Date_hours(swigCPtr);
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public int minutes() {
int ret = NQuantLibcPINVOKE.Date_minutes(swigCPtr);
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public int seconds() {
int ret = NQuantLibcPINVOKE.Date_seconds(swigCPtr);
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public int milliseconds() {
int ret = NQuantLibcPINVOKE.Date_milliseconds(swigCPtr);
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public int microseconds() {
int ret = NQuantLibcPINVOKE.Date_microseconds(swigCPtr);
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public double fractionOfDay() {
double ret = NQuantLibcPINVOKE.Date_fractionOfDay(swigCPtr);
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public double fractionOfSecond() {
double ret = NQuantLibcPINVOKE.Date_fractionOfSecond(swigCPtr);
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public int serialNumber() {
int ret = NQuantLibcPINVOKE.Date_serialNumber(swigCPtr);
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public static bool isLeap(int y) {
bool ret = NQuantLibcPINVOKE.Date_isLeap(y);
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public static Date minDate() {
Date ret = new Date(NQuantLibcPINVOKE.Date_minDate(), true);
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public static Date maxDate() {
Date ret = new Date(NQuantLibcPINVOKE.Date_maxDate(), true);
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public static Date todaysDate() {
Date ret = new Date(NQuantLibcPINVOKE.Date_todaysDate(), true);
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public static Date localDateTime() {
Date ret = new Date(NQuantLibcPINVOKE.Date_localDateTime(), true);
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public static Date universalDateTime() {
Date ret = new Date(NQuantLibcPINVOKE.Date_universalDateTime(), true);
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public static Date endOfMonth(Date arg0) {
Date ret = new Date(NQuantLibcPINVOKE.Date_endOfMonth(Date.getCPtr(arg0)), true);
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public static bool isEndOfMonth(Date arg0) {
bool ret = NQuantLibcPINVOKE.Date_isEndOfMonth(Date.getCPtr(arg0));
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public static Date nextWeekday(Date arg0, Weekday arg1) {
Date ret = new Date(NQuantLibcPINVOKE.Date_nextWeekday(Date.getCPtr(arg0), (int)arg1), true);
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public static Date nthWeekday(uint n, Weekday arg1, Month m, int y) {
Date ret = new Date(NQuantLibcPINVOKE.Date_nthWeekday(n, (int)arg1, (int)m, y), true);
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public Date Add(int days) {
Date ret = new Date(NQuantLibcPINVOKE.Date_Add__SWIG_0(swigCPtr, days), true);
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public Date Subtract(int days) {
Date ret = new Date(NQuantLibcPINVOKE.Date_Subtract__SWIG_0(swigCPtr, days), true);
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public Date Add(Period arg0) {
Date ret = new Date(NQuantLibcPINVOKE.Date_Add__SWIG_1(swigCPtr, Period.getCPtr(arg0)), true);
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public Date Subtract(Period arg0) {
Date ret = new Date(NQuantLibcPINVOKE.Date_Subtract__SWIG_1(swigCPtr, Period.getCPtr(arg0)), true);
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public Date(string str, string fmt) : this(NQuantLibcPINVOKE.new_Date__SWIG_6(str, fmt), true) {
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
}
public int weekdayNumber() {
int ret = NQuantLibcPINVOKE.Date_weekdayNumber(swigCPtr);
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public string __str__() {
string ret = NQuantLibcPINVOKE.Date___str__(swigCPtr);
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public string __repr__() {
string ret = NQuantLibcPINVOKE.Date___repr__(swigCPtr);
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public string ISO() {
string ret = NQuantLibcPINVOKE.Date_ISO(swigCPtr);
if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
}
}
|