54 lines
1.1 KiB
C++
54 lines
1.1 KiB
C++
#include "route.h"
|
|
|
|
using namespace Core;
|
|
|
|
Route::Route()
|
|
{
|
|
|
|
}
|
|
|
|
Route::Route(const Route &other)
|
|
: links_store(other.links_store) {}
|
|
|
|
bool Route::isValid() const { return links_store.size() > 0; }
|
|
|
|
QStringList Route::links() const
|
|
{
|
|
return links_store;
|
|
}
|
|
|
|
Route Route::operator |(const QString &node) const
|
|
{
|
|
Route exlink(*this);
|
|
exlink.links_store.append(node);
|
|
return exlink;
|
|
}
|
|
|
|
bool Route::operator==(const Route &other) const
|
|
{
|
|
if(links_store.size() == other.links_store.size()){
|
|
for(auto idx=0; idx<links_store.size(); ++idx)
|
|
if(links_store.at(idx) != other.links_store.at(idx))
|
|
return false;
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
bool Route::operator<(const Route &other) const {
|
|
auto tins = links().join("/");
|
|
auto oins = links().join("/");
|
|
return tins < oins;
|
|
}
|
|
|
|
void Route::append(const QString &node) { links_store << node; }
|
|
|
|
void Route::prepend(const QString &node) { links_store.prepend(node); }
|
|
|
|
Route Route::collect(const QList<QString> &list)
|
|
{
|
|
Route v;
|
|
v.links_store.append(list);
|
|
return v;
|
|
}
|