本文整理汇总了C++中AttributeValue::addGetter方法的典型用法代码示例。如果您正苦于以下问题:C++ AttributeValue::addGetter方法的具体用法?C++ AttributeValue::addGetter怎么用?C++ AttributeValue::addGetter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AttributeValue
的用法示例。
在下文中一共展示了AttributeValue::addGetter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: method
InterfaceConstructor(ObjectValue* object, std::string iid) :
constructor(object),
arguments(new FormalParameterList),
prototype(new InterfacePrototypeValue),
iid(iid)
{
arguments->add(new Identifier("object"));
object->setParameterList(arguments);
object->setScope(getGlobal());
Reflect::Interface interface = es::getInterface(iid.c_str());
// PRINTF("interface: %s\n", interface.getName().c_str());
for (int i = 0; i < interface.getMethodCount(); ++i)
{
// Construct Method object
Reflect::Method method(interface.getMethod(i));
if (prototype->hasProperty(method.getName()))
{
if (method.isOperation())
{
// XXX Currently overloaded functions are just ignored.
}
else
{
AttributeValue* attribute = static_cast<AttributeValue*>(prototype->get(method.getName()));
if (method.isGetter())
{
attribute->addGetter(i);
}
else
{
attribute->addSetter(i);
}
}
}
else
{
if (method.isOperation())
{
ObjectValue* function = new ObjectValue;
function->setCode(new InterfaceMethodCode(function, iid.c_str(), i));
prototype->put(method.getName(), function);
#if 0
if (method.isIndexGetter())
{
AttributeGetterValue* getter = new AttributeGetterValue(iid, i);
prototype->setOpObject(InterfacePrototypeValue::IndexGetter, getter);
}
else if (method.isIndexSetter())
{
AttributeSetterValue* setter = new AttributeSetterValue(iid, i);
prototype->setOpObject(InterfacePrototypeValue::IndexSetter, setter);
}
else if (method.isNameGetter())
{
AttributeGetterValue* getter = new AttributeGetterValue(iid, i);
prototype->setOpObject(InterfacePrototypeValue::NameGetter, getter);
}
else if (method.isNameSetter())
{
AttributeSetterValue* setter = new AttributeSetterValue(iid, i);
prototype->setOpObject(InterfacePrototypeValue::NameSetter, setter);
}
#endif
}
else
{
// method is an attribute
AttributeValue* attribute = new AttributeValue(iid.c_str());
if (method.isGetter())
{
attribute->addGetter(i);
}
else
{
attribute->addSetter(i);
}
prototype->put(method.getName(), attribute);
}
}
}
if (interface.getQualifiedSuperName() == "")
{
prototype->setPrototype(getGlobal()->get("InterfaceStore")->getPrototype()->getPrototype());
}
else
{
Reflect::Interface super = es::getInterface(interface.getQualifiedSuperName().c_str());
prototype->setPrototype(getGlobal()->get(super.getName())->get("prototype"));
}
// Create Interface.prototype
prototype->put("constructor", object);
object->put("prototype", prototype);
}