genesis-3d_engine/Engine/buildingtools/idlcompiler/idlmessage.cc
zhongdaohuan 6e8fbca745 genesis-3d engine version 1.3.
match the genesis editor version 1.3.0.653.
2014-05-05 14:50:33 +08:00

81 lines
1.9 KiB
C++

//------------------------------------------------------------------------------
// idlmessage.cc
// (C) 2006 Radon Labs GmbH
//------------------------------------------------------------------------------
#include "stdneb.h"
#include "tools/idlcompiler/idlmessage.h"
namespace Tools
{
__ImplementClass(Tools::IDLMessage, 'ILMS', Core::RefCounted);
using namespace IO;
//------------------------------------------------------------------------------
/**
*/
IDLMessage::IDLMessage()
{
// empty
}
//------------------------------------------------------------------------------
/**
*/
bool
IDLMessage::Parse(XmlReader* reader, bool isMangaloreProtocol)
{
n_assert(0 != reader);
n_assert(reader->GetCurrentNodeName() == "Message");
// parse attributes
this->name = reader->GetString("name");
if (!isMangaloreProtocol)
{
this->fourcc = reader->GetString("fourcc");
}
if (reader->HasAttr("derivedFrom"))
{
this->parentClass = reader->GetString("derivedFrom");
}
else
{
if (isMangaloreProtocol)
{
this->parentClass = "Message::Msg";
}
else
{
this->parentClass = "Messaging::Message";
}
}
// parse input args
if (reader->SetToFirstChild("InArg")) do
{
Ptr<IDLArg> arg = IDLArg::Create();
if (!arg->Parse(reader))
{
this->SetError(arg->GetError());
return false;
}
this->inArgs.Append(arg);
}
while (reader->SetToNextChild("InArg"));
// parse output args
if (reader->SetToFirstChild("OutArg")) do
{
Ptr<IDLArg> arg = IDLArg::Create();
if (!arg->Parse(reader))
{
this->SetError(arg->GetError());
return false;
}
this->outArgs.Append(arg);
}
while (reader->SetToNextChild("OutArg"));
return true;
}
} // namespace Tools