Exemplo n.º 1
0
void StatusDataWriter::DumpCustomAttributes(std::ostream& fp, const CustomVarObject::Ptr& object)
{
	Dictionary::Ptr vars = object->GetVars();

	if (!vars)
		return;

	bool is_json = false;

	ObjectLock olock(vars);
	for (const Dictionary::Pair& kv : vars) {
		if (kv.first.IsEmpty())
			continue;

		Value value;

		if (kv.second.IsObjectType<Array>() || kv.second.IsObjectType<Dictionary>()) {
			value = JsonEncode(kv.second);
			is_json = true;
		} else
			value = CompatUtility::EscapeString(kv.second);

		fp << "\t" "_" << kv.first << "\t" << value << "\n";
	}

	if (is_json)
		fp << "\t" "_is_json" "\t" "1" "\n";
}
Exemplo n.º 2
0
String CompatUtility::GetCustomAttributeConfig(const CustomVarObject::Ptr& object, const String& name)
{
	Dictionary::Ptr vars = object->GetVars();

	if (!vars)
		return Empty;

	return vars->Get(name);
}
Exemplo n.º 3
0
/* vars attr */
Dictionary::Ptr CompatUtility::GetCustomAttributeConfig(const CustomVarObject::Ptr& object)
{
	Dictionary::Ptr vars = object->GetVars();

	if (!vars)
		return Dictionary::Ptr();

	return vars;
}
Exemplo n.º 4
0
void DbObject::VarsChangedHandler(const CustomVarObject::Ptr& object)
{
	DbObject::Ptr dbobj = GetOrCreateByObject(object);

	Log(LogDebug, "DbObject")
	    << "Vars changed for object '" << object->GetName() << "'";

	if (!dbobj)
		return;

	dbobj->SendVarsStatusUpdate();
}