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


C++ Path::setExtension方法代码示例

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


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

示例1: initialize

void ComputeApp::initialize(Application& self)
{
    Application::initialize(self);

    Poco::Path appPath = commandPath();
    appPath.setExtension("");
    appPath.setFileName("");
    exeDirectory = appPath.toString();

    loadConfiguration();
}
开发者ID:william-taylor,项目名称:raster-js,代码行数:11,代码来源:Application.cpp

示例2: ExportPalette

    void CPaletteUtil::ExportPalette( const std::string & inparentdirpath, const std::vector<gimg::colorRGB24> & palette )
    {
        Poco::Path inputPal(inparentdirpath);
        Poco::Path outputPath;
        cout <<"Exporting to ";

        if( m_outputPath.empty() )
        {
            outputPath = inputPal.append("palette").makeFile();

            if     (m_outPalType == ePalType::RIFF)   { outputPath.setExtension( utils::io::RIFF_PAL_Filext );           }
            else if(m_outPalType == ePalType::RGBX32) { outputPath.setExtension( pmd2::filetypes::RGBX32_RAW_PAL_FILEX );}
            else if(m_outPalType == ePalType::TEXT)   { outputPath.setExtension( TXTPAL_Filext );                        }
            else
                throw std::runtime_error("ERROR: Invalid output palette type!");
        }
        else
            outputPath = m_outputPath;

        if( m_outPalType == ePalType::RIFF )
        {
            cout<<"RIFF palette \"" <<outputPath.toString() <<"\"\n";
            utils::io::ExportTo_RIFF_Palette( palette, outputPath.toString() );
        }
        else if( m_outPalType == ePalType::RGBX32 )
        {
            cout<<"raw RGBX32 palette\"" <<outputPath.toString() <<"\"\n";
            vector<uint8_t> outdata;
            outdata.reserve( palette.size() * gimg::colorRGB24::getSizeRawBytes() );
            pmd2::graphics::WriteRawPalette_RGB24_As_RGBX32( back_inserter(outdata), palette.begin(), palette.end() );
            utils::io::WriteByteVectorToFile( outputPath.toString(), outdata );
        }
        else if( m_outPalType == ePalType::TEXT )
        {
            cout<<"HTML text palette \"" <<outputPath.toString() <<"\"\n";
            utils::io::ExportTo_TXT_Palette( palette, outputPath.toString() );
        }
    }
开发者ID:PsyCommando,项目名称:ppmdu,代码行数:38,代码来源:palettetool.cpp

示例3: setPath

/**
 * Confirm that an executable file exists at location.
 */
void TskExecutableModule::setPath(const std::string& location)
{
    try
    {
        // Autogenerate filename extension if needed
        Poco::Path tempPath = location;
        if (tempPath.getExtension().empty())
        {
            std::string os = Poco::Environment::osName();
            if (os.find("Windows") != std::string::npos ||
                os.find("CYGWIN")  != std::string::npos ||
                os.find("MINGW")   != std::string::npos )
            {
                tempPath.setExtension("exe");
            }
            // Else we assume the user is on a platform that doesn't use executable extensions.
        }

        // Call our parent to validate the location.
        TskModule::setPath(tempPath.toString());

        m_name = Poco::Path(m_modulePath).getBaseName();

        // Verify that the file is executable.
        Poco::File exeFile(m_modulePath);

        if (!exeFile.canExecute())
        {
            std::wstringstream msg;
            msg << L"TskExecutableModule::setPath - File is not executable: "
                << m_modulePath.c_str();
            LOGERROR(msg.str());
            throw TskException("File is not executable.");
        }
    }
    catch (TskException& tskEx)
    {
        throw tskEx;
    }
    catch(std::exception& ex)
    {
        // Log a message and throw a framework exception.
        std::wstringstream msg;
        msg << "TskExecutableModule::setPath : " << ex.what();
        LOGERROR(msg.str());

        throw TskException("Failed to set location: " + m_modulePath);
    }
}
开发者ID:0xkasun,项目名称:OpenDF,代码行数:52,代码来源:TskExecutableModule.cpp


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