当前位置: 首页>>代码示例>>C++>>正文


C++ SCXHandle::GetDirectory方法代码示例

本文整理汇总了C++中scxcorelib::SCXHandle::GetDirectory方法的典型用法代码示例。如果您正苦于以下问题:C++ SCXHandle::GetDirectory方法的具体用法?C++ SCXHandle::GetDirectory怎么用?C++ SCXHandle::GetDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在scxcorelib::SCXHandle的用法示例。


在下文中一共展示了SCXHandle::GetDirectory方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TestSetFilename

    void TestSetFilename(void)
    {
        // Check that only file name is changed.
        m_path->SetFilename(L"new.file");
#if defined(WIN32)
        CPPUNIT_ASSERT(m_path->Get() == L"some\\path\\new.file");
#else
        CPPUNIT_ASSERT(m_path->Get() == L"some/path/new.file");
#endif
        m_path->SetFilename(L"");
        // Check that empty filename removes filename...
        CPPUNIT_ASSERT(m_path->GetFilename() == L"");
        // ...but not directory
#if defined(WIN32)
        CPPUNIT_ASSERT(m_path->GetDirectory() == L"some\\path\\");
#else
        CPPUNIT_ASSERT(m_path->GetDirectory() == L"some/path/");
#endif

        // Check correct exception thrown when adding folder separators in file name.
        SCXUNIT_RESET_ASSERTION();
        CPPUNIT_ASSERT_THROW(m_path->SetFilename(L"not/valid"), SCXCoreLib::SCXInvalidArgumentException);
        SCXUNIT_ASSERTIONS_FAILED(2); // both in append function and in SCXInvalidArgumentException constructor
        CPPUNIT_ASSERT_THROW(m_path->SetFilename(L"not\\valid"), SCXCoreLib::SCXInvalidArgumentException);
        SCXUNIT_ASSERTIONS_FAILED(2); // both in append function and in SCXInvalidArgumentException constructor
    }
开发者ID:Microsoft,项目名称:pal,代码行数:26,代码来源:scxfilepath_test.cpp

示例2: TestSetFileSuffix

    void TestSetFileSuffix(void)
    {
        m_directory->SetFilesuffix(L"new");
        m_file->SetFilesuffix(L"new");
        m_path->SetFilesuffix(L"new");

        // Check no suffix added when file name is empty.
        CPPUNIT_ASSERT(m_directory->GetFilename() == L"");
        // Check file name is changed.
        CPPUNIT_ASSERT(m_file->GetFilename() == L"file.new");
        // Check file suffix is added.
        CPPUNIT_ASSERT(m_path->GetFilename() == L"file.new");
        // Make sure original directories are preserved.
#if defined(WIN32)
        CPPUNIT_ASSERT(m_directory->GetDirectory() == L"dir\\");
        CPPUNIT_ASSERT(m_file->GetDirectory() == L"");
        CPPUNIT_ASSERT(m_path->GetDirectory() == L"some\\path\\");
#else
        CPPUNIT_ASSERT(m_directory->GetDirectory() == L"dir/");
        CPPUNIT_ASSERT(m_file->GetDirectory() == L"");
        CPPUNIT_ASSERT(m_path->GetDirectory() == L"some/path/");
#endif
        // make sure a suffix can be removed (including suffix separator)
        m_file->SetFilesuffix(L"");
        CPPUNIT_ASSERT(m_file->GetFilename() == L"file");
    }
开发者ID:Microsoft,项目名称:pal,代码行数:26,代码来源:scxfilepath_test.cpp

示例3: 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
    }
开发者ID:Microsoft,项目名称:pal,代码行数:37,代码来源:scxfilepath_test.cpp

示例4: TestSetDirectory

    void TestSetDirectory(void)
    {
        m_directory->SetDirectory(L"new/dir\\");
        m_path->SetDirectory(L"new/dir");
        m_file->SetDirectory(L"new/dir\\");
        // Check directiory is correctly set.
#if defined(WIN32)
        CPPUNIT_ASSERT(m_directory->GetDirectory() == L"new\\dir\\");
        CPPUNIT_ASSERT(m_path->GetDirectory() == L"new\\dir\\");
        CPPUNIT_ASSERT(m_file->GetDirectory() == L"new\\dir\\");
#else
        CPPUNIT_ASSERT(m_directory->GetDirectory() == L"new/dir/");
        CPPUNIT_ASSERT(m_path->GetDirectory() == L"new/dir/");
        CPPUNIT_ASSERT(m_file->GetDirectory() == L"new/dir/");
#endif
        // Check file name is not affected
        CPPUNIT_ASSERT(m_directory->GetFilename() == L"");
        CPPUNIT_ASSERT(m_file->GetFilename() == L"file");
        CPPUNIT_ASSERT(m_path->GetFilename() == L"file.ext");
    }
开发者ID:Microsoft,项目名称:pal,代码行数:20,代码来源:scxfilepath_test.cpp

示例5: callDumpStringForCoverage

 void callDumpStringForCoverage()
 {
     CPPUNIT_ASSERT(m_path->DumpString().find(L"SCXFilePath") != std::wstring::npos);
     CPPUNIT_ASSERT(m_path->DumpString().find(m_path->GetDirectory()) != std::wstring::npos);
     CPPUNIT_ASSERT(m_path->DumpString().find(m_path->GetFilename()) != std::wstring::npos);
 }
开发者ID:Microsoft,项目名称:pal,代码行数:6,代码来源:scxfilepath_test.cpp


注:本文中的scxcorelib::SCXHandle::GetDirectory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。