コード例 #1
0
ファイル: Metadata.cs プロジェクト: Tigrouzen/UnrealEngine-4
 public static MetadataFile Read(SourceFile File)
 {
     MetadataFile Result;
     if(!FileMap.TryGetValue(File, out Result))
     {
         Result = new MetadataFile(File);
         FileMap.Add(File, Result);
     }
     return Result;
 }
コード例 #2
0
ファイル: Metadata.cs プロジェクト: Tigrouzen/UnrealEngine-4
        public MetadataDirective(SourceFile InFile, int InIndex, int InEndIndex, int InDefinitionIndex, List<MetadataNode> InNodeList)
        {
            File = InFile;
            Index = InIndex;
            EndIndex = InEndIndex;
            DefinitionIndex = InDefinitionIndex;
            NodeList = InNodeList;

            Type = File.Tokens[Index].ToString();

            Dictionary<string, int> TagsForType;
            if(!AllTags.TryGetValue(Type, out TagsForType))
            {
                TagsForType = new Dictionary<string, int>();
                AllTags.Add(Type, TagsForType);
            }

            foreach(MetadataNode Node in NodeList)
            {
                int Count = 0;
                if(TagsForType.TryGetValue(Node.TagText, out Count))
                {
                    Count++;
                }
                TagsForType[Node.TagText] = Count;
            }
        }
コード例 #3
0
ファイル: Metadata.cs プロジェクト: Tigrouzen/UnrealEngine-4
        public static MetadataDirective TryParseDirective(SourceFile File, SourceToken[] Tokens, int Index)
        {
            string TagText = Tokens[Index].Text;
            if(TagText == "UCLASS" || TagText == "UPROPERTY" || TagText == "UENUM" || TagText == "USTRUCT" || TagText == "UFUNCTION")
            {
                int DirectiveIndex = Index++;

                List<MetadataNode> NodeList = TryParseNodeList(Tokens, ref Index);
                if(NodeList != null)
                {
                    // Save the end of the metadata, and the start of the definition
                    int DirectiveEndIndex = Index;

                    // Depending on the type, parse a definition
                    int DefinitionIndex = Index;
                    if(TagText == "UCLASS" || TagText == "USTRUCT" || TagText == "UENUM")
                    {
                        for(; Index < Tokens.Length && Tokens[Index].Text != ";"; Index++)
                        {
                            if(Tokens[Index].Text == "{")
                            {
                                DefinitionIndex = Index + 1;
                                break;
                            }
                        }
                    }

                    // Create the definition
                    return new MetadataDirective(File, DirectiveIndex, DirectiveEndIndex, DefinitionIndex, NodeList);
                }
            }
            return null;
        }
コード例 #4
0
 public SourceTokenRef(SourceFile InFile, int InIndex)
 {
     File = InFile;
     Index = InIndex;
 }
コード例 #5
0
ファイル: Metadata.cs プロジェクト: Tigrouzen/UnrealEngine-4
        public MetadataFile(SourceFile InSourceFile)
        {
            // Set the file
            SourceFile = InSourceFile;

            // Parse the directives
            SourceToken[] Tokens = SourceFile.Tokens;
            for (int Line = 0; Line + 1 < SourceFile.LineToToken.Length; Line++)
            {
                int Index = SourceFile.LineToToken[Line];
                if (Index != SourceFile.LineToToken[Line + 1])
                {
                    MetadataDirective Directive = TryParseDirective(SourceFile, Tokens, Index);
                    if(Directive != null)
                    {
                        Directives.Add(Directive);
                    }
                }
            }
        }
コード例 #6
0
        public static SourceFile Read(string InPath)
        {
            string FullPath = Path.GetFullPath(InPath);

            SourceFile Result = null;
            if (!Files.TryGetValue(FullPath, out Result) && File.Exists(FullPath))
            {
                string Text = File.ReadAllText(FullPath);
                Result = new SourceFile(FullPath, Text);
                Files.Add(FullPath, Result);
            }

            return Result;
        }
コード例 #7
0
 public SourceToken(SourceFile InFile, int InOffset, int InLength)
 {
     File = InFile;
     Offset = InOffset;
     Length = InLength;
 }
コード例 #8
0
        public static MetadataFile Read(string Path)
        {
            SourceFile File = SourceFileCache.Read(Path);

            return((File == null)? null : Read(File));
        }
コード例 #9
0
ファイル: SourceFile.cs プロジェクト: n00bk00b/UnrealEngine-1
 public SourceTokenRef(SourceFile InFile, int InIndex)
 {
     File  = InFile;
     Index = InIndex;
 }
コード例 #10
0
ファイル: SourceFile.cs プロジェクト: n00bk00b/UnrealEngine-1
 public SourceToken(SourceFile InFile, int InOffset, int InLength)
 {
     File   = InFile;
     Offset = InOffset;
     Length = InLength;
 }