OCMessage.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /**
  2. * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
  3. *
  4. * This library is free software; you can redistribute it and/or modify it under
  5. * the terms of the GNU Lesser General Public License as published by the Free
  6. * Software Foundation; either version 2.1 of the License, or (at your option)
  7. * any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  11. * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
  12. * details.
  13. */
  14. #include "OCMessage.h"
  15. #include "ParserUtil.h"
  16. #include "UtilConstants.h"
  17. #include <string>
  18. #include <fstream>
  19. #include <iostream>
  20. using namespace std;
  21. OCMessage::OCMessage(void)
  22. {
  23. _command = new wstring();
  24. _value = new wstring();
  25. }
  26. OCMessage::~OCMessage(void)
  27. {
  28. }
  29. bool OCMessage::InitFromMessage(const wstring* message)
  30. {
  31. if(message->length() == 0)
  32. {
  33. return false;
  34. }
  35. if(!ParserUtil::GetItem(COMMAND, message, _command))
  36. {
  37. return false;
  38. }
  39. if(!ParserUtil::GetItem(VALUE, message, _value))
  40. {
  41. return false;
  42. }
  43. return true;
  44. }
  45. std::wstring* OCMessage::GetCommand()
  46. {
  47. return _command;
  48. }
  49. std::wstring* OCMessage::GetValue()
  50. {
  51. return _value;
  52. }
  53. void OCMessage::SetCommand(std::wstring* command)
  54. {
  55. _command = command;
  56. }
  57. void OCMessage::SetValue(std::wstring* value)
  58. {
  59. _value = value;
  60. }