本文整理汇总了C#中Schema.IsGroup方法的典型用法代码示例。如果您正苦于以下问题:C# Schema.IsGroup方法的具体用法?C# Schema.IsGroup怎么用?C# Schema.IsGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Schema
的用法示例。
在下文中一共展示了Schema.IsGroup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteStruct
public void WriteStruct(Schema.Node node, Stack<UnionStub> union)
{
if (node.IsGroup()) return;
if (node.Union != [email protected]) return;
var @struct = [email protected];
// the nested type does not inherit the unions from the caller
if (union.Count != 0)
{
union = new Stack<UnionStub>();
}
BeginClass(node).WriteLittleEndianCheck(node);
var fields = @struct.fields;
int bodyWords = 0, pointerWords = 0;
Schema.CodeGeneratorRequest.ComputeSpace(this, node, ref bodyWords, ref pointerWords);
HashSet<ulong> nestedDone = null;
if (fields.IsValid())
{
foreach (var field in fields.OrderBy(x => x.codeOrder).ThenBy(x => x.name, Text.Comparer))
{
bool pushed = false;
if (field.discriminantValue != Field.noDiscriminant)
{
// write with union-based restructions
union.Push(new UnionStub([email protected], field.discriminantValue));
pushed = true;
}
WriteFieldAccessor(node, field, union);
// declare the struct too, if we need to - noting that it includes union-context
Node child = default(Node);
switch (field.Union)
{
case Field.Unions.group:
child = Lookup(field.group.typeId);
break;
case Field.Unions.slot:
if (field.slot.type.Union == [email protected])
child = Lookup([email protected]);
break;
}
if (child.IsValid())
{
if (child.IsGroup())
{
if (nestedDone == null) nestedDone = new HashSet<ulong>();
if (nestedDone.Add(child.id))
{
WriteGroup(child, union);
}
}
}
if (pushed) union.Pop();
}
}
//if (node.nestedNodes != null)
//{
// foreach (var nestedNode in node.nestedNodes)
// {
// if (nestedDone == null || !nestedDone.Contains(nestedNode.id))
// {
// var found = Lookup(nestedNode.id);
// if (found != null && found.IsGroup())
// {
// WriteGroup(found, union);
// WriteGroupAccessor(node, found, LocalName(found.displayName, false), false);
// }
// }
// }
//}
if (@struct.discriminantCount != 0)
{
WriteDiscriminant(node, union);
}
DeclareFields(bodyWords, pointerWords);
WriteNestedTypes(node, union);
EndClass();
}