Skip to content

Commit 5a95e46

Browse files
committed
DMA for RValues
- Add GetMember, GetRefMember, GetMemberCount for RValue, to prevent pointers being restricted to ToMap()
1 parent be80656 commit 5a95e46

File tree

6 files changed

+143
-3
lines changed

6 files changed

+143
-3
lines changed

ExamplePlugin/include/YYToolkit/YYTK_Shared_Base.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#endif // YYTK_MINOR
2525

2626
#ifndef YYTK_PATCH
27-
#define YYTK_PATCH 0
27+
#define YYTK_PATCH 1
2828
#endif
2929

3030
#ifndef YYTK_VERSION_STRING

ExamplePlugin/include/YYToolkit/YYTK_Shared_Interface.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ namespace YYTK
234234

235235
/**
236236
* \brief Retrieves the engine entry for a built-in variable.
237-
* \param Index The array index of the built-in variable.
237+
* \param Index The array index of the built-in variable.
238238
* \param VariableInformation A read-only struct describing the built-in variable.
239239
* \return AURIE_SUCCESS on success. AURIE_INVALID_PARAMETER if the index is out of bounds.
240240
*/
@@ -360,7 +360,7 @@ namespace YYTK
360360
* \brief Calls a game script in the global context.
361361
* \param ScriptName The name of the script to call, prefixed with gml_Script. Case-sensitive.
362362
* \param Arguments The arguments to pass into the script.
363-
* \return AURIE_SUCCESS on success. AURIE_INVALID_PARAMETER if Object is an invalid type.
363+
* \return An RValue representing the return value of the script.
364364
*/
365365
virtual RValue CallGameScript(
366366
IN std::string_view ScriptName,

ExamplePlugin/include/YYToolkit/YYTK_Shared_Types.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,39 @@ std::vector<RValue> YYTK::RValue::ToVector() const
147147
return result;
148148
}
149149

150+
RValue* YYTK::RValue::GetRefMember(
151+
IN const char* MemberName
152+
)
153+
{
154+
return this->ToInstance()->GetRefMember(MemberName);
155+
}
156+
157+
RValue* YYTK::RValue::GetRefMember(
158+
IN const std::string& MemberName
159+
)
160+
{
161+
return this->ToInstance()->GetRefMember(MemberName);
162+
}
163+
164+
RValue YYTK::RValue::GetMember(
165+
IN const char* MemberName
166+
) const
167+
{
168+
return this->ToInstance()->GetMember(MemberName);
169+
}
170+
171+
RValue YYTK::RValue::GetMember(
172+
IN const std::string& MemberName
173+
) const
174+
{
175+
return this->ToInstance()->GetMember(MemberName);
176+
}
177+
178+
int32_t YYTK::RValue::GetMemberCount() const
179+
{
180+
return this->ToInstance()->GetMemberCount();
181+
}
182+
150183
RValue* YYTK::RValue::ToArray()
151184
{
152185
RValue* array_start = nullptr;

ExamplePlugin/include/YYToolkit/YYTK_Shared_Types.hpp

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1681,6 +1681,43 @@ namespace YYTK
16811681
// Elements of the vector are copies of the array members.
16821682
std::vector<RValue> ToVector() const;
16831683

1684+
// Retrieves a nested member from the RValue.
1685+
// Only applicable for VALUE_OBJECT RValues.
1686+
//
1687+
// The returned value is a pointer to the variable.
1688+
// If the variable does not exist, the function returns NULL.
1689+
RValue* GetRefMember(
1690+
IN const char* MemberName
1691+
);
1692+
1693+
// Retrieves a nested member from the RValue.
1694+
// Only applicable for VALUE_OBJECT RValues.
1695+
//
1696+
// The returned value is a pointer to the variable.
1697+
RValue* GetRefMember(
1698+
IN const std::string& MemberName
1699+
);
1700+
1701+
// Retrieves a nested member from the RValue.
1702+
// Only applicable for VALUE_OBJECT RValues.
1703+
//
1704+
// The returned value is a copy of the variable.
1705+
RValue GetMember(
1706+
IN const char* MemberName
1707+
) const;
1708+
1709+
// Retrieves a nested member from the RValue.
1710+
// Only applicable for VALUE_OBJECT RValues.
1711+
//
1712+
// The returned value is a copy of the variable.
1713+
RValue GetMember(
1714+
IN const std::string& MemberName
1715+
) const;
1716+
1717+
// Retrieves the member variable count from the RValue.
1718+
// Only applicable for VALUE_OBJECT RValues.
1719+
int32_t GetMemberCount() const;
1720+
16841721
// Converts the RValue into a C-style array of RValues.
16851722
// Only applicable for VALUE_ARRAY RValues.
16861723
RValue* ToArray();

YYToolkit/source/YYTK/Shared/YYTK_Shared_Types.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,39 @@ std::vector<RValue> YYTK::RValue::ToVector() const
147147
return result;
148148
}
149149

150+
RValue* YYTK::RValue::GetRefMember(
151+
IN const char* MemberName
152+
)
153+
{
154+
return this->ToInstance()->GetRefMember(MemberName);
155+
}
156+
157+
RValue* YYTK::RValue::GetRefMember(
158+
IN const std::string& MemberName
159+
)
160+
{
161+
return this->ToInstance()->GetRefMember(MemberName);
162+
}
163+
164+
RValue YYTK::RValue::GetMember(
165+
IN const char* MemberName
166+
) const
167+
{
168+
return this->ToInstance()->GetMember(MemberName);
169+
}
170+
171+
RValue YYTK::RValue::GetMember(
172+
IN const std::string& MemberName
173+
) const
174+
{
175+
return this->ToInstance()->GetMember(MemberName);
176+
}
177+
178+
int32_t YYTK::RValue::GetMemberCount() const
179+
{
180+
return this->ToInstance()->GetMemberCount();
181+
}
182+
150183
RValue* YYTK::RValue::ToArray()
151184
{
152185
RValue* array_start = nullptr;

YYToolkit/source/YYTK/Shared/YYTK_Shared_Types.hpp

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1681,6 +1681,43 @@ namespace YYTK
16811681
// Elements of the vector are copies of the array members.
16821682
std::vector<RValue> ToVector() const;
16831683

1684+
// Retrieves a nested member from the RValue.
1685+
// Only applicable for VALUE_OBJECT RValues.
1686+
//
1687+
// The returned value is a pointer to the variable.
1688+
// If the variable does not exist, the function returns NULL.
1689+
RValue* GetRefMember(
1690+
IN const char* MemberName
1691+
);
1692+
1693+
// Retrieves a nested member from the RValue.
1694+
// Only applicable for VALUE_OBJECT RValues.
1695+
//
1696+
// The returned value is a pointer to the variable.
1697+
RValue* GetRefMember(
1698+
IN const std::string& MemberName
1699+
);
1700+
1701+
// Retrieves a nested member from the RValue.
1702+
// Only applicable for VALUE_OBJECT RValues.
1703+
//
1704+
// The returned value is a copy of the variable.
1705+
RValue GetMember(
1706+
IN const char* MemberName
1707+
) const;
1708+
1709+
// Retrieves a nested member from the RValue.
1710+
// Only applicable for VALUE_OBJECT RValues.
1711+
//
1712+
// The returned value is a copy of the variable.
1713+
RValue GetMember(
1714+
IN const std::string& MemberName
1715+
) const;
1716+
1717+
// Retrieves the member variable count from the RValue.
1718+
// Only applicable for VALUE_OBJECT RValues.
1719+
int32_t GetMemberCount() const;
1720+
16841721
// Converts the RValue into a C-style array of RValues.
16851722
// Only applicable for VALUE_ARRAY RValues.
16861723
RValue* ToArray();

0 commit comments

Comments
 (0)