Skip to content

Commit

Permalink
refactoring - renames & moves
Browse files Browse the repository at this point in the history
  • Loading branch information
alabuzhev committed Oct 28, 2017
1 parent c283930 commit 7acf355
Show file tree
Hide file tree
Showing 47 changed files with 460 additions and 461 deletions.
4 changes: 4 additions & 0 deletions far/changelog
@@ -1,3 +1,7 @@
drkns 28.10.2017 12:18:36 +0100 - build 5079

1. Рефакторинг - переименования & переносы.

svs 27.10.2017 21:18:41 +0300 - build 5078

1. SQLite 3.21.0
Expand Down
1 change: 1 addition & 0 deletions far/cmdline.cpp
Expand Up @@ -35,6 +35,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#pragma hdrstop

#include "cmdline.hpp"
#include "platform.security.hpp"
#include "execute.hpp"
#include "macroopcode.hpp"
#include "keys.hpp"
Expand Down
14 changes: 7 additions & 7 deletions far/configdb.cpp
Expand Up @@ -1706,7 +1706,7 @@ class HistoryConfigCustom: public HistoryConfig, public SQLiteDb

bool AddInternal(unsigned int TypeHistory, const string& HistoryName, const string &Name, int Type, bool Lock, const string &strGuid, const string &strFile, const string &strData) const
{
return ExecuteStatement(stmtAdd, TypeHistory, HistoryName, Type, Lock, Name, nt_clock::now().time_since_epoch().count(), strGuid, strFile, strData);
return ExecuteStatement(stmtAdd, TypeHistory, HistoryName, Type, Lock, Name, os::chrono::nt_clock::now().time_since_epoch().count(), strGuid, strFile, strData);
}

bool DeleteInternal(unsigned long long id) const
Expand Down Expand Up @@ -1812,7 +1812,7 @@ class HistoryConfigCustom: public HistoryConfig, public SQLiteDb
return DeleteInternal(id);
}

virtual bool Enum(DWORD index, unsigned int TypeHistory, const string_view& HistoryName, unsigned long long& id, string& Name, history_record_type& Type, bool& Lock, time_point& Time, string& strGuid, string& strFile, string& strData, bool Reverse = false) override
virtual bool Enum(DWORD index, unsigned int TypeHistory, const string_view& HistoryName, unsigned long long& id, string& Name, history_record_type& Type, bool& Lock, os::chrono::time_point& Time, string& strGuid, string& strFile, string& strData, bool Reverse = false) override
{
WaitAllAsync();
auto Stmt = AutoStatement(Reverse? stmtEnumDesc : stmtEnum);
Expand All @@ -1827,7 +1827,7 @@ class HistoryConfigCustom: public HistoryConfig, public SQLiteDb
Name = Stmt->GetColText(1);
Type = static_cast<history_record_type>(Stmt->GetColInt(2));
Lock = Stmt->GetColInt(3) != 0;
Time = time_point(duration(Stmt->GetColInt64(4)));
Time = os::chrono::time_point(os::chrono::duration(Stmt->GetColInt64(4)));
strGuid = Stmt->GetColText(5);
strFile = Stmt->GetColText(6);
strData = Stmt->GetColText(7);
Expand Down Expand Up @@ -1860,7 +1860,7 @@ class HistoryConfigCustom: public HistoryConfig, public SQLiteDb
{
WaitAllAsync();

const auto older = (nt_clock::now() - chrono::days(DaysToKeep)).time_since_epoch().count();
const auto older = (os::chrono::nt_clock::now() - chrono::days(DaysToKeep)).time_since_epoch().count();
return ExecuteStatement(stmtDeleteOldUnlocked, TypeHistory, HistoryName, older, MinimumEntries);
}

Expand Down Expand Up @@ -1971,7 +1971,7 @@ class HistoryConfigCustom: public HistoryConfig, public SQLiteDb
virtual unsigned long long SetEditorPos(const string_view& Name, int Line, int LinePos, int ScreenLine, int LeftPos, uintptr_t CodePage) override
{
WaitCommitAsync();
return ExecuteStatement(stmtSetEditorPos, Name, nt_clock::now().time_since_epoch().count(), Line, LinePos, ScreenLine, LeftPos, CodePage)? LastInsertRowID() : 0;
return ExecuteStatement(stmtSetEditorPos, Name, os::chrono::nt_clock::now().time_since_epoch().count(), Line, LinePos, ScreenLine, LeftPos, CodePage)? LastInsertRowID() : 0;
}

virtual unsigned long long GetEditorPos(const string_view& Name, int *Line, int *LinePos, int *ScreenLine, int *LeftPos, uintptr_t *CodePage) override
Expand Down Expand Up @@ -2012,7 +2012,7 @@ class HistoryConfigCustom: public HistoryConfig, public SQLiteDb
virtual unsigned long long SetViewerPos(const string_view& Name, long long FilePos, long long LeftPos, int Hex_Wrap, uintptr_t CodePage) override
{
WaitCommitAsync();
return ExecuteStatement(stmtSetViewerPos, Name, nt_clock::now().time_since_epoch().count(), FilePos, LeftPos, Hex_Wrap, CodePage)? LastInsertRowID() : 0;
return ExecuteStatement(stmtSetViewerPos, Name, os::chrono::nt_clock::now().time_since_epoch().count(), FilePos, LeftPos, Hex_Wrap, CodePage)? LastInsertRowID() : 0;
}

virtual unsigned long long GetViewerPos(const string_view& Name, long long *FilePos, long long *LeftPos, int *Hex, uintptr_t *CodePage) override
Expand Down Expand Up @@ -2051,7 +2051,7 @@ class HistoryConfigCustom: public HistoryConfig, public SQLiteDb
virtual void DeleteOldPositions(int DaysToKeep, int MinimumEntries) override
{
WaitCommitAsync();
const auto older = (nt_clock::now() - chrono::days(DaysToKeep)).time_since_epoch().count();
const auto older = (os::chrono::nt_clock::now() - chrono::days(DaysToKeep)).time_since_epoch().count();
ExecuteStatement(stmtDeleteOldEditor, older, MinimumEntries);
ExecuteStatement(stmtDeleteOldViewer, older, MinimumEntries);
}
Expand Down
4 changes: 2 additions & 2 deletions far/configdb.hpp
Expand Up @@ -288,7 +288,7 @@ class HistoryConfig: public representable, virtual public transactional
virtual ~HistoryConfig() override = default;

//command,view,edit,folder,dialog history
virtual bool Enum(DWORD index, unsigned int TypeHistory, const string_view& HistoryName, unsigned long long& id, string& strName, history_record_type& Type, bool& Lock, time_point& Time, string& strGuid, string& strFile, string& strData, bool Reverse = false) = 0;
virtual bool Enum(DWORD index, unsigned int TypeHistory, const string_view& HistoryName, unsigned long long& id, string& strName, history_record_type& Type, bool& Lock, os::chrono::time_point& Time, string& strGuid, string& strFile, string& strData, bool Reverse = false) = 0;
virtual bool Delete(unsigned long long id) = 0;
virtual bool DeleteAndAddAsync(unsigned long long DeleteId, unsigned int TypeHistory, const string_view& HistoryName, const string_view& strName, int Type, bool Lock, string &strGuid, string &strFile, string &strData) = 0;
virtual bool DeleteOldUnlocked(unsigned int TypeHistory, const string_view& HistoryName, int DaysToKeep, int MinimumEntries) = 0;
Expand Down Expand Up @@ -321,7 +321,7 @@ class HistoryConfig: public representable, virtual public transactional
string Name;
history_record_type Type;
bool Lock;
time_point Time;
os::chrono::time_point Time;
string Guid;
string File;
string Data;
Expand Down
1 change: 1 addition & 0 deletions far/constitle.cpp
Expand Up @@ -35,6 +35,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#pragma hdrstop

#include "constitle.hpp"
#include "platform.security.hpp"
#include "lang.hpp"
#include "config.hpp"
#include "synchro.hpp"
Expand Down
20 changes: 10 additions & 10 deletions far/datetime.cpp
Expand Up @@ -524,7 +524,7 @@ string StrFTime(const wchar_t* Format, const tm* t)

string MkStrFTime(const wchar_t *Format)
{
const auto Time = nt_clock::to_time_t(nt_clock::now());
const auto Time = os::chrono::nt_clock::to_time_t(os::chrono::nt_clock::now());

if (!Format || !*Format)
Format = Global->Opt->Macro.strDateFormat.data();
Expand All @@ -545,7 +545,7 @@ void ParseDateComponents(const string& Src, const range<WORD*>& Dst, wchar_t Sep
});
}

time_point ParseDate(const string& Date, const string& Time, int DateFormat, wchar_t DateSeparator, wchar_t TimeSeparator)
os::chrono::time_point ParseDate(const string& Date, const string& Time, int DateFormat, wchar_t DateSeparator, wchar_t TimeSeparator)
{
WORD DateN[3]{};
ParseDateComponents(Date, make_range(DateN), DateSeparator, 0);
Expand Down Expand Up @@ -591,12 +591,12 @@ time_point ParseDate(const string& Date, const string& Time, int DateFormat, wch
st.wSecond = TimeN[2];
st.wMilliseconds = TimeN[3];

time_point Point;
os::chrono::time_point Point;
Local2Utc(st, Point);
return Point;
}

duration ParseDuration(const string& Date, const string& Time, int DateFormat, wchar_t DateSeparator, wchar_t TimeSeparator)
os::chrono::duration ParseDuration(const string& Date, const string& Time, int DateFormat, wchar_t DateSeparator, wchar_t TimeSeparator)
{
WORD DateN[1]{};
ParseDateComponents(Date, make_range(DateN), DateSeparator, 0);
Expand All @@ -610,7 +610,7 @@ duration ParseDuration(const string& Date, const string& Time, int DateFormat, w
}


void ConvertDate(time_point Point, string& strDateText, string& strTimeText, int TimeLength, int Brief, int TextMonth, int FullYear)
void ConvertDate(os::chrono::time_point Point, string& strDateText, string& strTimeText, int TimeLength, int Brief, int TextMonth, int FullYear)
{
// Epoch => empty
if (!Point.time_since_epoch().count())
Expand Down Expand Up @@ -712,7 +712,7 @@ void ConvertDate(time_point Point, string& strDateText, string& strTimeText, int
}
}

void ConvertDuration(duration Duration, string& strDaysText, string& strTimeText)
void ConvertDuration(os::chrono::duration Duration, string& strDaysText, string& strTimeText)
{
using namespace std::chrono;
using namespace chrono;
Expand All @@ -729,10 +729,10 @@ void ConvertDuration(duration Duration, string& strDaysText, string& strTimeText
LocaleCache().DecimalSeparator());
}

bool Utc2Local(time_point UtcTime, SYSTEMTIME& LocalTime)
bool Utc2Local(os::chrono::time_point UtcTime, SYSTEMTIME& LocalTime)
{
SYSTEMTIME SystemTime;
const auto FileTime = nt_clock::to_filetime(UtcTime);
const auto FileTime = os::chrono::nt_clock::to_filetime(UtcTime);
return FileTimeToSystemTime(&FileTime, &SystemTime) && SystemTimeToTzSpecificLocalTime(nullptr, &SystemTime, &LocalTime);
}

Expand Down Expand Up @@ -775,7 +775,7 @@ static bool local_to_utc(const SYSTEMTIME &lst, SYSTEMTIME &ust)
return SystemTimeToFileTime(&lst, &lft) && LocalFileTimeToFileTime(&lft, &uft) && FileTimeToSystemTime(&uft, &ust);
}

bool Local2Utc(const SYSTEMTIME& LocalTime, time_point& UtcTime)
bool Local2Utc(const SYSTEMTIME& LocalTime, os::chrono::time_point& UtcTime)
{
SYSTEMTIME SystemUtcTime;
if (!local_to_utc(LocalTime, SystemUtcTime))
Expand All @@ -785,6 +785,6 @@ bool Local2Utc(const SYSTEMTIME& LocalTime, time_point& UtcTime)
if (!SystemTimeToFileTime(&SystemUtcTime, &FileUtcTime))
return false;

UtcTime = nt_clock::from_filetime(FileUtcTime);
UtcTime = os::chrono::nt_clock::from_filetime(FileUtcTime);
return true;
}
12 changes: 6 additions & 6 deletions far/datetime.hpp
Expand Up @@ -43,16 +43,16 @@ DWORD ConvertYearToFull(DWORD ShortYear);
void OnIntlSettingsChange();

void ParseDateComponents(const string& Src, const range<WORD*>& Dst, wchar_t Separator, WORD Default = -1);
time_point ParseDate(const string& Date, const string& Time, int DateFormat, wchar_t DateSeparator, wchar_t TimeSeparator);
duration ParseDuration(const string& Date, const string& Time, int DateFormat, wchar_t DateSeparator, wchar_t TimeSeparator);
void ConvertDate(time_point Point, string& strDateText, string& StrTimeText, int TimeLength, int Brief = FALSE, int TextMonth = FALSE, int FullYear = 0);
void ConvertDuration(duration Duration, string& strDaysText, string& strTimeText);
os::chrono::time_point ParseDate(const string& Date, const string& Time, int DateFormat, wchar_t DateSeparator, wchar_t TimeSeparator);
os::chrono::duration ParseDuration(const string& Date, const string& Time, int DateFormat, wchar_t DateSeparator, wchar_t TimeSeparator);
void ConvertDate(os::chrono::time_point Point, string& strDateText, string& StrTimeText, int TimeLength, int Brief = FALSE, int TextMonth = FALSE, int FullYear = 0);
void ConvertDuration(os::chrono::duration Duration, string& strDaysText, string& strTimeText);

string StrFTime(const wchar_t* Format, const tm* t);
string MkStrFTime(const wchar_t* Format = nullptr);

bool Utc2Local(time_point UtcTime, SYSTEMTIME& LocalTime);
bool Local2Utc(const SYSTEMTIME& LocalTime, time_point& UtcTime);
bool Utc2Local(os::chrono::time_point UtcTime, SYSTEMTIME& LocalTime);
bool Local2Utc(const SYSTEMTIME& LocalTime, os::chrono::time_point& UtcTime);

class time_check: noncopyable, public conditional<time_check>
{
Expand Down
4 changes: 2 additions & 2 deletions far/elevation.cpp
Expand Up @@ -34,13 +34,13 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#pragma hdrstop

#include "elevation.hpp"
#include "platform.security.hpp"
#include "config.hpp"
#include "lang.hpp"
#include "dialog.hpp"
#include "farcolor.hpp"
#include "colormix.hpp"
#include "lasterror.hpp"
#include "privilege.hpp"
#include "fileowner.hpp"
#include "imports.hpp"
#include "TaskBar.hpp"
Expand Down Expand Up @@ -216,7 +216,7 @@ static os::handle create_named_pipe(const string& Name)
if (!InitializeSecurityDescriptor(pSD.get(), SECURITY_DESCRIPTOR_REVISION))
return nullptr;

const auto AdminSID = os::make_sid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS);
const auto AdminSID = os::security::make_sid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS);

if (!AdminSID)
return nullptr;
Expand Down
4 changes: 2 additions & 2 deletions far/far.vcxproj
Expand Up @@ -282,6 +282,7 @@ cl /nologo /c /Fo"$(IntDir)%(Filename)_c++.testobj" /TP api_test.c
<ClCompile Include="platform.fs.cpp" />
<ClCompile Include="platform.memory.cpp" />
<ClCompile Include="platform.reg.cpp" />
<ClCompile Include="platform.security.cpp" />
<ClCompile Include="plist.cpp" />
<ClCompile Include="plugapi.cpp" />
<ClCompile Include="PluginA.cpp" />
Expand All @@ -291,7 +292,6 @@ cl /nologo /c /Fo"$(IntDir)%(Filename)_c++.testobj" /TP api_test.c
<ClCompile Include="preservelongname.cpp" />
<ClCompile Include="preservestyle.cpp" />
<ClCompile Include="print.cpp" />
<ClCompile Include="privilege.cpp" />
<ClCompile Include="processname.cpp" />
<ClCompile Include="qview.cpp" />
<ClCompile Include="refreshwindowmanager.cpp" />
Expand Down Expand Up @@ -473,6 +473,7 @@ cl /nologo /c /Fo"$(IntDir)%(Filename)_c++.testobj" /TP api_test.c
<ClInclude Include="platform.fs.hpp" />
<ClInclude Include="platform.memory.hpp" />
<ClInclude Include="platform.reg.hpp" />
<ClInclude Include="platform.security.hpp" />
<ClInclude Include="plclass.hpp" />
<ClInclude Include="plist.hpp" />
<ClInclude Include="plugapi.hpp" />
Expand All @@ -484,7 +485,6 @@ cl /nologo /c /Fo"$(IntDir)%(Filename)_c++.testobj" /TP api_test.c
<ClInclude Include="preservelongname.hpp" />
<ClInclude Include="preservestyle.hpp" />
<ClInclude Include="print.hpp" />
<ClInclude Include="privilege.hpp" />
<ClInclude Include="processname.hpp" />
<ClInclude Include="qview.hpp" />
<ClInclude Include="refreshwindowmanager.hpp" />
Expand Down
12 changes: 6 additions & 6 deletions far/far.vcxproj.filters
Expand Up @@ -290,6 +290,9 @@
<ClCompile Include="platform.reg.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="platform.security.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="plist.cpp">
<Filter>Source Files</Filter>
</ClCompile>
Expand Down Expand Up @@ -317,9 +320,6 @@
<ClCompile Include="print.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="privilege.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="processname.cpp">
<Filter>Source Files</Filter>
</ClCompile>
Expand Down Expand Up @@ -745,6 +745,9 @@
<ClInclude Include="platform.reg.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="platform.security.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="plclass.hpp">
<Filter>Header Files</Filter>
</ClInclude>
Expand Down Expand Up @@ -778,9 +781,6 @@
<ClInclude Include="print.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="privilege.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="processname.hpp">
<Filter>Header Files</Filter>
</ClInclude>
Expand Down
2 changes: 1 addition & 1 deletion far/fileattr.cpp
Expand Up @@ -184,7 +184,7 @@ int ESetFileEncryption(const string& Name, bool State, DWORD FileAttr, int SkipM
}


int ESetFileTime(const string& Name, const time_point* LastWriteTime, const time_point* CreationTime, const time_point* LastAccessTime, const time_point* ChangeTime, DWORD FileAttr, int SkipMode)
int ESetFileTime(const string& Name, const os::chrono::time_point* LastWriteTime, const os::chrono::time_point* CreationTime, const os::chrono::time_point* LastAccessTime, const os::chrono::time_point* ChangeTime, DWORD FileAttr, int SkipMode)
{
if (!LastWriteTime && !CreationTime && !LastAccessTime && !ChangeTime)
return SETATTR_RET_OK;
Expand Down
2 changes: 1 addition & 1 deletion far/fileattr.hpp
Expand Up @@ -47,7 +47,7 @@ int ESetFileAttributes(const string& Name,DWORD Attr,int SkipMode=-1);
int ESetFileCompression(const string& Name,int State,DWORD FileAttr,int SkipMode=-1);
int ESetFileEncryption(const string& Name,bool State,DWORD FileAttr,int SkipMode=-1,int Silent=0);
int ESetFileSparse(const string& Name,bool State,DWORD FileAttr,int SkipMode=-1);
int ESetFileTime(const string& Name, const time_point* LastWriteTime, const time_point* CreationTime, const time_point* LastAccessTime, const time_point* ChangeTime, DWORD FileAttr, int SkipMode=-1);
int ESetFileTime(const string& Name, const os::chrono::time_point* LastWriteTime, const os::chrono::time_point* CreationTime, const os::chrono::time_point* LastAccessTime, const os::chrono::time_point* ChangeTime, DWORD FileAttr, int SkipMode=-1);
int ESetFileOwner(const string& Name, const string& Owner,int SkipMode=-1);
int EDeleteReparsePoint(const string& Name, DWORD FileAttr, int SkipMode=-1);

Expand Down
10 changes: 5 additions & 5 deletions far/filefilter.cpp
Expand Up @@ -586,7 +586,7 @@ void FileFilter::ProcessSelection(VMenu2 *FilterList) const

void FileFilter::UpdateCurrentTime()
{
CurrentTime = nt_clock::now();
CurrentTime = os::chrono::nt_clock::now();
}

bool FileFilter::FileInFilter(const FileListItem* fli,enumFileInFilterType *foundType)
Expand Down Expand Up @@ -797,8 +797,8 @@ void FileFilter::LoadFilter(const HierarchicalConfig* cfg, unsigned long long Ke
}

Item.SetDate(UseDate != 0, static_cast<enumFDateType>(DateType), DateRelative?
filter_dates(duration(DateAfter), duration(DateBefore)) :
filter_dates(time_point(duration(DateAfter)), time_point(duration(DateBefore))));
filter_dates(os::chrono::duration(DateAfter), os::chrono::duration(DateBefore)) :
filter_dates(os::chrono::time_point(os::chrono::duration(DateAfter)), os::chrono::time_point(os::chrono::duration(DateBefore))));

string SizeAbove;
cfg->GetValue(Key, Strings.SizeAbove, SizeAbove);
Expand Down Expand Up @@ -923,7 +923,7 @@ void FileFilter::SaveFilter(HierarchicalConfig *cfg, unsigned long long KeyId, c

Dates.visit(overload
(
[&](duration After, duration Before)
[&](os::chrono::duration After, os::chrono::duration Before)
{
cfg->SetValue(Key, Strings.DateTimeAfter, After.count());
cfg->SetValue(Key, Strings.DateTimeBefore, Before.count());
Expand All @@ -936,7 +936,7 @@ void FileFilter::SaveFilter(HierarchicalConfig *cfg, unsigned long long KeyId, c
// TODO 2018 Q2: remove
cfg->SetValue(Key, L"RelativeDate"_sv, true);
},
[&](time_point After, time_point Before)
[&](os::chrono::time_point After, os::chrono::time_point Before)
{
cfg->SetValue(Key, Strings.DateTimeAfter, After.time_since_epoch().count());
cfg->SetValue(Key, Strings.DateTimeBefore, Before.time_since_epoch().count());
Expand Down
2 changes: 1 addition & 1 deletion far/filefilter.hpp
Expand Up @@ -80,7 +80,7 @@ class FileFilter: noncopyable

Panel *m_HostPanel;
FAR_FILE_FILTER_TYPE m_FilterType;
time_point CurrentTime;
os::chrono::time_point CurrentTime;
};

#endif // FILEFILTER_HPP_DC322D87_FC69_401A_8EF8_9710B11909CB

0 comments on commit 7acf355

Please sign in to comment.