本文整理汇总了C++中openstudio::setFileExtension方法的典型用法代码示例。如果您正苦于以下问题:C++ openstudio::setFileExtension方法的具体用法?C++ openstudio::setFileExtension怎么用?C++ openstudio::setFileExtension使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openstudio
的用法示例。
在下文中一共展示了openstudio::setFileExtension方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: resourcesPath
TEST_F(CoreFixture, Path_SetFileExtension)
{
// example usage for assigning proper file extension
path p = resourcesPath()/toPath("energyplus/5ZoneAirCooled/in");
path result = setFileExtension(p,"idf");
EXPECT_TRUE(boost::filesystem::extension(p).empty());
EXPECT_TRUE(toString(boost::filesystem::extension(result)) == std::string(".idf"));
EXPECT_TRUE(boost::filesystem::exists(result));
EXPECT_TRUE(boost::filesystem::is_regular_file(result));
// passes out path as is if file extension already set
p = resourcesPath()/toPath("energyplus/5ZoneAirCooled/in.idf");
result = setFileExtension(p,"idf");
EXPECT_TRUE(toString(boost::filesystem::extension(p)) == std::string(".idf"));
EXPECT_TRUE(toString(boost::filesystem::extension(result)) == std::string(".idf"));
// will not replace extension, but will log warning and alert user by returning empty path
p = toPath("energyplus/5ZoneAirCooled/in.osm");
result = setFileExtension(p,"idf",false);
EXPECT_TRUE(result == p);
// will replace extension if asked
p = toPath("energyplus/5ZoneAirCooled/in.osm");
result = setFileExtension(p,"idf",true,false);
EXPECT_TRUE(toString(boost::filesystem::extension(result)) == std::string(".idf"));
// setFileExtension does not care about existence
p = toPath("fakeDir/fakeDirOrFile");
result = setFileExtension(p,"jjj",true);
EXPECT_TRUE(toString(boost::filesystem::extension(result)) == std::string(".jjj"));
}