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.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
# include "nodepath.h"
# include "nodedata.h"
// NodePath类的构造函数, 初始化路径
NodePath : : NodePath ( const QString & path ) : m_path ( path ) { }
// 分离路径为QStringList
QStringList NodePath : : separate ( ) const
{
# if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
return m_path . split ( PATH_SEPARATOR , QString : : SkipEmptyParts ) ;
# else
return m_path . split ( PATH_SEPARATOR , Qt : : SkipEmptyParts ) ;
# endif
}
// 获取当前路径
QString NodePath : : path ( ) const
{
return m_path ;
}
// 获取父路径
NodePath NodePath : : parentPath ( ) const
{
auto s = separate ( ) ;
s . takeLast ( ) ;
return s . join ( PATH_SEPARATOR ) ;
}
// 获取所有笔记文件夹的路径
QString NodePath : : getAllNoteFolderPath ( )
{
return PATH_SEPARATOR + QString : : number ( SpecialNodeID : : RootFolder ) ;
}
// 获取回收站文件夹的路径
QString NodePath : : getTrashFolderPath ( )
{
return PATH_SEPARATOR + QString : : number ( SpecialNodeID : : RootFolder ) + PATH_SEPARATOR
+ QString : : number ( SpecialNodeID : : TrashFolder ) ;
}