void ReflectionParser::DumpTree(Cursor const & cursor, size_t level, std::stringstream & outData)
{
  outData << "\n";
  for (size_t i = 0; i < level; ++i)
    outData << "-";

  outData << cursor.GetDisplayName() << ", " << cursor.GetKind();

  for (auto &child : cursor.GetChildren())
  {
    DumpTree(child, level + 1, outData);
  }
}
예제 #2
0
Class::Class(const Cursor &cursor, const Namespace &currentNamespace)
    : LanguageType( cursor, currentNamespace )
    , m_name( cursor.GetDisplayName( ) )
    , m_qualifiedName( cursor.GetType( ).GetDisplayName( ) )
{
    auto displayName = m_metaData.GetNativeString( native_property::DisplayName );

    if (displayName.empty( ))
    {
        m_displayName = m_qualifiedName;
    }
    else
    {
        m_displayName = displayName;
    }

    for (auto &child : cursor.GetChildren( ))
    {
        switch (child.GetKind( ))
        {
        case CXCursor_CXXBaseSpecifier:
        {
            auto baseClass = new BaseClass( child );

            m_baseClasses.emplace_back( baseClass );

            // automatically enable the type if not explicitly disabled
            if (isNativeType( baseClass->name ))
                m_enabled = !m_metaData.GetFlag( native_property::Disable );
        }
            break;
        // constructor
        case CXCursor_Constructor:
            m_constructors.emplace_back( 
                new Constructor( child, currentNamespace, this ) 
            );
            break;
        // field
        case CXCursor_FieldDecl:
            m_fields.emplace_back( 
                new Field( child, currentNamespace, this )
            );
            break;
        // static field
        case CXCursor_VarDecl:
            m_staticFields.emplace_back( 
                new Global( child, Namespace( ), this ) 
            );
            break;
        // method / static method
        case CXCursor_CXXMethod:
            if (child.IsStatic( )) 
            { 
                m_staticMethods.emplace_back( 
                    new Function( child, Namespace( ), this ) 
                );
            }
            else 
            { 
                m_methods.emplace_back( 
                    new Method( child, currentNamespace, this ) 
                );
            }
            break;
        default:
            break;
        }
    }
}
예제 #3
0
Enum::Value::Value(Enum *parent, const Cursor &cursor)
    : key( cursor.GetDisplayName( ) )
    , value( parent->m_qualifiedName + "::" + key )
{

}