本文整理汇总了C++中FilePath函数的典型用法代码示例。如果您正苦于以下问题:C++ FilePath函数的具体用法?C++ FilePath怎么用?C++ FilePath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FilePath函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: luaFuncResources
static int luaFuncResources(lua_State* l)
{
Block* b = mbGetActiveContext()->ActiveBlock();
if (!b)
{
MB_LOGERROR("must be within a block");
mbExitError();
}
luaL_checktype(l, 1, LUA_TTABLE);
int tableLen = luaL_len(l, 1);
FilePathVector strings;
for (int i = 1; i <= tableLen; ++i)
{
lua_rawgeti(l, 1, i);
strings.push_back(FilePath());
mbLuaToStringExpandMacros(&strings.back(), b, l, -1);
}
StringVector filteredList;
BuildFileList(&filteredList, strings);
b->AddResources(filteredList);
return 0;
}
示例2: clang
void TranslationUnit::printResourceUsage(std::ostream& ostr, bool detailed) const
{
CXTUResourceUsage usage = clang().getCXTUResourceUsage(tu_);
unsigned long totalBytes = 0;
for (unsigned i = 0; i < usage.numEntries; i++)
{
CXTUResourceUsageEntry entry = usage.entries[i];
if (detailed)
{
ostr << clang().getTUResourceUsageName(entry.kind) << ": "
<< formatBytes(entry.amount) << std::endl;
}
if (entry.kind >= CXTUResourceUsage_MEMORY_IN_BYTES_BEGIN &&
entry.kind <= CXTUResourceUsage_MEMORY_IN_BYTES_END)
{
totalBytes += entry.amount;
}
}
ostr << "TOTAL MEMORY: " << formatBytes(totalBytes)
<< " (" << FilePath(getSpelling()).filename() << ")" << std::endl;
clang().disposeCXTUResourceUsage(usage);
}
示例3: switch
void RegularFile::Open(OpenMode::Mode mode) {
int flags = 0;
switch (mode) {
case OpenMode::Read:
flags = 0;
m_FD->Eof = false;
break;
case OpenMode::Write:
flags = O_CREAT|O_WRONLY|O_TRUNC;
break;
case OpenMode::Append:
flags = O_CREAT|O_WRONLY|O_APPEND;
break;
default:
throw Ape::EInvalidArgument("Invalid OpenMode");
break;
}
m_FD->FD = open(FilePath().Canonical().CStr(), flags);
//printf("%s -> %p\n", FilePath().Canonical().CStr(), m_FD->FD);
if (m_FD->FD == -1) {
ThrowExceptionFor(errno);
}
m_Mode = mode;
}
示例4: dir
// Given directory = "dir", relative_path = "test.xml", returns "dir/test.xml".
// On Windows, uses \ as the separator rather than /.
FilePath FilePath::ConcatPaths(const FilePath& directory,
const FilePath& relative_path) {
if (directory.IsEmpty())
return relative_path;
const FilePath dir(directory.RemoveTrailingPathSeparator());
return FilePath(dir.string() + kPathSeparator + relative_path.string());
}
示例5: FilePath
FilePath AddGenCompDialog::getSelectedGenCompFilePath() const noexcept
{
if (mSelectedGenComp)
return mSelectedGenComp->getDirectory();
else
return FilePath();
}
示例6: switch
FilePath MipMapReplacer::GetDummyTextureFilePath(Texture * texture)
{
String formatFile;
switch (texture->format)
{
case FORMAT_ATC_RGB:
formatFile = "atc.dds";
break;
case FORMAT_ATC_RGBA_EXPLICIT_ALPHA:
formatFile = "atce.dds";
break;
case FORMAT_ATC_RGBA_INTERPOLATED_ALPHA:
formatFile = "atci.dds";
break;
case FORMAT_DXT1:
formatFile = "dxt1.dds";
break;
case FORMAT_DXT1A:
formatFile = "dxt1a.dds";
break;
case FORMAT_DXT1NM:
formatFile = "dxt1nm.dds";
break;
case FORMAT_DXT3:
formatFile = "dxt3.dds";
break;
case FORMAT_DXT5:
formatFile = "dxt5.dds";
break;
case FORMAT_DXT5NM:
formatFile = "dxt5nm.dds";
break;
case FORMAT_ETC1:
formatFile = "etc1.pvr";
break;
case FORMAT_PVR2:
formatFile = "pvr2.pvr";
break;
case FORMAT_PVR4:
formatFile = "pvr4.pvr";
break;
default:
return FilePath();
}
return FilePath(DUMMY_TEXTURES_DIR + formatFile);
}
示例7: FilePath
// Returns a copy of the FilePath with the case-insensitive extension removed.
// Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns
// FilePath("dir/file"). If a case-insensitive extension is not
// found, returns a copy of the original FilePath.
FilePath FilePath::RemoveExtension(const char* extension) const {
const std::string dot_extension = std::string(".") + extension;
if (String::EndsWithCaseInsensitive(pathname_, dot_extension)) {
return FilePath(pathname_.substr(
0, pathname_.length() - dot_extension.length()));
}
return *this;
}
示例8: _starting_location_t1
EdManipGUIObject::EdManipGUIObject (void)
: _starting_location_t1 (0.0F),
_starting_location_t2 (0.0F)
{
_line_material.setBlendEnable(false);
_line_material.setDepthEnable(true);
_line_material.setCullMode(DT3GL_CULL_NONE);
_line_material.setColor(Color(1.0F,1.0F,1.0F,1.0F));
_line_material.setShader(ShaderResource::getShader(FilePath("{editorline.shdr}")));
_red_material.setBlendEnable(false);
_red_material.setDepthEnable(true);
_red_material.setCullMode(DT3GL_CULL_NONE);
_red_material.setColor(Color(1.0F,0.0F,0.0F,1.0F));
_red_material.setShader(ShaderResource::getShader(FilePath("{editorline.shdr}")));
}
示例9: FilePath
void FileDialog::updateButtons() {
FilePath file_path = m_dir_path / FilePath(toUTF8Checked(m_edit_box->text()));
if(m_mode == FileDialogMode::opening_file)
m_ok_button->enable(file_path.isRegularFile());
else if(m_mode == FileDialogMode::saving_file)
m_ok_button->enable(!file_path.isDirectory());
}
示例10: getSelectedFilePaths
/**
Returns a vector with all selected file paths.
@return a vector with all selected file paths.
*/
std::vector<FilePath> getSelectedFilePaths() const {
std::vector<FilePath> result;
int count = getSelectedFileCount();
for(int index = 0; index < count; ++index) {
result.push_back(FilePath(getSelectedFile(index)));
}
return result;
}
示例11: ValidSeparator
filesystem::FilePath filesystem::FilePath::toValidPath(const std::string& path)
{
std::string tmp_path = path;
std::replace_if(tmp_path.begin(), tmp_path.end(), ValidSeparator(INVALID_PATH_SEPARATOR), PATH_SEPARATOR);
if (tmp_path.back() == PATH_SEPARATOR)
tmp_path.erase(tmp_path.end());
return FilePath(tmp_path);
}
示例12: FilePath
FilePath FilePath::GetFolder()const
{
WString delimiter = Delimiter;
fint pos = _fullPath.FindLast(L'\\');
if (!pos)
return FilePath();
return _fullPath.Left(pos);
}
示例13: FilePath
FilePath FilePath::folderPath() const
{
if (pathParts_.empty())
return FilePath("..");
if (pathParts_.size() == 1)
return FilePath("");
if (pathParts_.back() == upString)
{
std::vector<String> partsWithOnlyUps(pathParts_.size() + 1);
std::fill_n(partsWithOnlyUps.begin(), pathParts_.size() + 1, upString);
return FilePath(partsWithOnlyUps);
}
std::vector<String> partsExceptLast(pathParts_.size() - 1);
partsExceptLast.reserve(pathParts_.size() - 1);
std::copy(pathParts_.begin(), std::prev(pathParts_.end()), partsExceptLast.begin());
return FilePath(partsExceptLast);
}
示例14: Register
bool TextureAsset::Register(const AssetName& name, const Emoji& emoji, const TextureDesc desc, const AssetParameter& parameter)
{
return Register(name, TextureAssetData(FilePath(), desc, parameter,
[=](TextureAssetData& a) { a.texture = Texture(emoji, a.desc); return !!a.texture; },
TextureAssetData::DefaultUpdate,
TextureAssetData::DefaultRelease
));
}
示例15: getDocument
FilePath XmlDomElement::getDocFilePath() const noexcept
{
XmlDomDocument* doc = getDocument(true);
if (doc)
return doc->getFilePath();
else
return FilePath();
}