本文整理汇总了C++中DictionaryPtr::file方法的典型用法代码示例。如果您正苦于以下问题:C++ DictionaryPtr::file方法的具体用法?C++ DictionaryPtr::file怎么用?C++ DictionaryPtr::file使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DictionaryPtr
的用法示例。
在下文中一共展示了DictionaryPtr::file方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
CodeVisitor::visitDictionary(const DictionaryPtr& p)
{
TypePtr keyType = p->keyType();
BuiltinPtr b = BuiltinPtr::dynamicCast(keyType);
if(b)
{
switch(b->kind())
{
case Slice::Builtin::KindBool:
case Slice::Builtin::KindByte:
case Slice::Builtin::KindShort:
case Slice::Builtin::KindInt:
case Slice::Builtin::KindLong:
case Slice::Builtin::KindString:
//
// These types are acceptable as dictionary keys.
//
break;
case Slice::Builtin::KindFloat:
case Slice::Builtin::KindDouble:
emitWarning(p->file(), p->line(), "dictionary key type not supported in PHP");
break;
case Slice::Builtin::KindObject:
case Slice::Builtin::KindObjectProxy:
case Slice::Builtin::KindLocalObject:
assert(false);
}
}
else if(!EnumPtr::dynamicCast(keyType))
{
emitWarning(p->file(), p->line(), "dictionary key type not supported in PHP");
}
string type = getTypeVar(p);
startNamespace(p);
//
// Emit the type information.
//
string scoped = p->scoped();
_out << sp << nl << "if(!isset(" << type << "))";
_out << sb;
_out << nl << type << " = IcePHP_defineDictionary('" << scoped << "', ";
writeType(p->keyType());
_out << ", ";
writeType(p->valueType());
_out << ");";
_out << eb;
endNamespace();
}