vnote/src/core/filelocator.h
Le Tan 52702a32e9 hard days for VNoteX project
Never say "refactor" again!!!
2020-11-28 23:10:43 +08:00

49 lines
812 B
C++

#ifndef FILELOCATOR_H
#define FILELOCATOR_H
#include <QString>
namespace vnotex
{
class Node;
// A unique locator for both internal Node and external file.
class FileLocator
{
public:
FileLocator(Node *p_node)
: m_node(p_node)
{
}
FileLocator(const QString &p_filePath)
: m_filePath(p_filePath)
{
}
bool isNode() const
{
return m_node;
}
Node *node() const
{
Q_ASSERT(isNode());
return m_node;
}
const QString &filePath() const
{
Q_ASSERT(!isNode());
return m_filePath;
}
private:
Node *m_node = nullptr;
QString m_filePath;
};
}
#endif // FILELOCATOR_H