author | truebrain |
Mon, 07 Apr 2008 14:00:52 +0000 | |
branch | noai |
changeset 9874 | 4ecef0dadf01 |
parent 9825 | cc77111ebd85 |
child 10212 | 1e0a2a182253 |
permissions | -rw-r--r-- |
9825
cc77111ebd85
(svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff
changeset
|
1 |
#include "ai_date.hpp" |
cc77111ebd85
(svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff
changeset
|
2 |
|
cc77111ebd85
(svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff
changeset
|
3 |
namespace SQConvert { |
cc77111ebd85
(svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff
changeset
|
4 |
/* Allow AIDate to be used as Squirrel parameter */ |
cc77111ebd85
(svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff
changeset
|
5 |
template <> AIDate *GetParam(ForceType<AIDate *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIDate *)instance; } |
cc77111ebd85
(svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff
changeset
|
6 |
template <> AIDate &GetParam(ForceType<AIDate &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIDate *)instance; } |
cc77111ebd85
(svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff
changeset
|
7 |
template <> const AIDate *GetParam(ForceType<const AIDate *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIDate *)instance; } |
cc77111ebd85
(svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff
changeset
|
8 |
template <> const AIDate &GetParam(ForceType<const AIDate &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIDate *)instance; } |
cc77111ebd85
(svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff
changeset
|
9 |
template <> int Return<AIDate *>(HSQUIRRELVM vm, AIDate *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIDate", res, NULL, DefSQDestructorCallback<AIDate>); return 1; } |
cc77111ebd85
(svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff
changeset
|
10 |
}; // namespace SQConvert |
cc77111ebd85
(svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff
changeset
|
11 |
|
cc77111ebd85
(svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff
changeset
|
12 |
void SQAIDate_Register(Squirrel *engine) { |
cc77111ebd85
(svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff
changeset
|
13 |
DefSQClass <AIDate> SQAIDate("AIDate"); |
cc77111ebd85
(svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff
changeset
|
14 |
SQAIDate.PreRegister(engine); |
cc77111ebd85
(svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff
changeset
|
15 |
SQAIDate.AddConstructor<void (AIDate::*)(), 1>(engine, "x"); |
cc77111ebd85
(svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff
changeset
|
16 |
|
cc77111ebd85
(svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff
changeset
|
17 |
SQAIDate.DefSQStaticMethod(engine, &AIDate::GetClassName, "GetClassName", 1, "x"); |
cc77111ebd85
(svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff
changeset
|
18 |
SQAIDate.DefSQStaticMethod(engine, &AIDate::GetCurrentDate, "GetCurrentDate", 1, "x"); |
cc77111ebd85
(svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff
changeset
|
19 |
SQAIDate.DefSQStaticMethod(engine, &AIDate::GetYear, "GetYear", 2, "xi"); |
cc77111ebd85
(svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff
changeset
|
20 |
SQAIDate.DefSQStaticMethod(engine, &AIDate::GetMonth, "GetMonth", 2, "xi"); |
cc77111ebd85
(svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff
changeset
|
21 |
SQAIDate.DefSQStaticMethod(engine, &AIDate::GetDayOfMonth, "GetDayOfMonth", 2, "xi"); |
cc77111ebd85
(svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff
changeset
|
22 |
SQAIDate.DefSQStaticMethod(engine, &AIDate::GetDate, "GetDate", 4, "xiii"); |
cc77111ebd85
(svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff
changeset
|
23 |
|
cc77111ebd85
(svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff
changeset
|
24 |
SQAIDate.PostRegister(engine); |
cc77111ebd85
(svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff
changeset
|
25 |
} |