genesis-3d_engine/Engine/buildingtools/idlcompiler/idlcommand.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

73 lines
1.8 KiB
C++

//------------------------------------------------------------------------------
// idlcommand.cc
// (C) 2006 Radon Labs GmbH
//------------------------------------------------------------------------------
#include "stdneb.h"
#include "tools/idlcompiler/idlcommand.h"
namespace Tools
{
__ImplementClass(Tools::IDLCommand, 'ILCM', Core::RefCounted);
using namespace Util;
using namespace IO;
//------------------------------------------------------------------------------
/**
*/
IDLCommand::IDLCommand()
{
// empty
}
//------------------------------------------------------------------------------
/**
*/
bool
IDLCommand::Parse(XmlReader* reader)
{
n_assert(0 != reader);
n_assert(reader->GetCurrentNodeName() == "Command");
// parse attributes
this->name = reader->GetString("name");
this->desc = reader->GetString("desc");
this->fourcc = reader->GetString("fourcc");
// 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"));
// read source code fragment
bool success = reader->SetToFirstChild("Code");
n_assert2(success, "<Code> element expected!");
this->code = reader->GetContent();
reader->SetToParent();
return true;
}
} // namespace Tools