Fix operators for vfspath

This commit is contained in:
2025-11-24 01:09:06 -06:00
parent f74f66a77d
commit 62d30fb5d8
3 changed files with 7 additions and 45 deletions

View File

@@ -123,32 +123,32 @@ namespace Tesses::Framework::Date
};
DateTime operator+(const DateTime& dt, const TimeSpan& ts)
inline DateTime operator+(const DateTime& dt, const TimeSpan& ts)
{
DateTime dt2(dt.ToEpoch() + ts.TotalSeconds());
if(dt.IsLocal())
dt2.SetToLocal();
return dt2;
}
DateTime operator+(const TimeSpan& ts,const DateTime& dt)
inline DateTime operator+(const TimeSpan& ts,const DateTime& dt)
{
DateTime dt2(dt.ToEpoch() + ts.TotalSeconds());
if(dt.IsLocal())
dt2.SetToLocal();
return dt2;
}
TimeSpan operator+(const TimeSpan& ts, const TimeSpan& ts2)
inline TimeSpan operator+(const TimeSpan& ts, const TimeSpan& ts2)
{
return (int64_t)ts + (int64_t)ts2;
}
DateTime operator-(const DateTime& dt, const TimeSpan& ts)
inline DateTime operator-(const DateTime& dt, const TimeSpan& ts)
{
DateTime dt2(dt.ToEpoch() - ts.TotalSeconds());
if(dt.IsLocal())
dt2.SetToLocal();
return dt2;
}
TimeSpan operator-(const DateTime& dt, const DateTime& dt2)
inline TimeSpan operator-(const DateTime& dt, const DateTime& dt2)
{
return (int64_t)dt - (int64_t)dt2;
}

View File

@@ -61,17 +61,9 @@ namespace Tesses::Framework::Filesystem
VFSPath MakeRelative(VFSPath toMakeRelativeTo) const;
};
VFSPath operator/(VFSPath p, VFSPath p2);
VFSPath operator/(VFSPath p, std::string p2);
VFSPath operator/(std::string p, VFSPath p2);
VFSPath operator+(VFSPath p, VFSPath p2);
VFSPath operator+(VFSPath p, std::string p2);
VFSPath operator+(std::string p, VFSPath p2);
bool operator==(VFSPath p,VFSPath p2);
bool operator!=(VFSPath p,VFSPath p2);
bool operator==(std::string p,VFSPath p2);
bool operator!=(std::string p,VFSPath p2);
bool operator==(VFSPath p,std::string p2);
bool operator!=(VFSPath p,std::string p2);
class VFSPathEnumeratorData {
public:
VFSPathEnumeratorData(std::function<bool(VFSPath&)> moveNext, std::function<void()> destroy)

View File

@@ -111,14 +111,7 @@ namespace Tesses::Framework::Filesystem
{
return VFSPath(p,p2);
}
VFSPath operator/(VFSPath p, std::string p2)
{
return VFSPath(p,p2);
}
VFSPath operator/(std::string p, VFSPath p2)
{
return VFSPath(p,p2);
}
VFSPath operator+(VFSPath p, VFSPath p2)
{
VFSPath pout;
@@ -146,14 +139,7 @@ namespace Tesses::Framework::Filesystem
return pout;
}
VFSPath operator+(VFSPath p, std::string p2)
{
return p + VFSPath(p2);
}
VFSPath operator+(std::string p, VFSPath p2)
{
return VFSPath(p) + p2;
}
bool operator==(VFSPath p,VFSPath p2)
{
if(p.relative != p2.relative) return false;
@@ -171,22 +157,6 @@ namespace Tesses::Framework::Filesystem
return false;
}
bool operator==(std::string p,VFSPath p2)
{
return VFSPath(p) == p2;
}
bool operator!=(std::string p,VFSPath p2)
{
return VFSPath(p) != p2;
}
bool operator==(VFSPath p,std::string p2)
{
return p == VFSPath(p2);
}
bool operator!=(VFSPath p,std::string p2)
{
return p != VFSPath(p2);
}
VFSPath VFS::ReadLink(VFSPath path)
{
return VFSPath("/");