本文整理汇总了C++中scxcorelib::SCXHandle::Append方法的典型用法代码示例。如果您正苦于以下问题:C++ SCXHandle::Append方法的具体用法?C++ SCXHandle::Append怎么用?C++ SCXHandle::Append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scxcorelib::SCXHandle
的用法示例。
在下文中一共展示了SCXHandle::Append方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TestAppend
void TestAppend(void)
{
m_empty->Append(L"some/append\\path/");
m_directory->Append(L"some/append\\path/file");
m_path->Append(L".new.ext");
// Check correct parsing of folder and file name for empy paths,
// folder only paths and paths with bor filename and folders.
#if defined(WIN32)
CPPUNIT_ASSERT(m_empty->GetDirectory() == L"some\\append\\path\\");
CPPUNIT_ASSERT(m_empty->GetFilename() == L"");
CPPUNIT_ASSERT(m_directory->GetDirectory() == L"dir\\some\\append\\path\\");
CPPUNIT_ASSERT(m_directory->GetFilename() == L"file");
CPPUNIT_ASSERT(m_path->GetDirectory() == L"some\\path\\");
CPPUNIT_ASSERT(m_path->GetFilename() == L"file.ext.new.ext");
#else
CPPUNIT_ASSERT(m_empty->GetDirectory() == L"some/append/path/");
CPPUNIT_ASSERT(m_empty->GetFilename() == L"");
CPPUNIT_ASSERT(m_directory->GetDirectory() == L"dir/some/append/path/");
CPPUNIT_ASSERT(m_directory->GetFilename() == L"file");
CPPUNIT_ASSERT(m_path->GetDirectory() == L"some/path/");
CPPUNIT_ASSERT(m_path->GetFilename() == L"file.ext.new.ext");
#endif
// Check for correct exception when folder separators in append string and path
// already has a file name.
SCXUNIT_RESET_ASSERTION();
CPPUNIT_ASSERT_THROW(m_path->Append(L"path/with\\file"), SCXCoreLib::SCXInvalidArgumentException);
SCXUNIT_ASSERTIONS_FAILED(2); // both in append function and in SCXInvalidArgumentException constructor
m_empty->Append(L"/double/");
// Check that any starting folder separators are removed if appending to existing folder.
#if defined(WIN32)
CPPUNIT_ASSERT(m_empty->GetDirectory().find(L"\\\\") == std::wstring::npos);
#else
CPPUNIT_ASSERT(m_empty->GetDirectory().find(L"//") == std::wstring::npos);
#endif
}