本文整理汇总了C++中DB2Storage::Load方法的典型用法代码示例。如果您正苦于以下问题:C++ DB2Storage::Load方法的具体用法?C++ DB2Storage::Load怎么用?C++ DB2Storage::Load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DB2Storage
的用法示例。
在下文中一共展示了DB2Storage::Load方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ASSERT
inline void LoadDB2(uint32& availableDb2Locales, StoreProblemList1& errlist, DB2Storage<T>& storage, const std::string& db2_path, const std::string& filename)
{
// compatibility format and C++ structure sizes
ASSERT(DB2FileLoader::GetFormatRecordSize(storage.GetFormat()) == sizeof(T) || LoadDB2_assert_print(DB2FileLoader::GetFormatRecordSize(storage.GetFormat()), sizeof(T), filename));
std::string db2_filename = db2_path + filename;
if (storage.Load(db2_filename.c_str()))
{
//bar.step();
}
else
{
// sort problematic db2 to (1) non compatible and (2) nonexistent
FILE * f = fopen(db2_filename.c_str(), "rb");
if (f)
{
char buf[100];
snprintf(buf, 100,"(exist, but have %d fields instead " SIZEFMTD ") Wrong client version DBC file?", storage.GetFieldCount(), strlen(storage.GetFormat()));
errlist.push_back(db2_filename + buf);
fclose(f);
}
else
errlist.push_back(db2_filename);
}
}
示例2: ASSERT
inline void LoadDB2(uint32& availableDb2Locales, StoreProblemList1& errlist, DB2Storage<T>& storage, const std::string& db2_path, const std::string& filename)
{
// compatibility format and C++ structure sizes
ASSERT(DB2FileLoader::GetFormatRecordSize(storage.GetFormat()) == sizeof(T) || LoadDB2_assert_print(DB2FileLoader::GetFormatRecordSize(storage.GetFormat()), sizeof(T), filename));
++DB2FilesCount;
std::string db2_filename = db2_path + filename;
if (storage.Load(db2_filename.c_str()))
{
for (uint8 loc = 1; loc < TOTAL_LOCALES; ++loc)
{
if (!(availableDb2Locales & (1 << loc)))
continue;
std::string localizedFileName = db2_path + localeNames[loc] + "/" + filename;
if (!storage.LoadStringsFrom(localizedFileName.c_str(), loc))
availableDb2Locales &= ~(1<<loc); // mark locale as not available
}
}
else
{
// sort problematic db2 to (1) non compatible and (2) nonexistent
FILE * f = fopen(db2_filename.c_str(), "rb");
if (f)
{
char buf[100];
snprintf(buf, 100, "(exist, but have %d fields instead " SIZEFMTD ") Wrong client version DBC file?", storage.GetFieldCount(), strlen(storage.GetFormat()));
errlist.push_back(db2_filename + buf);
fclose(f);
}
else
errlist.push_back(db2_filename);
}
}
示例3: localizedName
inline void LoadDB2(uint32& availableDb2Locales, DB2StoreProblemList& errlist, DB2Storage<T>& storage, std::string const& db2_path, std::string const& filename)
{
// compatibility format and C++ structure sizes
if (!(DB2FileLoader::GetFormatRecordSize(storage.GetFormat()) == sizeof(T) || LoadDB2_assert_print(DB2FileLoader::GetFormatRecordSize(storage.GetFormat()), sizeof(T), filename)))
return;
++DB2FilesCount;
std::string db2_filename = db2_path + filename;
if (storage.Load(db2_filename.c_str(), uint32(sWorld->GetDefaultDbcLocale())))
{
for (uint32 i = 0; i < TOTAL_LOCALES; ++i)
{
if (!(availableDb2Locales & (1 << i)))
continue;
if (uint32(sWorld->GetDefaultDbcLocale()) == i)
continue;
std::string localizedName(db2_path);
localizedName.append(localeNames[i]);
localizedName.push_back('/');
localizedName.append(filename);
if (!storage.LoadStringsFrom(localizedName.c_str(), i))
availableDb2Locales &= ~(1<<i); // mark as not available for speedup next checks
}
}
else
{
// sort problematic db2 to (1) non compatible and (2) nonexistent
if (FILE* f = fopen(db2_filename.c_str(), "rb"))
{
char buf[100];
snprintf(buf, 100,"(exist, but have %d fields instead " SIZEFMTD ") Wrong client version DBC file?", storage.GetFieldCount(), strlen(storage.GetFormat()));
errlist.push_back(db2_filename + buf);
fclose(f);
}
else
errlist.push_back(db2_filename);
}
DB2Stores[storage.GetHash()] = &storage;
}
示例4: localizedName
inline void LoadDB2(uint32& availableDb2Locales, DB2StoreProblemList& errlist, DB2Storage<T>& storage, std::string const& db2_path, std::string const& filename)
{
// compatibility format and C++ structure sizes
ASSERT(DB2FileLoader::GetFormatRecordSize(storage.GetFormat()) == sizeof(T) || LoadDB2_assert_print(DB2FileLoader::GetFormatRecordSize(storage.GetFormat()), sizeof(T), filename));
++DB2FilesCount;
std::string db2_filename = db2_path + filename;
if (storage.Load(db2_filename.c_str(), uint32(sWorld->GetDefaultDbcLocale())))
{
for (uint32 i = 0; i < TOTAL_LOCALES; ++i)
{
if (!(availableDb2Locales & (1 << i)))
continue;
if (uint32(sWorld->GetDefaultDbcLocale()) == i)
continue;
std::string localizedName(db2_path);
localizedName.append(localeNames[i]);
localizedName.push_back('/');
localizedName.append(filename);
if (!storage.LoadStringsFrom(localizedName.c_str(), i))
availableDb2Locales &= ~(1<<i); // mark as not available for speedup next checks
}
}
else
{
// sort problematic db2 to (1) non compatible and (2) nonexistent
if (FILE* f = fopen(db2_filename.c_str(), "rb"))
{
std::ostringstream stream;
stream << db2_filename << " exists, and has " << storage.GetFieldCount() << " field(s) (expected " << strlen(storage.GetFormat()) << "). Extracted file might be from wrong client version or a database-update has been forgotten.";
std::string buf = stream.str();
errlist.push_back(buf);
fclose(f);
}
else
errlist.push_back(db2_filename);
}
DB2Stores[storage.GetHash()] = &storage;
}
示例5: sizeof
inline void LoadDB2(LocalDB2Data& localeData, StoreProblemList1& errors, DB2Storage<T>& storage, std::string const& db2Path, std::string const& filename)
{
// compatibility format and C++ structure sizes
MANGOS_ASSERT(DB2FileLoader::GetFormatRecordSize(storage.GetFormat()) == sizeof(T) || LoadDB2_assert_print(DB2FileLoader::GetFormatRecordSize(storage.GetFormat()), sizeof(T), filename));
++DB2FileCount;
std::string db2Filename = db2Path + filename;
if (storage.Load(db2Filename.c_str(), localeData.defaultLocale))
{
for(uint8 i = 0; fullLocaleNameList[i].name; ++i)
{
if (!(localeData.availableDb2Locales & (1 << i)))
continue;
LocaleNameStr const* localStr = &fullLocaleNameList[i];
std::string db2_dir_loc = db2Path + localStr->name + "/";
std::string localizedName = db2Path + localStr->name + "/" + filename;
if(!storage.LoadStringsFrom(localizedName.c_str(), localStr->locale))
localeData.availableDb2Locales &= ~(1<<i); // mark as not available for speedup next checks
}
}
else
{
// sort problematic db2 to (1) non compatible and (2) nonexistent
if (FILE* f = fopen(db2Filename.c_str(), "rb"))
{
char buf[100];
snprintf(buf, 100, " (exist, but have %d fields instead " SIZEFMTD ") Wrong client version DB2 file?", storage.GetFieldCount(), strlen(storage.GetFormat()));
errors.push_back(db2Filename + buf);
fclose(f);
}
else
errors.push_back(db2Filename);
}
}