You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ScBasicCommand.cpp 573B

1234567891011121314151617181920212223242526272829303132333435
  1. //
  2. // Created by robin on 6/27/15.
  3. //
  4. #include <string>
  5. #include "ScBasicCommand.h"
  6. ScBasicCommand::ScBasicCommand(const std::string &data)
  7. {
  8. DWORD size = 0;
  9. for (auto c : data)
  10. {
  11. if (isxdigit(c))
  12. ++size;
  13. }
  14. auto d = new BYTE[size];
  15. size = 0;
  16. for (int i = 0; i < data.size(); ++i)
  17. {
  18. auto c = data[i];
  19. if (isxdigit(c))
  20. d[size++] = hexToDec(c);
  21. }
  22. _data = ScByteArray(d, size);
  23. }
  24. ScBasicCommand::~ScBasicCommand()
  25. {
  26. }
  27. ScByteArray ScBasicCommand::getData() const
  28. {
  29. return _data;
  30. }