2014-07-30 19:20:55 +04:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or modify it under
|
|
|
|
* the terms of the GNU Lesser General Public License as published by the Free
|
|
|
|
* Software Foundation; either version 2.1 of the License, or (at your option)
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
|
|
|
* details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "OCMessage.h"
|
|
|
|
#include "ParserUtil.h"
|
|
|
|
#include "UtilConstants.h"
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include <fstream>
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
OCMessage::OCMessage(void)
|
|
|
|
{
|
2017-01-05 19:28:28 +03:00
|
|
|
_command = new wstring();
|
|
|
|
_value = new wstring();
|
2014-07-30 19:20:55 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
OCMessage::~OCMessage(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool OCMessage::InitFromMessage(const wstring* message)
|
|
|
|
{
|
2017-01-05 19:28:28 +03:00
|
|
|
if(message->length() == 0)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!ParserUtil::GetItem(COMMAND, message, _command))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2014-07-30 19:20:55 +04:00
|
|
|
|
2017-01-05 19:28:28 +03:00
|
|
|
if(!ParserUtil::GetItem(VALUE, message, _value))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2014-07-30 19:20:55 +04:00
|
|
|
|
2017-01-05 19:28:28 +03:00
|
|
|
return true;
|
2014-07-30 19:20:55 +04:00
|
|
|
}
|
2017-01-05 19:28:28 +03:00
|
|
|
|
2014-07-30 19:20:55 +04:00
|
|
|
std::wstring* OCMessage::GetCommand()
|
|
|
|
{
|
2017-01-05 19:28:28 +03:00
|
|
|
return _command;
|
2014-07-30 19:20:55 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
std::wstring* OCMessage::GetValue()
|
|
|
|
{
|
2017-01-05 19:28:28 +03:00
|
|
|
return _value;
|
2014-07-30 19:20:55 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void OCMessage::SetCommand(std::wstring* command)
|
|
|
|
{
|
2017-01-05 19:28:28 +03:00
|
|
|
_command = command;
|
2014-07-30 19:20:55 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void OCMessage::SetValue(std::wstring* value)
|
|
|
|
{
|
2017-01-05 19:28:28 +03:00
|
|
|
_value = value;
|
2014-07-30 19:20:55 +04:00
|
|
|
}
|