当前位置: 首页>>代码示例>>C#>>正文


C# ITreeAdaptor.GetText方法代码示例

本文整理汇总了C#中ITreeAdaptor.GetText方法的典型用法代码示例。如果您正苦于以下问题:C# ITreeAdaptor.GetText方法的具体用法?C# ITreeAdaptor.GetText怎么用?C# ITreeAdaptor.GetText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITreeAdaptor的用法示例。


在下文中一共展示了ITreeAdaptor.GetText方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EqualsCore

 protected static bool EqualsCore(object t1, object t2, ITreeAdaptor adaptor)
 {
     if ((t1 == null) || (t2 == null))
     {
         return false;
     }
     if (adaptor.GetType(t1) != adaptor.GetType(t2))
     {
         return false;
     }
     if (!adaptor.GetText(t1).Equals(adaptor.GetText(t2)))
     {
         return false;
     }
     int childCount = adaptor.GetChildCount(t1);
     int num2 = adaptor.GetChildCount(t2);
     if (childCount != num2)
     {
         return false;
     }
     for (int i = 0; i < childCount; i++)
     {
         object child = adaptor.GetChild(t1, i);
         object obj3 = adaptor.GetChild(t2, i);
         if (!EqualsCore(child, obj3, adaptor))
         {
             return false;
         }
     }
     return true;
 }
开发者ID:brunolauze,项目名称:mysql-connector-net-6,代码行数:31,代码来源:TreeWizard.cs

示例2: Concatenate_Depth2_Subtree_Name

        // Private interface
        private static string Concatenate_Depth2_Subtree_Name( ITreeAdaptor tree_adapter, object node )
        {
            StringBuilder builder = new StringBuilder();

            builder.Append( tree_adapter.GetText( node ) );

            for ( int i = 0; i < tree_adapter.GetChildCount( node ); i++ )
            {
                object child_node = tree_adapter.GetChild( node, i );
                builder.Append( tree_adapter.GetText( child_node ) );
            }

            return builder.ToString();
        }
开发者ID:bretambrose,项目名称:CCGOnlinePublic,代码行数:15,代码来源:EnumASTUtils.cs

示例3: DefineEdges

 protected virtual IEnumerable<string> DefineEdges(object tree, ITreeAdaptor adaptor)
 {
     if (tree != null)
     {
         int childCount = adaptor.GetChildCount(tree);
         if (childCount != 0)
         {
             string iteratorVariable1 = "n" + this.GetNodeNumber(tree);
             string text = adaptor.GetText(tree);
             for (int i = 0; i < childCount; i++)
             {
                 object child = adaptor.GetChild(tree, i);
                 string iteratorVariable5 = adaptor.GetText(child);
                 string iteratorVariable6 = "n" + this.GetNodeNumber(child);
                 yield return string.Format("  {0} -> {1} // \"{2}\" -> \"{3}\"", new object[] { iteratorVariable1, iteratorVariable6, this.FixString(text), this.FixString(iteratorVariable5) });
                 foreach (string iteratorVariable7 in this.DefineEdges(child, adaptor))
                 {
                     yield return iteratorVariable7;
                 }
             }
         }
     }
 }
开发者ID:brunolauze,项目名称:mysql-connector-net-6,代码行数:23,代码来源:DotTreeGenerator.cs

示例4: _Equals

 protected static bool _Equals( object t1, object t2, ITreeAdaptor adaptor )
 {
     // make sure both are non-null
     if ( t1 == null || t2 == null )
     {
         return false;
     }
     // check roots
     if ( adaptor.GetType( t1 ) != adaptor.GetType( t2 ) )
     {
         return false;
     }
     if ( !adaptor.GetText( t1 ).Equals( adaptor.GetText( t2 ) ) )
     {
         return false;
     }
     // check children
     int n1 = adaptor.GetChildCount( t1 );
     int n2 = adaptor.GetChildCount( t2 );
     if ( n1 != n2 )
     {
         return false;
     }
     for ( int i = 0; i < n1; i++ )
     {
         object child1 = adaptor.GetChild( t1, i );
         object child2 = adaptor.GetChild( t2, i );
         if ( !_Equals( child1, child2, adaptor ) )
         {
             return false;
         }
     }
     return true;
 }
开发者ID:ksmyth,项目名称:antlr,代码行数:34,代码来源:TreeWizard.cs

示例5: GetNodeText

 protected virtual string GetNodeText(ITreeAdaptor adaptor, object t) {
     string text = adaptor.GetText(t);
     string uniqueName = "n" + GetNodeNumber(t);
     return string.Format(NodeFormat, uniqueName, FixString(text));
 }
开发者ID:jjchaverra,项目名称:antlr3,代码行数:5,代码来源:DOTTreeGenerator.cs

示例6: DefineEdges

        protected virtual IEnumerable<string> DefineEdges(object tree, ITreeAdaptor adaptor) {
            if (tree == null)
                yield break;

            int n = adaptor.GetChildCount(tree);
            if (n == 0) {
                // must have already dumped as child from previous
                // invocation; do nothing
                yield break;
            }

            string parentName = "n" + GetNodeNumber(tree);

            // for each child, do a parent -> child edge using unique node names
            string parentText = adaptor.GetText(tree);
            for (int i = 0; i < n; i++) {
                object child = adaptor.GetChild(tree, i);
                string childText = adaptor.GetText(child);
                string childName = "n" + GetNodeNumber(child);
                yield return string.Format(EdgeFormat, parentName, childName, FixString(parentText), FixString(childText));
                foreach (var t in DefineEdges(child, adaptor))
                    yield return t;
            }
        }
开发者ID:jjchaverra,项目名称:antlr3,代码行数:24,代码来源:DOTTreeGenerator.cs

示例7: Walk_Enum_AST

        private static CEnumRecord Walk_Enum_AST( object root_node, ITreeAdaptor tree_adapter, string file_name_with_path )
        {
            string name_space = String.Empty;
            string extension_enum_name = String.Empty;

            if ( tree_adapter.GetChildCount( root_node ) != 3 )
            {
                throw new Exception( "Parse Error: Enum parse tree root does not have three children" );
            }

            EEnumFlags flags = EEnumFlags.None;
            object begin_settings_node = tree_adapter.GetChild( root_node, 0 );

            for ( int i = 0; i < tree_adapter.GetChildCount( begin_settings_node ); i++ )
            {
                object setting_node = tree_adapter.GetChild( begin_settings_node, i );
                switch ( tree_adapter.GetToken( setting_node ).Type )
                {
                    case EnumReflectorParser.BITFIELD:
                        flags |= EEnumFlags.IsBitfield;
                        break;

                    case EnumReflectorParser.EXTENDS:
                    {
                        if ( tree_adapter.GetChildCount( setting_node ) != 1 )
                        {
                            throw new Exception( "Parse Error: extension clause does not have a single child qualified identifier node" );
                        }

                        object extension_name_node = tree_adapter.GetChild( setting_node, 0 );
                        extension_enum_name = Concatenate_Depth2_Subtree_Name( tree_adapter, extension_name_node );
                        break;
                    }

                    default:
                        break;
                }
            }

            object enum_entry_point_node = tree_adapter.GetChild( root_node, 1 );
            object enum_definition_node = enum_entry_point_node;
            if ( tree_adapter.GetToken( enum_entry_point_node ).Type == EnumReflectorParser.NAMESPACE )
            {
                object namespace_name_node = tree_adapter.GetChild( enum_entry_point_node, 0 );
                name_space = Concatenate_Depth2_Subtree_Name( tree_adapter, namespace_name_node );

                enum_definition_node = tree_adapter.GetChild( enum_entry_point_node, 1 );
            }

            if ( tree_adapter.GetChildCount( enum_definition_node ) != 2 )
            {
                throw new Exception( "Parse Error: Enum definition node does not have two children" );
            }

            object enum_name_node = tree_adapter.GetChild( enum_definition_node, 0 );
            if ( tree_adapter.GetToken( enum_name_node ).Type != EnumReflectorParser.ID )
            {
                throw new Exception( "Parse Error: Enum definition missing name" );
            }

            string enum_name = tree_adapter.GetText( enum_name_node );

            CLogInterface.Write_Line( "Processing Enum " + name_space + "::" + enum_name + ", Flags = " + flags.ToString() );

            CEnumRecord enum_record = new CEnumRecord( enum_name, file_name_with_path, name_space, extension_enum_name, flags );
            enum_record.HeaderFileID = CEnumReflector.HeaderFileTracker.Get_Header_ID_By_File_Path( file_name_with_path ).ID;

            int current_value = 0;
            object enum_entry_list_node = tree_adapter.GetChild( enum_definition_node, 1 );
            for ( int i = 0; i < tree_adapter.GetChildCount( enum_entry_list_node ); i++ )
            {
                object enum_entry_node = tree_adapter.GetChild( enum_entry_list_node, i );

                string qualified_entry_name = tree_adapter.GetText( enum_entry_node );
                if ( name_space.Length > 0 )
                {
                    qualified_entry_name = name_space + "::" + qualified_entry_name;
                }

                string entry_conversion_name = "";
                bool can_bind_value = extension_enum_name.Length == 0;
                bool bound_value = false;
                string bound_name = "";

                for ( int j = 0; j < tree_adapter.GetChildCount( enum_entry_node ); j++ )
                {
                    object enum_entry_sub_node = tree_adapter.GetChild( enum_entry_node, j );
                    int sub_node_token_type = tree_adapter.GetToken( enum_entry_sub_node ).Type;

                    if ( sub_node_token_type == EnumReflectorParser.ENUM_ENTRY )
                    {
                        if ( tree_adapter.GetChildCount( enum_entry_sub_node ) != 1 )
                        {
                            throw new Exception( "Enum entry conversion tag has invalid child count" );
                        }

                        string quoted_string = tree_adapter.GetText( tree_adapter.GetChild( enum_entry_sub_node, 0 ) );
                        entry_conversion_name = quoted_string.Substring( 1, quoted_string.Length - 2 );
                    }
                    else if ( sub_node_token_type == EnumReflectorParser.POSITIVE_INTEGER16 )
//.........这里部分代码省略.........
开发者ID:bretambrose,项目名称:CCGOnlinePublic,代码行数:101,代码来源:EnumASTUtils.cs

示例8: GetNodeText

 protected virtual string GetNodeText(ITreeAdaptor adaptor, object t)
 {
     string text = adaptor.GetText(t);
     string str2 = "n" + this.GetNodeNumber(t);
     return string.Format("  {0} [label=\"{1}\"];", str2, this.FixString(text));
 }
开发者ID:brunolauze,项目名称:mysql-connector-net-6,代码行数:6,代码来源:DotTreeGenerator.cs


注:本文中的ITreeAdaptor.GetText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。