Skip to content

Commit cb48a88

Browse files
committed
LibMCCore:: add SetAttributeDoubleValue API and extend UI JSON with UUID and showEvent
- LibMCEnv (XMLDocumentNode): - Added new API method `SetAttributeDoubleValue`. - Allows setting the double value of an attribute; fails if the attribute does not exist or is not of type double. - UI handler: - Extended legacy state serialization to include additional fields for pages: * `uuid` – unique identifier of the page. * `showevent` – event name triggered when the page is shown. - Ensures clients can distinguish pages and react to show events. These changes extend the environment API with support for writing double attributes and enhance UI JSON with page metadata required for dynamic client-side behavior.
1 parent 7c8043d commit cb48a88

File tree

11 files changed

+106
-1
lines changed

11 files changed

+106
-1
lines changed

ACT/LibMCEnv.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3367,6 +3367,12 @@
33673367
<param name="Value" type="double" pass="return" description="Attribute value." />
33683368
</method>
33693369

3370+
<method name="SetAttributeDoubleValue" description="Sets double value of an attribute. Fails if attribute does not exist or attribute is not a double value.">
3371+
<param name="NameSpace" type="string" pass="in" description="Namespace of the attribute. If empty, it inherits the namespace of the node." />
3372+
<param name="Name" type="string" pass="in" description="Name of the attribute." />
3373+
<param name="Value" type="double" pass="in" description="Attribute value." />
3374+
</method>
3375+
33703376
<method name="GetAttributeBoolValue" description="Returns bool value of an attribute. Fails if attribute does not exist or attribute is not a boolean value.">
33713377
<param name="NameSpace" type="string" pass="in" description="Namespace of the attribute. If empty, it inherits the namespace of the node." />
33723378
<param name="Name" type="string" pass="in" description="Name of the attribute." />
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
e2c72a23be95fb6336d1b8dfd4b7430086f04768
1+
7c8043df52519207935670d4934d1f88e3b36961
2 Bytes
Binary file not shown.

Framework/HeadersDev/CppDynamic/libmcenv_dynamic.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5831,6 +5831,17 @@ typedef LibMCEnvResult (*PLibMCEnvXMLDocumentNode_SetAttributeIntegerValuePtr) (
58315831
*/
58325832
typedef LibMCEnvResult (*PLibMCEnvXMLDocumentNode_GetAttributeDoubleValuePtr) (LibMCEnv_XMLDocumentNode pXMLDocumentNode, const char * pNameSpace, const char * pName, LibMCEnv_double dMinValue, LibMCEnv_double dMaxValue, LibMCEnv_double * pValue);
58335833

5834+
/**
5835+
* Sets double value of an attribute. Fails if attribute does not exist or attribute is not a double value.
5836+
*
5837+
* @param[in] pXMLDocumentNode - XMLDocumentNode instance.
5838+
* @param[in] pNameSpace - Namespace of the attribute. If empty, it inherits the namespace of the node.
5839+
* @param[in] pName - Name of the attribute.
5840+
* @param[in] dValue - Attribute value.
5841+
* @return error code or 0 (success)
5842+
*/
5843+
typedef LibMCEnvResult (*PLibMCEnvXMLDocumentNode_SetAttributeDoubleValuePtr) (LibMCEnv_XMLDocumentNode pXMLDocumentNode, const char * pNameSpace, const char * pName, LibMCEnv_double dValue);
5844+
58345845
/**
58355846
* Returns bool value of an attribute. Fails if attribute does not exist or attribute is not a boolean value.
58365847
*
@@ -11479,6 +11490,7 @@ typedef struct {
1147911490
PLibMCEnvXMLDocumentNode_GetAttributeIntegerValuePtr m_XMLDocumentNode_GetAttributeIntegerValue;
1148011491
PLibMCEnvXMLDocumentNode_SetAttributeIntegerValuePtr m_XMLDocumentNode_SetAttributeIntegerValue;
1148111492
PLibMCEnvXMLDocumentNode_GetAttributeDoubleValuePtr m_XMLDocumentNode_GetAttributeDoubleValue;
11493+
PLibMCEnvXMLDocumentNode_SetAttributeDoubleValuePtr m_XMLDocumentNode_SetAttributeDoubleValue;
1148211494
PLibMCEnvXMLDocumentNode_GetAttributeBoolValuePtr m_XMLDocumentNode_GetAttributeBoolValue;
1148311495
PLibMCEnvXMLDocumentNode_GetAttributeUUIDValuePtr m_XMLDocumentNode_GetAttributeUUIDValue;
1148411496
PLibMCEnvXMLDocumentNode_GetAttributeValueDefPtr m_XMLDocumentNode_GetAttributeValueDef;

Framework/HeadersDev/CppDynamic/libmcenv_dynamic.hpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2538,6 +2538,7 @@ class CXMLDocumentNode : public CBase {
25382538
inline LibMCEnv_int64 GetAttributeIntegerValue(const std::string & sNameSpace, const std::string & sName, const LibMCEnv_int64 nMinValue, const LibMCEnv_int64 nMaxValue);
25392539
inline void SetAttributeIntegerValue(const std::string & sNameSpace, const std::string & sName, const LibMCEnv_int64 nValue);
25402540
inline LibMCEnv_double GetAttributeDoubleValue(const std::string & sNameSpace, const std::string & sName, const LibMCEnv_double dMinValue, const LibMCEnv_double dMaxValue);
2541+
inline void SetAttributeDoubleValue(const std::string & sNameSpace, const std::string & sName, const LibMCEnv_double dValue);
25412542
inline bool GetAttributeBoolValue(const std::string & sNameSpace, const std::string & sName);
25422543
inline std::string GetAttributeUUIDValue(const std::string & sNameSpace, const std::string & sName);
25432544
inline std::string GetAttributeValueDef(const std::string & sNameSpace, const std::string & sName, const std::string & sDefaultValue);
@@ -4162,6 +4163,7 @@ class CUIEnvironment : public CBase {
41624163
pWrapperTable->m_XMLDocumentNode_GetAttributeIntegerValue = nullptr;
41634164
pWrapperTable->m_XMLDocumentNode_SetAttributeIntegerValue = nullptr;
41644165
pWrapperTable->m_XMLDocumentNode_GetAttributeDoubleValue = nullptr;
4166+
pWrapperTable->m_XMLDocumentNode_SetAttributeDoubleValue = nullptr;
41654167
pWrapperTable->m_XMLDocumentNode_GetAttributeBoolValue = nullptr;
41664168
pWrapperTable->m_XMLDocumentNode_GetAttributeUUIDValue = nullptr;
41674169
pWrapperTable->m_XMLDocumentNode_GetAttributeValueDef = nullptr;
@@ -9582,6 +9584,15 @@ class CUIEnvironment : public CBase {
95829584
if (pWrapperTable->m_XMLDocumentNode_GetAttributeDoubleValue == nullptr)
95839585
return LIBMCENV_ERROR_COULDNOTFINDLIBRARYEXPORT;
95849586

9587+
#ifdef _WIN32
9588+
pWrapperTable->m_XMLDocumentNode_SetAttributeDoubleValue = (PLibMCEnvXMLDocumentNode_SetAttributeDoubleValuePtr) GetProcAddress(hLibrary, "libmcenv_xmldocumentnode_setattributedoublevalue");
9589+
#else // _WIN32
9590+
pWrapperTable->m_XMLDocumentNode_SetAttributeDoubleValue = (PLibMCEnvXMLDocumentNode_SetAttributeDoubleValuePtr) dlsym(hLibrary, "libmcenv_xmldocumentnode_setattributedoublevalue");
9591+
dlerror();
9592+
#endif // _WIN32
9593+
if (pWrapperTable->m_XMLDocumentNode_SetAttributeDoubleValue == nullptr)
9594+
return LIBMCENV_ERROR_COULDNOTFINDLIBRARYEXPORT;
9595+
95859596
#ifdef _WIN32
95869597
pWrapperTable->m_XMLDocumentNode_GetAttributeBoolValue = (PLibMCEnvXMLDocumentNode_GetAttributeBoolValuePtr) GetProcAddress(hLibrary, "libmcenv_xmldocumentnode_getattributeboolvalue");
95879598
#else // _WIN32
@@ -16040,6 +16051,10 @@ class CUIEnvironment : public CBase {
1604016051
if ( (eLookupError != 0) || (pWrapperTable->m_XMLDocumentNode_GetAttributeDoubleValue == nullptr) )
1604116052
return LIBMCENV_ERROR_COULDNOTFINDLIBRARYEXPORT;
1604216053

16054+
eLookupError = (*pLookup)("libmcenv_xmldocumentnode_setattributedoublevalue", (void**)&(pWrapperTable->m_XMLDocumentNode_SetAttributeDoubleValue));
16055+
if ( (eLookupError != 0) || (pWrapperTable->m_XMLDocumentNode_SetAttributeDoubleValue == nullptr) )
16056+
return LIBMCENV_ERROR_COULDNOTFINDLIBRARYEXPORT;
16057+
1604316058
eLookupError = (*pLookup)("libmcenv_xmldocumentnode_getattributeboolvalue", (void**)&(pWrapperTable->m_XMLDocumentNode_GetAttributeBoolValue));
1604416059
if ( (eLookupError != 0) || (pWrapperTable->m_XMLDocumentNode_GetAttributeBoolValue == nullptr) )
1604516060
return LIBMCENV_ERROR_COULDNOTFINDLIBRARYEXPORT;
@@ -25305,6 +25320,17 @@ class CUIEnvironment : public CBase {
2530525320
return resultValue;
2530625321
}
2530725322

25323+
/**
25324+
* CXMLDocumentNode::SetAttributeDoubleValue - Sets double value of an attribute. Fails if attribute does not exist or attribute is not a double value.
25325+
* @param[in] sNameSpace - Namespace of the attribute. If empty, it inherits the namespace of the node.
25326+
* @param[in] sName - Name of the attribute.
25327+
* @param[in] dValue - Attribute value.
25328+
*/
25329+
void CXMLDocumentNode::SetAttributeDoubleValue(const std::string & sNameSpace, const std::string & sName, const LibMCEnv_double dValue)
25330+
{
25331+
CheckError(m_pWrapper->m_WrapperTable.m_XMLDocumentNode_SetAttributeDoubleValue(m_pHandle, sNameSpace.c_str(), sName.c_str(), dValue));
25332+
}
25333+
2530825334
/**
2530925335
* CXMLDocumentNode::GetAttributeBoolValue - Returns bool value of an attribute. Fails if attribute does not exist or attribute is not a boolean value.
2531025336
* @param[in] sNameSpace - Namespace of the attribute. If empty, it inherits the namespace of the node.

Framework/InterfacesCore/libmcenv_abi.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5844,6 +5844,17 @@ LIBMCENV_DECLSPEC LibMCEnvResult libmcenv_xmldocumentnode_setattributeintegerval
58445844
*/
58455845
LIBMCENV_DECLSPEC LibMCEnvResult libmcenv_xmldocumentnode_getattributedoublevalue(LibMCEnv_XMLDocumentNode pXMLDocumentNode, const char * pNameSpace, const char * pName, LibMCEnv_double dMinValue, LibMCEnv_double dMaxValue, LibMCEnv_double * pValue);
58465846

5847+
/**
5848+
* Sets double value of an attribute. Fails if attribute does not exist or attribute is not a double value.
5849+
*
5850+
* @param[in] pXMLDocumentNode - XMLDocumentNode instance.
5851+
* @param[in] pNameSpace - Namespace of the attribute. If empty, it inherits the namespace of the node.
5852+
* @param[in] pName - Name of the attribute.
5853+
* @param[in] dValue - Attribute value.
5854+
* @return error code or 0 (success)
5855+
*/
5856+
LIBMCENV_DECLSPEC LibMCEnvResult libmcenv_xmldocumentnode_setattributedoublevalue(LibMCEnv_XMLDocumentNode pXMLDocumentNode, const char * pNameSpace, const char * pName, LibMCEnv_double dValue);
5857+
58475858
/**
58485859
* Returns bool value of an attribute. Fails if attribute does not exist or attribute is not a boolean value.
58495860
*

Framework/InterfacesCore/libmcenv_interfaces.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4659,6 +4659,14 @@ class IXMLDocumentNode : public virtual IBase {
46594659
*/
46604660
virtual LibMCEnv_double GetAttributeDoubleValue(const std::string & sNameSpace, const std::string & sName, const LibMCEnv_double dMinValue, const LibMCEnv_double dMaxValue) = 0;
46614661

4662+
/**
4663+
* IXMLDocumentNode::SetAttributeDoubleValue - Sets double value of an attribute. Fails if attribute does not exist or attribute is not a double value.
4664+
* @param[in] sNameSpace - Namespace of the attribute. If empty, it inherits the namespace of the node.
4665+
* @param[in] sName - Name of the attribute.
4666+
* @param[in] dValue - Attribute value.
4667+
*/
4668+
virtual void SetAttributeDoubleValue(const std::string & sNameSpace, const std::string & sName, const LibMCEnv_double dValue) = 0;
4669+
46624670
/**
46634671
* IXMLDocumentNode::GetAttributeBoolValue - Returns bool value of an attribute. Fails if attribute does not exist or attribute is not a boolean value.
46644672
* @param[in] sNameSpace - Namespace of the attribute. If empty, it inherits the namespace of the node.

Framework/InterfacesCore/libmcenv_interfacewrapper.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17201,6 +17201,36 @@ LibMCEnvResult libmcenv_xmldocumentnode_getattributedoublevalue(LibMCEnv_XMLDocu
1720117201
}
1720217202
}
1720317203

17204+
LibMCEnvResult libmcenv_xmldocumentnode_setattributedoublevalue(LibMCEnv_XMLDocumentNode pXMLDocumentNode, const char * pNameSpace, const char * pName, LibMCEnv_double dValue)
17205+
{
17206+
IBase* pIBaseClass = (IBase *)pXMLDocumentNode;
17207+
17208+
try {
17209+
if (pNameSpace == nullptr)
17210+
throw ELibMCEnvInterfaceException (LIBMCENV_ERROR_INVALIDPARAM);
17211+
if (pName == nullptr)
17212+
throw ELibMCEnvInterfaceException (LIBMCENV_ERROR_INVALIDPARAM);
17213+
std::string sNameSpace(pNameSpace);
17214+
std::string sName(pName);
17215+
IXMLDocumentNode* pIXMLDocumentNode = dynamic_cast<IXMLDocumentNode*>(pIBaseClass);
17216+
if (!pIXMLDocumentNode)
17217+
throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_INVALIDCAST);
17218+
17219+
pIXMLDocumentNode->SetAttributeDoubleValue(sNameSpace, sName, dValue);
17220+
17221+
return LIBMCENV_SUCCESS;
17222+
}
17223+
catch (ELibMCEnvInterfaceException & Exception) {
17224+
return handleLibMCEnvException(pIBaseClass, Exception);
17225+
}
17226+
catch (std::exception & StdException) {
17227+
return handleStdException(pIBaseClass, StdException);
17228+
}
17229+
catch (...) {
17230+
return handleUnhandledException(pIBaseClass);
17231+
}
17232+
}
17233+
1720417234
LibMCEnvResult libmcenv_xmldocumentnode_getattributeboolvalue(LibMCEnv_XMLDocumentNode pXMLDocumentNode, const char * pNameSpace, const char * pName, bool * pValue)
1720517235
{
1720617236
IBase* pIBaseClass = (IBase *)pXMLDocumentNode;
@@ -33961,6 +33991,8 @@ LibMCEnvResult LibMCEnv::Impl::LibMCEnv_GetProcAddress (const char * pProcName,
3396133991
*ppProcAddress = (void*) &libmcenv_xmldocumentnode_setattributeintegervalue;
3396233992
if (sProcName == "libmcenv_xmldocumentnode_getattributedoublevalue")
3396333993
*ppProcAddress = (void*) &libmcenv_xmldocumentnode_getattributedoublevalue;
33994+
if (sProcName == "libmcenv_xmldocumentnode_setattributedoublevalue")
33995+
*ppProcAddress = (void*) &libmcenv_xmldocumentnode_setattributedoublevalue;
3396433996
if (sProcName == "libmcenv_xmldocumentnode_getattributeboolvalue")
3396533997
*ppProcAddress = (void*) &libmcenv_xmldocumentnode_getattributeboolvalue;
3396633998
if (sProcName == "libmcenv_xmldocumentnode_getattributeuuidvalue")

Implementation/LibMCEnv/libmcenv_xmldocumentnode.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,12 @@ LibMCEnv_double CXMLDocumentNode::GetAttributeDoubleValue(const std::string& sNa
142142

143143
}
144144

145+
void CXMLDocumentNode::SetAttributeDoubleValue(const std::string& sNameSpace, const std::string& sName, const LibMCEnv_double dValue)
146+
{
147+
std::unique_ptr<IXMLDocumentAttribute> pAttribute(FindAttribute(sNameSpace, sName, true));
148+
return pAttribute->SetDoubleValue(dValue);
149+
}
150+
145151
bool CXMLDocumentNode::GetAttributeBoolValue(const std::string& sNameSpace, const std::string& sName)
146152
{
147153
std::unique_ptr<IXMLDocumentAttribute> pAttribute(FindAttribute(sNameSpace, sName, true));

Implementation/LibMCEnv/libmcenv_xmldocumentnode.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ class CXMLDocumentNode : public virtual IXMLDocumentNode, public virtual CBase {
9393

9494
LibMCEnv_double GetAttributeDoubleValue(const std::string& sNameSpace, const std::string& sName, const LibMCEnv_double dMinValue, const LibMCEnv_double dMaxValue) override;
9595

96+
void SetAttributeDoubleValue(const std::string& sNameSpace, const std::string& sName, const LibMCEnv_double dValue) override;
97+
9698
bool GetAttributeBoolValue(const std::string& sNameSpace, const std::string& sName) override;
9799

98100
std::string GetAttributeUUIDValue(const std::string& sNameSpace, const std::string& sName) override;

0 commit comments

Comments
 (0)