本文整理汇总了C++中PhpFile::getRelPath方法的典型用法代码示例。如果您正苦于以下问题:C++ PhpFile::getRelPath方法的具体用法?C++ PhpFile::getRelPath怎么用?C++ PhpFile::getRelPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhpFile
的用法示例。
在下文中一共展示了PhpFile::getRelPath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setFileInfo
void FileRepository::setFileInfo(const StringData *name,
const string& md5,
FileInfo &fileInfo,
bool fromRepo) {
int md5len;
char* md5str;
// Incorporate the path into the md5 that is used as the key for file
// repository lookups. This assures that even if two PHP files have
// identical content, separate units exist for them (so that
// Unit::filepath() and Unit::dirpath() work correctly).
string s = md5 + '\0' + name->data();
md5str = string_md5(s.c_str(), s.size(), false, md5len);
fileInfo.m_md5 = string(md5str, md5len);
free(md5str);
if (fromRepo) {
fileInfo.m_unitMd5 = md5;
} else {
fileInfo.m_unitMd5 = unitMd5(md5);
}
fileInfo.m_srcRoot = SourceRootInfo::GetCurrentSourceRoot();
int srcRootLen = fileInfo.m_srcRoot.size();
if (srcRootLen) {
if (!strncmp(name->data(), fileInfo.m_srcRoot.c_str(), srcRootLen)) {
fileInfo.m_relPath = string(name->data() + srcRootLen);
}
}
ReadLock lock(s_md5Lock);
Md5FileMap::iterator it = s_md5Files.find(fileInfo.m_md5);
if (it != s_md5Files.end()) {
PhpFile *f = it->second;
if (!fileInfo.m_relPath.empty() &&
fileInfo.m_relPath == f->getRelPath()) {
assert(fileInfo.m_md5 == f->getMd5());
fileInfo.m_phpFile = f;
}
}
}