本文整理汇总了C++中xfile::auto_buffer::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ auto_buffer::clear方法的具体用法?C++ auto_buffer::clear怎么用?C++ auto_buffer::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xfile::auto_buffer
的用法示例。
在下文中一共展示了auto_buffer::clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadFile
bool CPODocument::LoadFile(const std::string &pofilename)
{
CURL poFileUrl(pofilename);
if (!XFILE::CFile::Exists(poFileUrl))
return false;
XFILE::CFile file;
XFILE::auto_buffer buf;
if (file.LoadFile(poFileUrl, buf) < 18) // at least a size of a minimalistic header
{
CLog::Log(LOGERROR, "%s: can't load file \"%s\" or file is too small", __FUNCTION__, pofilename.c_str());
return false;
}
m_strBuffer = '\n';
m_strBuffer.append(buf.get(), buf.size());
buf.clear();
ConvertLineEnds(pofilename);
// we make sure, to have an LF at the end of buffer
if (*m_strBuffer.rbegin() != '\n')
{
m_strBuffer += "\n";
}
m_POfilelength = m_strBuffer.size();
if (GetNextEntry() && m_Entry.Type == MSGID_FOUND)
return true;
CLog::Log(LOGERROR, "POParser: unable to read PO file header from file: %s", pofilename.c_str());
return false;
}
示例2: LoadFile
bool CXBMCTinyXML::LoadFile(const std::string& _filename, TiXmlEncoding encoding)
{
value = _filename.c_str();
XFILE::CFile file;
XFILE::auto_buffer buffer;
if (file.LoadFile(value, buffer) <= 0)
{
SetError(TIXML_ERROR_OPENING_FILE, NULL, NULL, TIXML_ENCODING_UNKNOWN);
return false;
}
// Delete the existing data:
Clear();
location.Clear();
std::string data(buffer.get(), buffer.length());
buffer.clear(); // free memory early
if (encoding == TIXML_ENCODING_UNKNOWN)
Parse(data, file.GetContentCharset());
else
Parse(data, encoding);
if (Error())
return false;
return true;
}