本文整理汇总了C++中Filename::getPath方法的典型用法代码示例。如果您正苦于以下问题:C++ Filename::getPath方法的具体用法?C++ Filename::getPath怎么用?C++ Filename::getPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Filename
的用法示例。
在下文中一共展示了Filename::getPath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processArgs
/**
* Processes the args sent to main.
*/
int processArgs(int argc, char *argv[ ])
{
if (argc < 3)
{
printSyntax();
return 0;
}
//if (strcmp(argv[1], "-edit") == 0)
//{
// for (int i = 2; i < argc; ++i)
// {
// int result = checkOut(argv[i]);
// if (result != 0)
// return result;
// }
//}
//else if (strcmp(argv[1], "-submit") == 0)
//{
// for (int i = 2; i < argc; ++i)
// {
// int result = checkIn(argv[i]);
// if (result != 0)
// return result;
// }
//}
if (strcmp(argv[1], "-compile") == 0)
{
Filename filename;
for (int i = 2; i < argc; ++i)
{
File::setBasePath("");
filename.clear();
filename.setExtension(TEMPLATE_DEFINITION_EXTENSION);
filename.setName(argv[i]);
File fp(filename, "rt");
if (!fp.isOpened())
{
fprintf(stderr, "cannot open file %s\n", argv[i]);
return -1;
}
else
{
File::setBasePath(filename.getPath().c_str());
int result = parseTemplateDefinitionFile(fp);
fp.close();
if (result != 0)
return result;
}
}
}
else
{
printSyntax();
return 0;
}
return 0;
} // processArgs
示例2: prependPath
/**
* Prepends a path to our path, unless our path is an an absolute path.
*
* @param path the path to prepend
*/
void Filename::prependPath(const Filename &path)
{
if (m_path.size() != 0 && m_path[0] != PATH_SEPARATOR)
{
m_path = path.getPath() + m_path;
convertToSystemPath(m_path);
makeFullPath();
}
} // Filename::prependPath
示例3: appendPath
/**
* Appends a path to our path. If the path is an absolute path, replaces our path.
*
* @param path the path to append
*/
void Filename::appendPath(const Filename &path)
{
std::string localpath = path.getPath();
convertToSystemPath(localpath);
if (localpath.size() != 0 && localpath[0] == PATH_SEPARATOR)
m_path = localpath;
else
m_path += localpath;
makeFullPath();
} // Filename::appendPath
示例4: writeTemplate
/**
* Writes the header and source files for a template.
*
* @param tdfFile the parsed template definition file
* @param path path to write the file to
*
* @return 0 on success, -1 on error
*/
int writeTemplate(TemplateDefinitionFile &tdfFile, const Filename &path)
{
int result;
// std::string oldTemplateName = tdfFile.getTemplateName();
// std::string oldBaseName = tdfFile.getBaseName();
Filename fullName(NULL, path.getPath().c_str(), tdfFile.getTemplateName().c_str(),
NULL);
writeTemplateHeader(tdfFile, fullName);
result = writeTemplateSource(tdfFile, fullName);
// tdfFile.setTemplateName(oldTemplateName);
// tdfFile.setBaseName(oldBaseName);
return result;
} // writeTemplate