* @param [in] wLangId Language ID.
* @return Language filename, or empty string if no file for language found.
*/
-String CLanguageSelect::GetFileName(LANGID wLangId)
+String CLanguageSelect::GetFileName(LANGID wLangId) const
{
String filename;
String path = env_GetProgPath().append(szRelativePath);
}
-UINT CLanguageSelect::GetDocResId()
+UINT CLanguageSelect::GetDocResId() const
{
if (((CMDIFrameWnd*)AfxGetApp()->m_pMainWnd)->MDIGetActive())
return m_idDocMenu;
void SetModuleHandle(HMODULE hModule) { m_hModule = hModule; }
CLanguageSelect(UINT idMainMenu, UINT idDocMenu, BOOL bReloadMenu =TRUE, BOOL bUpdateTitle =TRUE, CWnd* pParent = NULL); // standard constructor
BOOL AreLangsInstalled() const;
- WORD GetLangId() { return m_wCurLanguage; };
+ WORD GetLangId() const { return m_wCurLanguage; }
void InitializeLanguage();
void UpdateDocTitle();
void ReloadMenu();
unsigned m_codepage;
// Implementation methods
private:
- String GetFileName(LANGID);
+ String GetFileName(LANGID) const;
BOOL LoadLanguageFile(LANGID);
BOOL SetLanguage(LANGID);
- UINT GetDocResId();
+ UINT GetDocResId() const;
void LoadAndDisplayLanguages();
// Dialog Data
CWnd::OnLButtonUp(nFlags, point);
}
-CRect CMDITabBar::GetCloseButtonRect(int nItem)
+CRect CMDITabBar::GetCloseButtonRect(int nItem) const
{
CRect rc;
GetItemRect(nItem, &rc);
return rc;
}
-int CMDITabBar::GetItemIndexFromPoint(CPoint point)
+int CMDITabBar::GetItemIndexFromPoint(CPoint point) const
{
TCHITTESTINFO hit;
hit.pt = point;
DECLARE_MESSAGE_MAP()
private:
- CRect GetCloseButtonRect(int nItem);
- int GetItemIndexFromPoint(CPoint pt);
+ CRect GetCloseButtonRect(int nItem) const;
+ int GetItemIndexFromPoint(CPoint pt) const;
void SwapTabs(int nIndexA, int nIndexB);
};
* @param [out] strValue Value in registry
*/
void CRegOptionsMgr::SplitName(const String &strName, String &strPath,
- String &strValue)
+ String &strValue) const
{
size_t pos = strName.rfind('/');
if (pos != String::npos)
virtual int ImportOptions(const String& filename);
protected:
- void SplitName(const String &strName, String &strPath, String &strValue);
+ void SplitName(const String &strName, String &strPath, String &strValue) const;
int LoadValueFromReg(HKEY hKey, const String& strName,
varprop::VariantValue &value);
int SaveValueToReg(HKEY hKey, const String& strValueName,
* @param [in] side For which file to return statistics.
* @param [out] stats Stats as asked.
*/
-void ByteCompare::GetTextStats(int side, FileTextStats *stats)
+void ByteCompare::GetTextStats(int side, FileTextStats *stats) const
{
CopyTextStats(&m_textStats[side], stats);
}
void SetAbortable(const IAbortable * piAbortable);
void SetFileData(int items, file_data *data);
int CompareFiles(FileLocation *location);
- void GetTextStats(int side, FileTextStats *stats);
+ void GetTextStats(int side, FileTextStats *stats) const;
private:
boost::scoped_ptr<QuickCompareOptions> m_pOptions; /**< Compare options for diffutils. */
* @param [in] FileNo File to match.
* return true if any of the expressions matches.
*/
-bool DiffUtils::RegExpFilter(int StartPos, int EndPos, int FileNo)
+bool DiffUtils::RegExpFilter(int StartPos, int EndPos, int FileNo) const
{
if (m_pFilterList == NULL)
{
* @return TRUE when compare succeeds, FALSE if error happened during compare.
*/
bool DiffUtils::Diff2Files(struct change ** diffs, int depth,
- int * bin_status, bool bMovedBlocks, int * bin_file)
+ int * bin_status, bool bMovedBlocks, int * bin_file) const
{
bool bRet = true;
SE_Handler seh;
* @param [out] diffs Count of real differences.
* @param [out] trivialDiffs Count of ignored differences.
*/
-void DiffUtils::GetDiffCounts(int & diffs, int & trivialDiffs)
+void DiffUtils::GetDiffCounts(int & diffs, int & trivialDiffs) const
{
diffs = m_ndiffs;
trivialDiffs = m_ntrivialdiffs;
* @param [in] side For which file to return statistics.
* @param [out] stats Stats as asked.
*/
-void DiffUtils::GetTextStats(int side, FileTextStats *stats)
+void DiffUtils::GetTextStats(int side, FileTextStats *stats) const
{
CopyTextStats(&m_inf[side], stats);
}
void ClearFilterList();
void SetFileData(int items, file_data *data);
int diffutils_compare_files();
- bool RegExpFilter(int StartPos, int EndPos, int FileNo);
- void GetDiffCounts(int & diffs, int & trivialDiffs);
- void GetTextStats(int side, FileTextStats *stats);
+ bool RegExpFilter(int StartPos, int EndPos, int FileNo) const;
+ void GetDiffCounts(int & diffs, int & trivialDiffs) const;
+ void GetTextStats(int side, FileTextStats *stats) const;
bool Diff2Files(struct change ** diffs, int depth,
- int * bin_status, bool bMovedBlocks, int * bin_file);
+ int * bin_status, bool bMovedBlocks, int * bin_file) const;
void SetCodepage(int codepage) { m_codepage = codepage; }
private:
* @param [in] di Diffitem info.
* @return DIFFCODE
*/
-int TimeSizeCompare::CompareFiles(int compMethod, const DIFFITEM &di)
+int TimeSizeCompare::CompareFiles(int compMethod, const DIFFITEM &di) const
{
unsigned code = DIFFCODE::SAME;
if ((compMethod == CMP_DATE) || (compMethod == CMP_DATE_SIZE))
TimeSizeCompare();
~TimeSizeCompare();
void SetAdditionalOptions(bool ignoreSmallDiff);
- int CompareFiles(int compMethod, const DIFFITEM &di);
+ int CompareFiles(int compMethod, const DIFFITEM &di) const;
private:
bool m_ignoreSmallDiff;
* @brief Gets options to DIFFOPTIONS structure.
* @param [out] options Diffutils options.
*/
-void DiffutilsOptions::GetAsDiffOptions(DIFFOPTIONS &options)
+void DiffutilsOptions::GetAsDiffOptions(DIFFOPTIONS &options) const
{
options.bFilterCommentsLines = m_filterCommentsLines;
options.bIgnoreBlankLines = m_bIgnoreBlankLines;
DiffutilsOptions(const CompareOptions& options);
DiffutilsOptions(const DiffutilsOptions& options);
void SetToDiffUtils();
- void GetAsDiffOptions(DIFFOPTIONS &options);
+ void GetAsDiffOptions(DIFFOPTIONS &options) const;
virtual void SetFromDiffOptions(const DIFFOPTIONS & options);
enum DiffOutputType m_outputStyle; /**< Output style (for patch files) */
* @param [in] diffcode DIFFITEM.diffcode to convert.
* @return Compare result.
*/
-CompareStats::RESULT CompareStats::GetResultFromCode(unsigned diffcode)
+CompareStats::RESULT CompareStats::GetResultFromCode(unsigned diffcode) const
{
DIFFCODE di = diffcode;
CompareStats::CMP_STATE GetCompareState() const;
bool IsCompareDone() const { return m_bCompareDone; }
- CompareStats::RESULT GetResultFromCode(unsigned diffcode);
+ CompareStats::RESULT GetResultFromCode(unsigned diffcode) const;
private:
int m_counts[RESULT_COUNT]; /**< Table storing result counts */
* http://msdn.microsoft.com/en-us/library/ms724833(VS.85).aspx
* @return String describing Windows version.
*/
-String CConfigLog::GetWindowsVer()
+String CConfigLog::GetWindowsVer() const
{
OSVERSIONINFOEX osvi;
String sVersion;
private:
bool DoFile(String &sError);
void WritePluginsInLogFile(const wchar_t *transformationEvent);
- String GetWindowsVer();
+ String GetWindowsVer() const;
String GetBuildFlags() const;
void FileWriteString(const String& lpsz);
void CloseFile();
* format used outside CDiffWrapper and returns them.
* @param [in,out] options Pointer to structure getting used options.
*/
-void CDiffWrapper::GetOptions(DIFFOPTIONS *options)
+void CDiffWrapper::GetOptions(DIFFOPTIONS *options) const
{
assert(options);
DIFFOPTIONS tmpOptions = {0};
{
m_sToFindPrediffer = text;
}
-void CDiffWrapper::SetPrediffer(PrediffingInfo * prediffer /*=NULL*/)
+void CDiffWrapper::SetPrediffer(const PrediffingInfo * prediffer /*=NULL*/)
{
// all flags are set correctly during the construction
m_infoPrediffer.reset(new PrediffingInfo);
if (prediffer)
*m_infoPrediffer = *prediffer;
}
-void CDiffWrapper::GetPrediffer(PrediffingInfo * prediffer)
+void CDiffWrapper::GetPrediffer(PrediffingInfo * prediffer) const
{
*prediffer = *m_infoPrediffer;
}
* @return Returns true if all characters are trivial
*/
bool CDiffWrapper::IsTrivialBytes(const char* Start, const char* End,
- const FilterCommentsSet& filtercommentsset)
+ const FilterCommentsSet& filtercommentsset) const
{
std::string testdata(Start, End);
//@TODO: Need to replace the following trivial string with a user specified string
const char * StartOfComment,
const char * EndOfComment,
const char * InLineComment,
- const FilterCommentsSet& filtercommentsset)
+ const FilterCommentsSet& filtercommentsset) const
{
//Do easy test first
if ((!StartOfComment || !EndOfComment) && !InLineComment)
*/
bool CDiffWrapper::PostFilter(int StartPos, int EndPos, int Direction,
int QtyLinesInBlock, OP_TYPE &Op, int FileNo,
- FilterCommentsSet& filtercommentsset)
+ FilterCommentsSet& filtercommentsset) const
{
if (Op == OP_TRIVIAL) //If already set to trivial, then exit.
return true;
*/
void CDiffWrapper::PostFilter(int LineNumberLeft, int QtyLinesLeft, int LineNumberRight,
int QtyLinesRight, OP_TYPE &Op, FilterCommentsManager &filtercommentsmanager,
- const String& FileNameExt)
+ const String& FileNameExt) const
{
if (Op == OP_TRIVIAL)
return;
/**
* @brief Returns status-data from diff-engine last run
*/
-void CDiffWrapper::GetDiffStatus(DIFFSTATUS *status)
+void CDiffWrapper::GetDiffStatus(DIFFSTATUS *status) const
{
std::memcpy(status, &m_status, sizeof(DIFFSTATUS));
}
/**
* @brief Formats command-line for diff-engine last run (like it was called from command-line)
*/
-String CDiffWrapper::FormatSwitchString()
+String CDiffWrapper::FormatSwitchString() const
{
String switches;
TCHAR tmpNum[5] = {0};
* folder compare function is in DiffFileData.cpp.
*/
bool CDiffWrapper::Diff2Files(struct change ** diffs, DiffFileData *diffData,
- int * bin_status, int * bin_file)
+ int * bin_status, int * bin_file) const
{
bool bRet = true;
SE_Handler seh;
* @param [in] FileNo File to match.
* return true if any of the expressions matches.
*/
-bool CDiffWrapper::RegExpFilter(int StartPos, int EndPos, int FileNo)
+bool CDiffWrapper::RegExpFilter(int StartPos, int EndPos, int FileNo) const
{
if (m_pFilterList == NULL)
{
void SetCreatePatchFile(const String &filename);
void SetCreateDiffList(DiffList *diffList);
void SetDiffList(DiffList *diffList);
- void GetOptions(DIFFOPTIONS *options);
+ void GetOptions(DIFFOPTIONS *options) const;
void SetOptions(const DIFFOPTIONS *options);
void SetTextForAutomaticPrediff(const String &text);
- void SetPrediffer(PrediffingInfo * prediffer =NULL);
- void GetPrediffer(PrediffingInfo * prediffer);
+ void SetPrediffer(const PrediffingInfo * prediffer =NULL);
+ void GetPrediffer(PrediffingInfo * prediffer) const;
void SetPatchOptions(const PATCHOPTIONS *options);
void SetDetectMovedBlocks(bool bDetectMovedBlocks);
- bool GetDetectMovedBlocks() { return (m_pMovedLines[0] != NULL); }
+ bool GetDetectMovedBlocks() const { return (m_pMovedLines[0] != NULL); }
void SetAppendFiles(bool bAppendFiles);
void SetPaths(const PathContext &files, bool tempPaths);
void SetAlternativePaths(const PathContext &altPaths);
void SetCodepage(int codepage) { m_codepage = codepage; }
bool RunFileDiff();
- void GetDiffStatus(DIFFSTATUS *status);
+ void GetDiffStatus(DIFFSTATUS *status) const;
void AddDiffRange(DiffList *pDiffList, unsigned begin0, unsigned end0, unsigned begin1, unsigned end1, OP_TYPE op);
void AddDiffRange(DiffList *pDiffList, DIFFRANGE &dr);
void FixLastDiffRange(int nFiles, int bufferLines[], bool bMissingNL[], bool bIgnoreBlankLines);
void SetFilterList(const String& filterStr);
void EnablePlugins(bool enable);
bool IsTrivialBytes(const char* Start, const char* End,
- const FilterCommentsSet& filtercommentsset);
+ const FilterCommentsSet& filtercommentsset) const;
bool IsTrivialLine(const std::string &Line, const char * StartOfComment,
const char * EndOfComment, const char * InLineComment,
- const FilterCommentsSet& filtercommentsset);
+ const FilterCommentsSet& filtercommentsset) const;
bool PostFilter(int StartPos, int EndPos, int Direction,
int QtyLinesInBlock, OP_TYPE &Op, int FileNo,
- FilterCommentsSet& filtercommentsset);
+ FilterCommentsSet& filtercommentsset) const;
void PostFilter(int LineNumberLeft, int QtyLinesLeft, int LineNumberRight,
int QtyLinesRight, OP_TYPE &Op, FilterCommentsManager &filtercommentsmanager,
- const String& FileNameExt);
+ const String& FileNameExt) const;
protected:
- String FormatSwitchString();
+ String FormatSwitchString() const;
bool Diff2Files(struct change ** diffs, DiffFileData *diffData,
- int * bin_status, int * bin_file);
+ int * bin_status, int * bin_file) const;
void LoadWinMergeDiffsFromDiffUtilsScript(struct change * script, const file_data * inf);
void WritePatchFile(struct change * script, file_data * inf);
public:
struct change * script10, struct change * script12,
const file_data * inf10, const file_data * inf12);
void FreeDiffUtilsScript3(struct change * & script10, struct change * & script12);
- bool RegExpFilter(int StartPos, int EndPos, int FileNo);
+ bool RegExpFilter(int StartPos, int EndPos, int FileNo) const;
private:
DiffutilsOptions m_options;
* @return TRUE if item should be shown, FALSE if not.
* @sa CDirDoc::Redisplay()
*/
-bool CDirDoc::IsShowable(const DIFFITEM & di)
+bool CDirDoc::IsShowable(const DIFFITEM & di) const
{
if (di.customFlags1 & ViewCustomFlags::HIDDEN)
return FALSE;
m_pDirView->Redisplay();
}
-CDirView * CDirDoc::GetMainView()
+CDirView * CDirDoc::GetMainView() const
{
CDirView *pView = NULL;
if (POSITION pos = GetFirstViewPosition())
* @brief Checks if current folders are opened from archive file.
* @return true if we are inside archive, false otherwise.
*/
-bool CDirDoc::IsArchiveFolders()
+bool CDirDoc::IsArchiveFolders() const
{
if (m_pTempPathContext)
return true;
// Operations
public:
BOOL CloseMergeDocs();
- CDirView * GetMainView();
+ CDirView * GetMainView() const;
CMergeDoc * GetMergeDocForDiff(int nFiles, BOOL * pNew);
CHexMergeDoc * GetHexMergeDocForDiff(int nFiles, BOOL * pNew);
BOOL ReusingDirDoc();
void SetPluginPrediffer(const String& filteredFilenames, const String & prediffer);
void FetchPluginInfos(const String& filteredFilenames,
PackingInfo ** infoUnpacker, PrediffingInfo ** infoPrediffer);
- bool IsShowable(const DIFFITEM & di);
+ bool IsShowable(const DIFFITEM & di) const;
bool HasDiffs() const { return m_pCtxt != NULL; }
const CDiffContext & GetDiffContext() const { return *m_pCtxt; }
void SetItemViewFlag(Poco::UIntPtr key, UINT flag, UINT mask);
void SetItemViewFlag(UINT flag, UINT mask);
const CompareStats * GetCompareStats() const { return m_pCompareStats.get(); };
- bool IsArchiveFolders();
+ bool IsArchiveFolders() const;
protected:
void LoadLineFilterList();
/**
* @brief true while user is editing a file name.
*/
-bool CDirView::IsLabelEdit()
+bool CDirView::IsLabelEdit() const
{
return (NULL != m_pList->GetEditControl());
}
/**
* @brief true if selected item is a "special item".
*/
-bool CDirView::IsItemSelectedSpecial()
+bool CDirView::IsItemSelectedSpecial() const
{
int nSelItem = m_pList->GetNextItem(-1, LVNI_SELECTED);
ASSERT(-1 != nSelItem);
/**
* @brief Populate colors for items in view, depending on difference status
*/
-void CDirView::GetColors (int nRow, int nCol, COLORREF& clrBk, COLORREF& clrText)
+void CDirView::GetColors (int nRow, int nCol, COLORREF& clrBk, COLORREF& clrText) const
{
const DIFFITEM& di = GetDiffItem (nRow);
CShellContextMenu* GetCorrespondingShellContextMenu(HMENU hMenu) const;
void ReloadColumns();
void ResetColumnWidths();
- bool IsLabelEdit();
- bool IsItemSelectedSpecial();
+ bool IsLabelEdit() const;
+ bool IsItemSelectedSpecial() const;
void CollapseSubdir(int sel);
void ExpandSubdir(int sel, bool bRecursive = false);
- void GetColors(int nRow, int nCol, COLORREF& clrBk, COLORREF& clrText);
+ void GetColors(int nRow, int nCol, COLORREF& clrBk, COLORREF& clrText) const;
DirViewTreeState *SaveTreeState();
void RestoreTreeState(DirViewTreeState *pTreeState);
void PrepareDragData(String& filesForDroping);
* @param [in] szFileName Filename to test.
* @return true unless we're suppressing this file by filter
*/
-bool FileFilterHelper::includeFile(const String& szFileName)
+bool FileFilterHelper::includeFile(const String& szFileName) const
{
if (m_bUseMask)
{
* @param [in] szFileName Directoryname to test.
* @return true unless we're suppressing this directory by filter
*/
-bool FileFilterHelper::includeDir(const String& szDirName)
+bool FileFilterHelper::includeDir(const String& szDirName) const
{
if (m_bUseMask)
{
class IDiffFilter
{
public:
- virtual bool includeFile(const String& szFileName) = 0;
- virtual bool includeDir(const String& szDirName) = 0;
- bool includeFile(const String& szFileName1, const String& szFileName2)
+ virtual bool includeFile(const String& szFileName) const = 0;
+ virtual bool includeDir(const String& szDirName) const = 0;
+ bool includeFile(const String& szFileName1, const String& szFileName2) const
{
if (!szFileName1.empty())
return includeFile(szFileName1);
else
return false;
}
- bool includeFile(const String& szFileName1, const String& szFileName2, const String& szFileName3)
+ bool includeFile(const String& szFileName1, const String& szFileName2, const String& szFileName3) const
{
if (!szFileName1.empty())
return includeFile(szFileName1);
else
return false;
}
- bool includeDir(const String& szDirName1, const String& szDirName2)
+ bool includeDir(const String& szDirName1, const String& szDirName2) const
{
if (!szDirName1.empty())
return includeDir(szDirName1);
else
return false;
}
- bool includeDir(const String& szDirName1, const String& szDirName2, const String& szDirName3)
+ bool includeDir(const String& szDirName1, const String& szDirName2, const String& szDirName3) const
{
if (!szDirName1.empty())
return includeDir(szDirName1);
String GetFilterNameOrMask() const;
bool SetFilter(const String &filter);
- bool includeFile(const String& szFileName);
- bool includeDir(const String& szDirName);
+ bool includeFile(const String& szFileName) const;
+ bool includeDir(const String& szDirName) const;
protected:
String ParseExtensions(const String &extensions) const;
* @return File version number as a string. Returns empty string if there is
* no version number for the file.
*/
-String FileVersion::GetFileVersionString()
+String FileVersion::GetFileVersionString() const
{
if (m_fileVersionMS == 0xffffffff && m_fileVersionLS >= 0xfffffffe)
return _T("");
bool IsCleared() const { return m_fileVersionMS == 0xffffffff && m_fileVersionLS == 0xffffffff; };
void SetFileVersion(unsigned versionMS, unsigned versionLS);
void SetFileVersionNone() { m_fileVersionMS = 0xffffffff; m_fileVersionLS = 0xfffffffe; };
- String GetFileVersionString();
+ String GetFileVersionString() const;
};
#endif // _FILE_VERSION_H_
* @brief Returns if list has any expressions.
* @return true if list contains one or more expressions.
*/
-bool FilterList::HasRegExps()
+bool FilterList::HasRegExps() const
{
return !m_list.empty();
}
* This function returns the regular expression string that matched last.
* @return Last matched expression, or NULL in case no matches yet.
*/
-const char * FilterList::GetLastMatchExpression()
+const char * FilterList::GetLastMatchExpression() const
{
return m_lastMatchExpression->c_str();
}
void AddRegExp(const std::string& regularExpression);
void RemoveAllFilters();
- bool HasRegExps();
+ bool HasRegExps() const;
bool Match(const std::string& string, int codepage = CP_UTF8);
- const char * GetLastMatchExpression();
+ const char * GetLastMatchExpression() const;
private:
std::vector <filter_item_ptr> m_list;
/**
* @brief Load files and initialize frame's compare result icon
*/
-HRESULT CHexMergeDoc::OpenDocs(const PathContext &paths, bool bRO[])
+HRESULT CHexMergeDoc::OpenDocs(const PathContext &paths, const bool bRO[])
{
CHexMergeFrame *pf = GetParentFrame();
ASSERT(pf);
BOOL CloseNow();
CHexMergeFrame * GetParentFrame() const;
void UpdateHeaderPath(int pane);
- HRESULT OpenDocs(const PathContext &paths, bool bRO[]);
+ HRESULT OpenDocs(const PathContext &paths, const bool bRO[]);
void CheckFileChanged(void);
private:
static void CopySel(CHexMergeView *pViewSrc, CHexMergeView *pViewDst);
int CMainFrame::ShowAutoMergeDoc(CDirDoc * pDirDoc,
int nFiles, const FileLocation ifileloc[],
- DWORD dwFlags[] /*=0*/, PackingInfo * infoUnpacker /*= NULL*/)
+ const DWORD dwFlags[] /*=0*/, const PackingInfo * infoUnpacker /*= NULL*/)
{
int pane;
FileFilterHelper filter;
*/
int CMainFrame::ShowMergeDoc(CDirDoc * pDirDoc,
int nFiles, const FileLocation ifileloc[],
- DWORD dwFlags[] /*=0*/, PackingInfo * infoUnpacker /*= NULL*/)
+ const DWORD dwFlags[] /*=0*/, const PackingInfo * infoUnpacker /*= NULL*/)
{
BOOL docNull;
if (!m_pMenus[MENU_MERGEVIEW])
}
void CMainFrame::ShowHexMergeDoc(CDirDoc * pDirDoc,
- const PathContext &paths, bool bRO[])
+ const PathContext &paths, const bool bRO[])
{
BOOL docNull;
if (!m_pMenus[MENU_HEXMERGEVIEW])
}
int CMainFrame::ShowImgMergeDoc(CDirDoc * pDirDoc, int nFiles, const FileLocation fileloc[],
- DWORD dwFlags[], PackingInfo * infoUnpacker/* = NULL*/)
+ const DWORD dwFlags[], const PackingInfo * infoUnpacker/* = NULL*/)
{
CImgMergeFrame *pImgMergeFrame = new CImgMergeFrame();
if (!CImgMergeFrame::menu.m_hMenu)
* @param [in] prediffer Prediffer plugin name.
* @return TRUE if opening files and compare succeeded, FALSE otherwise.
*/
-BOOL CMainFrame::DoFileOpen(PathContext * pFiles /*=NULL*/,
- DWORD dwFlags[] /*=0*/, bool bRecurse /*=FALSE*/, CDirDoc *pDirDoc/*=NULL*/,
- String prediffer /*=_T("")*/, PackingInfo *infoUnpacker/*=NULL*/)
+BOOL CMainFrame::DoFileOpen(const PathContext * pFiles /*=NULL*/,
+ const DWORD dwFlags[] /*=0*/, bool bRecurse /*=FALSE*/, CDirDoc *pDirDoc/*=NULL*/,
+ String prediffer /*=_T("")*/, const PackingInfo *infoUnpacker/*=NULL*/)
{
if (pDirDoc && !pDirDoc->CloseMergeDocs())
return FALSE;
HMENU GetPrediffersSubmenu(HMENU mainMenu);
void UpdatePrediffersMenu();
- BOOL DoFileOpen(PathContext *pFiles = NULL,
- DWORD dwFlags[] = NULL, bool bRecurse = false, CDirDoc *pDirDoc = NULL, String prediffer = _T(""), PackingInfo * infoUnpacker = NULL);
+ BOOL DoFileOpen(const PathContext *pFiles = NULL,
+ const DWORD dwFlags[] = NULL, bool bRecurse = false, CDirDoc *pDirDoc = NULL, String prediffer = _T(""), const PackingInfo * infoUnpacker = NULL);
int ShowAutoMergeDoc(CDirDoc * pDirDoc, int nFiles, const FileLocation fileloc[],
- DWORD dwFlags[], PackingInfo * infoUnpacker = NULL);
+ const DWORD dwFlags[], const PackingInfo * infoUnpacker = NULL);
int ShowMergeDoc(CDirDoc * pDirDoc, int nFiles, const FileLocation fileloc[],
- DWORD dwFlags[], PackingInfo * infoUnpacker = NULL);
+ const DWORD dwFlags[], const PackingInfo * infoUnpacker = NULL);
void ShowHexMergeDoc(CDirDoc * pDirDoc,
- const PathContext &paths, bool bRO[]);
+ const PathContext &paths, const bool bRO[]);
int ShowImgMergeDoc(CDirDoc * pDirDoc, int nFiles, const FileLocation fileloc[],
- DWORD dwFlags[], PackingInfo * infoUnpacker = NULL);
+ const DWORD dwFlags[], const PackingInfo * infoUnpacker = NULL);
void UpdateResources();
CString SetStatus(LPCTSTR status);
* @brief Get default editor path.
* @return full path to the editor program executable.
*/
-String CMergeApp::GetDefaultEditor()
+String CMergeApp::GetDefaultEditor() const
{
String path = env_GetWindowsDirectory();
path += _T("\\NOTEPAD.EXE");
* not exist.
* @return Default folder for user filters.
*/
-String CMergeApp::GetDefaultFilterUserPath(BOOL bCreate /*=FALSE*/)
+String CMergeApp::GetDefaultFilterUserPath(BOOL bCreate /*=FALSE*/) const
{
String pathMyFolders = env_GetMyDocuments();
String pathFilters(pathMyFolders);
void AddToRecentProjectsMRU(LPCTSTR sPathName);
void SetNeedIdleTimer();
void SetLastCompareResult(int nResult) { m_nLastCompareResult = nResult; }
- String GetDefaultEditor();
- String GetDefaultFilterUserPath(BOOL bCreate = FALSE);
+ String GetDefaultEditor() const;
+ String GetDefaultFilterUserPath(BOOL bCreate = FALSE) const;
COptionsMgr * GetMergeOptionsMgr() { return static_cast<COptionsMgr *> (m_pOptions.get()); }
FileFilterHelper * GetGlobalFileFilter() { return m_pGlobalFileFilter.get(); }
return pMergeEditView;
}
-void CMergeDoc::SetUnpacker(PackingInfo * infoNewHandler)
+void CMergeDoc::SetUnpacker(const PackingInfo * infoNewHandler)
{
if (infoNewHandler)
{
}
}
-void CMergeDoc::SetPrediffer(PrediffingInfo * infoPrediffer)
+void CMergeDoc::SetPrediffer(const PrediffingInfo * infoPrediffer)
{
m_diffWrapper.SetPrediffer(infoPrediffer);
}
// Return file extension either from file name or file description (if WinMerge is used as an
// external Rational ClearCase tool.
-String CMergeDoc::GetFileExt(LPCTSTR sFileName, LPCTSTR sDescription)
+String CMergeDoc::GetFileExt(LPCTSTR sFileName, LPCTSTR sDescription) const
{
String sExt;
paths_SplitFilename(sFileName, NULL, NULL, &sExt);
void SetEditedAfterRescan(int nBuffer);
bool IsEditedAfterRescan(int nBuffer) { return m_bEditAfterRescan[nBuffer]; }
- void SetUnpacker(PackingInfo * infoUnpacker);
- void SetPrediffer(PrediffingInfo * infoPrediffer);
+ void SetUnpacker(const PackingInfo * infoUnpacker);
+ void SetPrediffer(const PrediffingInfo * infoPrediffer);
void GetPrediffer(PrediffingInfo * infoPrediffer);
void SetMergeViews(CMergeEditView * pView[]);
void SetMergeDetailViews(CMergeEditView * pView[]);
std::vector<CMergeEditView*>::iterator curUndo;
void FlushAndRescan(bool bForced = false);
void SetCurrentDiff(int nDiff);
- int GetCurrentDiff() { return m_nCurDiff; }
+ int GetCurrentDiff() const { return m_nCurDiff; }
virtual ~CMergeDoc();
virtual void OnFileEvent (WPARAM wEvent, LPCTSTR pszPathName);
void SetDetectMovedBlocks(bool bDetectMovedBlocks);
void AdjustDiffBlock(DiffMap & diffmap, const DIFFRANGE & diffrange, int lo0, int hi0, int lo1, int hi1);
int GetMatchCost(const String &Line0, const String &Line1);
void FlagMovedLines();
- String GetFileExt(LPCTSTR sFileName, LPCTSTR sDescription);
+ String GetFileExt(LPCTSTR sFileName, LPCTSTR sDescription) const;
void DoFileSave(int pane);
};
* @sa CMergeDoc::GetCurrentDiff()
* @sa CMergeDoc::LineInDiff()
*/
-bool CMergeEditView::IsLineInCurrentDiff(int nLine)
+bool CMergeEditView::IsLineInCurrentDiff(int nLine) const
{
// Check validity of nLine
#ifdef _DEBUG
_RPTF2(_CRT_ERROR, "Linenumber > linecount (%d>%d)!", nLine, nLineCount);
#endif
- CMergeDoc *pd = GetDocument();
+ const CMergeDoc *pd = GetDocument();
int curDiff = pd->GetCurrentDiff();
if (curDiff == -1)
return false;
* @brief Returns if buffer is read-only
* @note This has no any relation to file being read-only!
*/
-bool CMergeEditView::IsReadOnly(int pane)
+bool CMergeEditView::IsReadOnly(int pane) const
{
return GetDocument()->m_ptBuf[pane]->GetReadOnly() != false;
}
*/
bool CMergeEditView::IsDiffVisible(int nDiff)
{
- CMergeDoc *pd = GetDocument();
+ const CMergeDoc *pd = GetDocument();
DIFFRANGE diff;
pd->m_diffList.GetDiff(nDiff, diff);
public:
void RefreshOptions();
bool EnableRescan(bool bEnable);
- bool IsReadOnly(int pane);
+ bool IsReadOnly(int pane) const;
void ShowDiff(bool bScroll, bool bSelectText);
virtual void OnEditOperation(int nAction, LPCTSTR pszText, int cchText);
void UpdateLineLengths();
- bool IsLineInCurrentDiff(int nLine);
+ bool IsLineInCurrentDiff(int nLine) const;
void SelectNone();
void SelectDiff(int nDiff, bool bScroll = true, bool bSelectText = true);
virtual CCrystalTextBuffer *LocateTextBuffer ();
, COLORREF & crBkgnd, COLORREF & crText, bool & bDrawWhitespace);
void WMGoto() { OnWMGoto(); };
void GotoLine(UINT nLine, bool bRealLine, int pane);
- int GetTopLine() { return m_nTopLine; }
+ int GetTopLine() const { return m_nTopLine; }
int GetScreenLines() { return CCrystalTextView::GetScreenLines(); }
- int GetTopSubLine() { return m_nTopSubLine; }
+ int GetTopSubLine() const { return m_nTopSubLine; }
int GetSubLines(int nLineIndex) { return CCrystalTextView::GetSubLines(nLineIndex); }
virtual int GetSubLineCount() { return CCrystalTextView::GetSubLineCount(); }
virtual int GetSubLineIndex(int nLineIndex) { return CCrystalTextView::GetSubLineIndex(nLineIndex); }
* @param [in] line Linenumber to check.
* @param [in] side Side of the linenumber.
*/
-int MovedLines::LineInBlock(unsigned line, ML_SIDE side)
+int MovedLines::LineInBlock(unsigned line, ML_SIDE side) const
{
if (side == SIDE_LEFT)
return SecondSideInMovedBlock(line);
/**
* @brief Get right->left info for a moved line (real line number)
*/
-int MovedLines::FirstSideInMovedBlock(unsigned secondSideLine)
+int MovedLines::FirstSideInMovedBlock(unsigned secondSideLine) const
{
MovedLinesMap::const_iterator iter;
iter = m_moved1.find(secondSideLine);
/**
* @brief Get left->right info for a moved line (real line number)
*/
-int MovedLines::SecondSideInMovedBlock(unsigned firstSideLine)
+int MovedLines::SecondSideInMovedBlock(unsigned firstSideLine) const
{
MovedLinesMap::const_iterator iter;
iter = m_moved0.find(firstSideLine);
void Clear();
void Add(ML_SIDE side1, unsigned line1, unsigned line2);
- int LineInBlock(unsigned line, ML_SIDE side);
+ int LineInBlock(unsigned line, ML_SIDE side) const;
protected:
- int FirstSideInMovedBlock(unsigned secondSideLine);
- int SecondSideInMovedBlock(unsigned firstSideLine);
+ int FirstSideInMovedBlock(unsigned secondSideLine) const;
+ int SecondSideInMovedBlock(unsigned firstSideLine) const;
private:
typedef std::map<int, int> MovedLinesMap;
}
-bool PluginInfo::TestAgainstRegList(const String& szTest)
+bool PluginInfo::TestAgainstRegList(const String& szTest) const
{
if (m_filters.empty() || szTest.empty())
return false;
*
* @param szTest String of filenames, delimited with '|'
*/
- bool TestAgainstRegList(const String& szTest);
+ bool TestAgainstRegList(const String& szTest) const;
public:
String m_filepath;
#include "MergeApp.h"
#include "resource.h"
-String VSSHelper::GetProjectBase()
+String VSSHelper::GetProjectBase() const
{
return m_strVssProjectBase;
}
* @param [in] charset pointer to string containing delimiter chars
*/
bool VSSHelper::GetWordFromFile(HANDLE pfile, TCHAR * buffer,
- DWORD dwBufferSize, TCHAR * charset)
+ DWORD dwBufferSize, TCHAR * charset) const
{
TCHAR buf[1024] = {0};
const DWORD bytesToRead = sizeof(buf);
}
int VSSHelper::GetWordFromBuffer(TCHAR *inBuffer, DWORD dwInBufferSize,
- TCHAR * outBuffer, DWORD dwOutBufferSize, TCHAR * charset)
+ TCHAR * outBuffer, DWORD dwOutBufferSize, TCHAR * charset) const
{
TCHAR ctemp = '\0';
TCHAR * pcharset = NULL;
return buffercount;
}
-bool VSSHelper::GetVCProjName(HANDLE hFile, HANDLE tFile)
+bool VSSHelper::GetVCProjName(HANDLE hFile, HANDLE tFile) const
{
TCHAR buffer[1024] = {0};
DWORD dwNumWritten = 0;
return true;
}
-bool VSSHelper::GetSLNProjUniqueName(HANDLE hFile, HANDLE tFile, TCHAR * buf)
+bool VSSHelper::GetSLNProjUniqueName(HANDLE hFile, HANDLE tFile, TCHAR * buf) const
{
TCHAR buffer[1024] = {0};
DWORD dwNumWritten = 0;
return true;
}
-bool VSSHelper::GetSLNProjName(HANDLE hFile, HANDLE tFile, TCHAR * buf)
+bool VSSHelper::GetSLNProjName(HANDLE hFile, HANDLE tFile, TCHAR * buf) const
{
TCHAR buffer[1024] = {0};
DWORD dwNumWritten = 0;
class VSSHelper
{
public:
- String GetProjectBase();
+ String GetProjectBase() const;
bool SetProjectBase(const String& strPath);
bool ReLinkVCProj(const String& strSavePath, String& sError);
void GetFullVSSPath(const String& strSavePath, bool & bVCProj);
protected:
- bool GetWordFromFile(HANDLE pfile, TCHAR * buffer, DWORD dwBufferSize, TCHAR * charset = NULL);
+ bool GetWordFromFile(HANDLE pfile, TCHAR * buffer, DWORD dwBufferSize, TCHAR * charset = NULL) const;
int GetWordFromBuffer(TCHAR * inBuffer, DWORD dwInBufferSize,
- TCHAR * outBuffer, DWORD dwOutBufferSize, TCHAR * charset = NULL);
- bool GetVCProjName(HANDLE hFile, HANDLE tFile);
- bool GetSLNProjUniqueName(HANDLE hFile, HANDLE tFile, TCHAR * buf);
- bool GetSLNProjName(HANDLE hFile, HANDLE tFile, TCHAR * buf);
+ TCHAR * outBuffer, DWORD dwOutBufferSize, TCHAR * charset = NULL) const;
+ bool GetVCProjName(HANDLE hFile, HANDLE tFile) const;
+ bool GetSLNProjUniqueName(HANDLE hFile, HANDLE tFile, TCHAR * buf) const;
+ bool GetSLNProjName(HANDLE hFile, HANDLE tFile, TCHAR * buf) const;
private:
String m_strVssProjectBase;
);
}
-int CMarkdown::FindTag(const char *tags, const char *markup)
+int CMarkdown::FindTag(const char *tags, const char *markup) const
{
while (int len = strlen(tags))
{
return false;
}
-std::string CMarkdown::GetTagName()
+std::string CMarkdown::GetTagName() const
{
const char *p = first;
const char *q = first;
return std::string(p, q - p);
}
-std::string CMarkdown::GetTagText()
+std::string CMarkdown::GetTagText() const
{
const char *p = first, *q = first;
if (q < ahead && (p = ++q) < ahead && (*q != '!' || ++q < ahead))
bool Pull(); // pull child nodes into view
CMarkdown &Pop(); // irreversible pull for chained calls
bool Push(); // reverse pull
- std::string GetTagName(); // tag name
- std::string GetTagText(); // tag name plus attributes
+ std::string GetTagName() const; // tag name
+ std::string GetTagText() const; // tag name plus attributes
std::string GetInnerText(); // text between enclosing tags
std::string GetOuterText(); // text including enclosing tags
std::string GetAttribute(const char *, std::string * = 0); // random or enumerate
private:
int (*const memcmp)(const void *, const void *, size_t);
const char *const utags;
- int FindTag(const char *, const char *);
+ int FindTag(const char *, const char *) const;
class Token;
};