serialize_path.cpp
Go to the documentation of this file.
1 #include "serialize_path.h"
2 
4 
6 
7 #include <SimoxUtility/algorithm/string.h>
8 
9 #include <QString>
10 #include <QStringList>
11 
12 
14 {
15  QStringList qpath;
16  qpath.append(QString::fromStdString(path.getRootIdentifier()));
17  qpath.append(QString::fromStdString(path.getDelimeter()));
18  for (const std::string& item : path.getPath())
19  {
20  qpath.append(QString::fromStdString(item));
21  }
22  return qpath;
23 }
24 
26 {
27  ARMARX_CHECK_GREATER_EQUAL(qpath.size(), 2);
28  std::vector<std::string> pathItems;
29  for (int i = 2; i < qpath.size(); ++i)
30  {
31  pathItems.push_back(qpath.at(i).toStdString());
32  }
33  aron::Path path(pathItems);
34  path.setRootIdentifier(qpath.at(0).toStdString());
35  path.setDelimeter(qpath.at(1).toStdString());
36  return path;
37 }
Path.h
armarx::aron::Path::getDelimeter
std::string getDelimeter() const
Definition: Path.cpp:73
armarx::armem::gui::instance::deserializePath
aron::Path deserializePath(const QStringList &qpath)
Definition: serialize_path.cpp:25
armarx::aron::Path
The Path class.
Definition: Path.h:36
armarx::aron::Path::setRootIdentifier
void setRootIdentifier(const std::string &)
Definition: Path.cpp:55
armarx::aron::Path::setDelimeter
void setDelimeter(const std::string &)
Definition: Path.cpp:67
ARMARX_CHECK_GREATER_EQUAL
#define ARMARX_CHECK_GREATER_EQUAL(lhs, rhs)
This macro evaluates whether lhs is greater or equal (>=) rhs and if it turns out to be false it will...
Definition: ExpressionException.h:123
ExpressionException.h
armarx::armem::gui::instance::serializePath
QStringList serializePath(const aron::Path &path)
Definition: serialize_path.cpp:13
armarx::aron::Path::getRootIdentifier
std::string getRootIdentifier() const
Definition: Path.cpp:61
armarx::aron::Path::getPath
std::vector< std::string > getPath() const
Definition: Path.cpp:85
serialize_path.h