Both are dirs
| Return Type | Function name | Arguments |
|---|---|---|
| bool | hzDirent::operator< | (hzDirent&,) |
Declared in file: hzDirectory.h
Defined in file : hzDirectory.cpp
Function Logic:
Function body:
bool hzDirent::operator< (hzDirent& op)
{
// Both are dirs
if (ISDIR(m_Mode) && ISDIR(op.m_Mode))
return m_Name < op.m_Name ? true : false ;
// This is dir, op is file. Return true only if this dir is lower than that of the operand. Even if equal
// the file has a higher value because it equates to dirname/filename (i.e. is longer)
if (ISDIR(m_Mode))
return m_Name < op.Path() ? true : false ;
// This is file, op is dir and can only be less than the op if the parent is less than the operand
if (ISDIR(op.m_Mode))
return Path() < op.m_Name ? true : false ;
// Both are files
if (Path() < op.Path())
return true ;
// if (parent == op.parent && m_Name < op.m_Name)
if (m_parent == op.m_parent && m_Name < op.m_Name)
return true ;
return false ;
}