AfxMessageBox(msg, MB_ICONSTOP);
return false;
}
- CString sLeft, sRight;
+ String sLeft, sRight;
BOOL bLeftReadOnly = FALSE;
BOOL bRightReadOnly = FALSE;
BOOL bRecursive = FALSE;
sRight = project.GetRight(&bRightReadOnly);
if (project.HasFilter())
{
- String filter = (LPCTSTR)project.GetFilter();
+ String filter = project.GetFilter();
filter = string_trim_ws(filter);
m_globalFileFilter.SetFilter(filter);
}
DWORD dwLeftFlags = FFILEOPEN_NONE;
DWORD dwRightFlags = FFILEOPEN_NONE;
- if (!sLeft.IsEmpty())
+ if (!sLeft.empty())
{
dwLeftFlags = FFILEOPEN_PROJECT;
if (bLeftReadOnly)
dwLeftFlags |= FFILEOPEN_READONLY;
}
- if (!sRight.IsEmpty())
+ if (!sRight.empty())
{
dwRightFlags = FFILEOPEN_PROJECT;
if (bRightReadOnly)
WriteProfileInt(_T("Settings"), _T("Recurse"), bRecursive);
- BOOL rtn = GetMainFrame()->DoFileOpen(sLeft, sRight, dwLeftFlags, dwRightFlags, bRecursive);
+ BOOL rtn = GetMainFrame()->DoFileOpen(sLeft.c_str(), sRight.c_str(),
+ dwLeftFlags, dwRightFlags, bRecursive);
AddToRecentProjectsMRU(sProject);
return !!rtn;
}
else
{
- m_pProjectFile->GetPaths(m_strLeft, m_strRight, m_bRecurse);
+ m_strLeft = m_pProjectFile->GetLeft().c_str();
+ m_strRight = m_pProjectFile->GetRight().c_str();
+ m_bRecurse = m_pProjectFile->GetSubfolders();
if (m_pProjectFile->HasFilter())
{
- m_strExt = m_pProjectFile->GetFilter();
+ m_strExt = m_pProjectFile->GetFilter().c_str();
m_strExt.TrimLeft();
m_strExt.TrimRight();
if (m_strExt[0] != '*')
*
* @brief Implementation file for ProjectFile class.
*/
-// RCS ID line follows -- this is updated by CVS
+// ID line follows -- this is updated by CVS
// $Id$
#include "stdafx.h"
#include <scew/scew.h>
-
+#include "UnicodeString.h"
#include "ProjectFile.h"
#include "Merge.h"
USES_CONVERSION;
scew_element* element = NULL;
- if (!m_leftFile.IsEmpty())
+ if (!m_leftFile.empty())
{
element = scew_element_add(parent, Left_element_name);
String path = m_leftFile;
scew_element_set_contents(element, T2UTF8(EscapeXML(path).c_str()));
}
- if (!m_rightFile.IsEmpty())
+ if (!m_rightFile.empty())
{
element = scew_element_add(parent, Right_element_name);
String path = m_rightFile;
scew_element_set_contents(element, T2UTF8(EscapeXML(path).c_str()));
}
- if (!m_filter.IsEmpty())
+ if (!m_filter.empty())
{
element = scew_element_add(parent, Filter_element_name);
String filter = m_filter;
/**
* @brief Returns left path.
* @param [out] pReadOnly TRUE if readonly was specified for path.
+ * @return Left path.
*/
-CString ProjectFile::GetLeft(BOOL * pReadOnly /*=NULL*/) const
+String ProjectFile::GetLeft(BOOL * pReadOnly /*=NULL*/) const
{
if (pReadOnly)
*pReadOnly = m_bLeftReadOnly;
/**
* @brief Returns if left path is specified read-only.
+ * @return TRUE if left path is read-only, FALSE otherwise.
*/
BOOL ProjectFile::GetLeftReadOnly() const
{
* @param [in] sLeft Left path.
* @param [in] bReadOnly Will path be recorded read-only?
*/
-CString ProjectFile::SetLeft(const CString& sLeft, const BOOL * pReadOnly /*=NULL*/)
+void ProjectFile::SetLeft(const String& sLeft, const BOOL * pReadOnly /*=NULL*/)
{
- CString sLeftOld = GetLeft();
m_leftFile = sLeft;
if (pReadOnly)
m_bLeftReadOnly = *pReadOnly;
-
- return sLeftOld;
}
/**
* @brief Returns right path.
* @param [out] pReadOnly TRUE if readonly was specified for path.
+ * @return Right path.
*/
-CString ProjectFile::GetRight(BOOL * pReadOnly /*=NULL*/) const
+String ProjectFile::GetRight(BOOL * pReadOnly /*=NULL*/) const
{
if (pReadOnly)
*pReadOnly = m_bRightReadOnly;
/**
* @brief Returns if right path is specified read-only.
+ * @return TRUE if right path is read-only, FALSE otherwise.
*/
BOOL ProjectFile::GetRightReadOnly() const
{
* @param [in] sRight Right path.
* @param [in] bReadOnly Will path be recorded read-only?
*/
-CString ProjectFile::SetRight(const CString& sRight, const BOOL * pReadOnly /*=NULL*/)
+void ProjectFile::SetRight(const String& sRight, const BOOL * pReadOnly /*=NULL*/)
{
- CString sRightOld = GetRight();
m_rightFile = sRight;
if (pReadOnly)
m_bRightReadOnly = *pReadOnly;
-
- return sRightOld;
}
/**
* @brief Returns filter.
+ * @return Filter string.
*/
-CString ProjectFile::GetFilter() const
+String ProjectFile::GetFilter() const
{
return m_filter;
}
/**
- * @brief Set filter, returns old filter.
+ * @brief Set filter.
+ * @param [in] sFilter New filter string to set.
*/
-CString ProjectFile::SetFilter(const CString& sFilter)
+void ProjectFile::SetFilter(const String& sFilter)
{
- CString sFilterOld = GetFilter();
m_filter = sFilter;
-
- return sFilterOld;
}
/**
* @brief Returns subfolder included -setting.
+ * @return != 0 if subfolders are included.
*/
int ProjectFile::GetSubfolders() const
{
}
/**
- * @brief set subfolder, returns old subfolder value.
+ * @brief set subfolder.
+ * @param [in] iSubfolder New value for subfolder inclusion.
*/
-int ProjectFile::SetSubfolders(const int iSubfolder)
+void ProjectFile::SetSubfolders(int iSubfolder)
{
- int iSubfoldersOld = GetSubfolders();
m_subfolders = iSubfolder ? 1 : 0;
-
- return iSubfoldersOld;
-}
-
-/**
- * @brief Returns left and right paths and recursive from project file
- *
- * @param [out] sLeft Left path
- * @param [out] sRight Right path
- * @param [out] bSubFolders If TRUE subfolders included (recursive compare)
- */
-void ProjectFile::GetPaths(CString & sLeft, CString & sRight,
- BOOL & bSubfolders) const
-{
- if (HasLeft())
- sLeft = GetLeft();
- if (HasRight())
- sRight = GetRight();
- if (HasSubfolders())
- bSubfolders = (GetSubfolders() == 1);
}
*
* @brief Declaration file ProjectFile class
*/
-// RCS ID line follows -- this is updated by CVS
+// ID line follows -- this is updated by CVS
// $Id$
+#ifndef _PROJECT_FILE_H_
+#define _PROJECT_FILE_H_
+
#include <scew/scew.h>
/** @brief File extension for path files */
BOOL HasFilter() const;
BOOL HasSubfolders() const;
- CString GetLeft(BOOL * pReadOnly = NULL) const;
+ String GetLeft(BOOL * pReadOnly = NULL) const;
BOOL GetLeftReadOnly() const;
- CString GetRight(BOOL * pReadOnly = NULL) const;
+ String GetRight(BOOL * pReadOnly = NULL) const;
BOOL GetRightReadOnly() const;
- CString GetFilter() const;
+ String GetFilter() const;
int GetSubfolders() const;
- CString SetLeft(const CString& sLeft, const BOOL * pReadOnly = NULL);
- CString SetRight(const CString& sRight, const BOOL * pReadOnly = NULL);
- CString SetFilter(const CString& sFilter);
- int SetSubfolders(int iSubfolder);
-
- void GetPaths(CString & sLeft, CString & sRight, BOOL & bSubFolders) const;
+ void SetLeft(const String& sLeft, const BOOL * pReadOnly = NULL);
+ void SetRight(const String& sRight, const BOOL * pReadOnly = NULL);
+ void SetFilter(const String& sFilter);
+ void SetSubfolders(int iSubfolder);
protected:
scew_element* GetRootElement(scew_tree * tree);
private:
BOOL m_bHasLeft; /**< Has left path? */
- CString m_leftFile; /**< Left path */
+ String m_leftFile; /**< Left path */
BOOL m_bHasRight; /**< Has right path? */
- CString m_rightFile; /**< Right path */
+ String m_rightFile; /**< Right path */
BOOL m_bHasFilter; /**< Has filter? */
- CString m_filter; /**< Filter name or mask */
+ String m_filter; /**< Filter name or mask */
BOOL m_bHasSubfolders; /**< Has subfolders? */
int m_subfolders; /**< Are subfolders included (recursive scan) */
BOOL m_bLeftReadOnly; /**< Is left path opened as read-only */
BOOL m_bRightReadOnly; /**< Is right path opened as read-only */
};
+
+#endif // #ifdef _PROJECT_FILE_H_
}
else
{
- m_sLeftFile = project.GetLeft(&m_bLeftPathReadOnly);
- m_sRightFile = project.GetRight(&m_bRightPathReadOnly);
- m_sFilter = project.GetFilter();
+ m_sLeftFile = project.GetLeft(&m_bLeftPathReadOnly).c_str();
+ m_sRightFile = project.GetRight(&m_bRightPathReadOnly).c_str();
+ m_sFilter = project.GetFilter().c_str();
m_bIncludeSubfolders = project.GetSubfolders();
UpdateData(FALSE);
ProjectFile project;
if (!m_sLeftFile.IsEmpty())
- project.SetLeft(m_sLeftFile, &m_bLeftPathReadOnly);
+ project.SetLeft((LPCTSTR)m_sLeftFile, &m_bLeftPathReadOnly);
if (!m_sRightFile.IsEmpty())
- project.SetRight(m_sRightFile, &m_bRightPathReadOnly);
+ project.SetRight((LPCTSTR)m_sRightFile, &m_bRightPathReadOnly);
if (!m_sFilter.IsEmpty())
{
// Remove possbile prefix from the filter name
m_sFilter.Delete(0, prefix.length());
}
m_sFilter.TrimLeft();
- project.SetFilter(m_sFilter);
+ project.SetFilter((LPCTSTR)m_sFilter);
}
project.SetSubfolders(m_bIncludeSubfolders);