本文整理汇总了C++中configobject::Ptr::GetVersion方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::GetVersion方法的具体用法?C++ Ptr::GetVersion怎么用?C++ Ptr::GetVersion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类configobject::Ptr
的用法示例。
在下文中一共展示了Ptr::GetVersion方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DumpModifiedAttributes
void IcingaApplication::DumpModifiedAttributes(void)
{
String path = GetModAttrPath();
std::fstream fp;
String tempFilename = Utility::CreateTempFile(path + ".XXXXXX", 0644, fp);
fp.exceptions(std::ofstream::failbit | std::ofstream::badbit);
ConfigObject::Ptr previousObject;
ConfigObject::DumpModifiedAttributes(boost::bind(&PersistModAttrHelper, boost::ref(fp), boost::ref(previousObject), _1, _2, _3));
if (previousObject) {
ConfigWriter::EmitRaw(fp, "\tobj.version = ");
ConfigWriter::EmitValue(fp, 0, previousObject->GetVersion());
ConfigWriter::EmitRaw(fp, "\n}\n");
}
fp.close();
#ifdef _WIN32
_unlink(path.CStr());
#endif /* _WIN32 */
if (rename(tempFilename.CStr(), path.CStr()) < 0) {
BOOST_THROW_EXCEPTION(posix_error()
<< boost::errinfo_api_function("rename")
<< boost::errinfo_errno(errno)
<< boost::errinfo_file_name(tempFilename));
}
}
示例2: PersistModAttrHelper
static void PersistModAttrHelper(std::fstream& fp, ConfigObject::Ptr& previousObject, const ConfigObject::Ptr& object, const String& attr, const Value& value)
{
if (object != previousObject) {
if (previousObject) {
ConfigWriter::EmitRaw(fp, "\tobj.version = ");
ConfigWriter::EmitValue(fp, 0, previousObject->GetVersion());
ConfigWriter::EmitRaw(fp, "\n}\n\n");
}
ConfigWriter::EmitRaw(fp, "var obj = ");
Array::Ptr args1 = new Array();
args1->Add(object->GetReflectionType()->GetName());
args1->Add(object->GetName());
ConfigWriter::EmitFunctionCall(fp, "get_object", args1);
ConfigWriter::EmitRaw(fp, "\nif (obj) {\n");
}
ConfigWriter::EmitRaw(fp, "\tobj.");
Array::Ptr args2 = new Array();
args2->Add(attr);
args2->Add(value);
ConfigWriter::EmitFunctionCall(fp, "modify_attribute", args2);
ConfigWriter::EmitRaw(fp, "\n");
previousObject = object;
}