Refactor: Move ColumnManager to separate files
[TortoiseGit.git] / src / TortoiseProc / LoglistUtils.h
blob7f9e9549478e73ab87e2f0f1ea60015f5c29dc67
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2012 - TortoiseGit
4 // Copyright (C) 2003-2008 - TortoiseSVN
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software Foundation,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #pragma once
22 /**
23 * \ingroup TortoiseProc
24 * An utility class with static functions for GitLoglist.
26 class CLoglistUtils
28 public:
29 CLoglistUtils(void);
30 ~CLoglistUtils(void);
32 /**
33 * FUNCTION : FormatDateAndTime
34 * DESCRIPTION : Generates a displayable string from a CTime object in
35 * system short or long format or as a relative value
36 * cTime - the time
37 * option - DATE_SHORTDATE or DATE_LONGDATE
38 * bIncluedeTime - whether to show time as well as date
39 * bRelative - if true then relative time is shown if reasonable
40 * If HKCU\Software\TortoiseGit\UseSystemLocaleForDates is 0 then use fixed format
41 * rather than locale
42 * RETURN : CString containing date/time
44 static CString FormatDateAndTime(const CTime& cTime, DWORD option, bool bIncludeTime=true, bool bRelative=false);
45 /**
46 * Converts a given time to a relative display string (relative to current time)
47 * Given time must be in local timezone
49 static CString ToRelativeTimeString(CTime time);
51 private:
52 /**
53 * Generates a display string showing the relative time between the two given times as COleDateTimes
55 static CString ToRelativeTimeString(COleDateTime time, COleDateTime RelativeTo);
56 static CString ExpandRelativeTime(int count, UINT format_1, UINT format_n);