本文整理汇总了C++中TypeSpec::is_structure_array方法的典型用法代码示例。如果您正苦于以下问题:C++ TypeSpec::is_structure_array方法的具体用法?C++ TypeSpec::is_structure_array怎么用?C++ TypeSpec::is_structure_array使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeSpec
的用法示例。
在下文中一共展示了TypeSpec::is_structure_array方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ASTNode
ASTvariable_declaration::ASTvariable_declaration (OSLCompilerImpl *comp,
const TypeSpec &type,
ustring name, ASTNode *init,
bool isparam, bool ismeta,
bool isoutput, bool initlist)
: ASTNode (variable_declaration_node, comp, 0, init, NULL /* meta */),
m_name(name), m_sym(NULL),
m_isparam(isparam), m_isoutput(isoutput), m_ismetadata(ismeta),
m_initlist(initlist)
{
m_typespec = type;
Symbol *f = comp->symtab().clash (name);
if (f && ! m_ismetadata) {
std::string e = Strutil::format ("\"%s\" already declared in this scope", name.c_str());
if (f->node()) {
std::string filename = OIIO::Filesystem::filename(f->node()->sourcefile().string());
e += Strutil::format ("\n\t\tprevious declaration was at %s:%d",
filename, f->node()->sourceline());
}
if (f->scope() == 0 && f->symtype() == SymTypeFunction && isparam) {
// special case: only a warning for param to mask global function
warning ("%s", e.c_str());
} else {
error ("%s", e.c_str());
}
}
if (name[0] == '_' && name[1] == '_' && name[2] == '_') {
error ("\"%s\" : sorry, can't start with three underscores",
name.c_str());
}
SymType symtype = isparam ? (isoutput ? SymTypeOutputParam : SymTypeParam)
: SymTypeLocal;
// Sneaky debugging aid: a local that starts with "__debug_tmp__"
// gets declared as a temp. Don't do this on purpose!!!
if (symtype == SymTypeLocal && Strutil::starts_with (name, "__debug_tmp__"))
symtype = SymTypeTemp;
m_sym = new Symbol (name, type, symtype, this);
if (! m_ismetadata)
oslcompiler->symtab().insert (m_sym);
// A struct really makes several subvariables
if (type.is_structure() || type.is_structure_array()) {
ASSERT (! m_ismetadata);
// Add the fields as individual declarations
m_compiler->add_struct_fields (type.structspec(), m_sym->name(), symtype,
type.is_unsized_array() ? -1 : type.arraylength(),
this, init);
}
}