Beispiel #1
0
 public static bool?GetEmitNullableDirective(Schema.Node.Reader node)
 {
     foreach (var annotation in node.Annotations)
     {
         if (annotation.Id == AnnotationIds.Cs.EmitNullableDirective && annotation.Value.IsBool)
         {
             return(annotation.Value.Bool);
         }
     }
     return(null);
 }
Beispiel #2
0
 public static string GetCsName(Schema.Node.Reader node)
 {
     foreach (var annotation in node.Annotations)
     {
         if (annotation.Id == AnnotationIds.Cs.Name)
         {
             return(annotation.Value.Text);
         }
     }
     return(null);
 }
 string[] GetNamespaceAnnotation(Schema.Node.Reader fileNode)
 {
     foreach (var annotation in fileNode.Annotations)
     {
         if (annotation.Id == 0xb9c6f99ebf805f2c) // Cxx namespace
         {
             return(annotation.Value.Text.Split(new string[1] {
                 "::"
             }, default));
         }
     }
     return(null);
 }
        void ProcessFile(Schema.Node.Reader fileReader)
        {
            foreach (var annotation in fileReader.Annotations)
            {
                if (annotation.Id == 0xb9c6f99ebf805f2c) // Cxx namespace
                {
                    ((GenFile)_typeNest.Peek()).Namespace = annotation.Value.Text.Split("::");
                }
            }

            foreach (var nestedNode in fileReader.NestedNodes)
            {
                var node = IdToNode(nestedNode.Id);

                ProcessNode(node, nestedNode.Name);
            }
        }
Beispiel #5
0
        public static string[] GetNamespaceAnnotation(Schema.Node.Reader fileNode)
        {
            foreach (var annotation in fileNode.Annotations)
            {
                if (annotation.Id == AnnotationIds.Cs.Namespace)
                {
                    return(annotation.Value.Text.Split(new string[1] {
                        "."
                    }, default));
                }

                if (annotation.Id == AnnotationIds.Cxx.Namespace)
                {
                    return(annotation.Value.Text.Split(new string[1] {
                        "::"
                    }, default));
                }
            }
            return(null);
        }