Commit 7e3e890f authored by Dimitri van Heesch's avatar Dimitri van Heesch
Browse files

Added get filter, unified index properties

parent 064992b0
Loading
Loading
Loading
Loading
+66 −2
Original line number Original line Diff line number Diff line
@@ -658,6 +658,11 @@ class TranslateContext::Private : public PropertyMapper
      static bool extractAll = Config_getBool("EXTRACT_ALL");
      static bool extractAll = Config_getBool("EXTRACT_ALL");
      return theTranslator->trFileMembersDescription(extractAll);
      return theTranslator->trFileMembersDescription(extractAll);
    }
    }
    TemplateVariant namespaceMembersDescription() const
    {
      static bool extractAll = Config_getBool("EXTRACT_ALL");
      return theTranslator->trNamespaceMemberDescription(extractAll);
    }
    TemplateVariant relatedPagesDesc() const
    TemplateVariant relatedPagesDesc() const
    {
    {
      return theTranslator->trRelatedPagesDescription();
      return theTranslator->trRelatedPagesDescription();
@@ -980,6 +985,8 @@ class TranslateContext::Private : public PropertyMapper
      addProperty("related",            this,&Private::related);
      addProperty("related",            this,&Private::related);
      //%% string macros
      //%% string macros
      addProperty("macros",             this,&Private::macros);
      addProperty("macros",             this,&Private::macros);
      //%% string namespaceMembersDescription
      addProperty("namespaceMembersDescription",this,&Private::namespaceMembersDescription);


      m_javaOpt    = Config_getBool("OPTIMIZE_OUTPUT_JAVA");
      m_javaOpt    = Config_getBool("OPTIMIZE_OUTPUT_JAVA");
      m_fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
      m_fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
@@ -3131,6 +3138,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
      addProperty("eventAttrs",          this,&Private::eventAttrs);
      addProperty("eventAttrs",          this,&Private::eventAttrs);
      addProperty("class",               this,&Private::getClass);
      addProperty("class",               this,&Private::getClass);
      addProperty("file",                this,&Private::getFile);
      addProperty("file",                this,&Private::getFile);
      addProperty("namespace",           this,&Private::getNamespace);
      addProperty("definition",          this,&Private::definition);
      addProperty("definition",          this,&Private::definition);
      addProperty("parameters",          this,&Private::parameters);
      addProperty("parameters",          this,&Private::parameters);
      addProperty("hasParameterList",    this,&Private::hasParameterList);
      addProperty("hasParameterList",    this,&Private::hasParameterList);
@@ -3610,6 +3618,21 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
        return TemplateVariant(FALSE);
        return TemplateVariant(FALSE);
      }
      }
    }
    }
    TemplateVariant getNamespace() const
    {
      if (!m_cache.namespaceDef && m_memberDef->getNamespaceDef())
      {
        m_cache.namespaceDef.reset(NamespaceContext::alloc(m_memberDef->getNamespaceDef()));
      }
      if (m_cache.namespaceDef)
      {
        return m_cache.namespaceDef.get();
      }
      else
      {
        return TemplateVariant(FALSE);
      }
    }
    TemplateVariant definition() const
    TemplateVariant definition() const
    {
    {
      return createLinkedText(m_memberDef,relPathAsString(),
      return createLinkedText(m_memberDef,relPathAsString(),
@@ -4041,6 +4064,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
      SharedPtr<ArgumentListContext> arguments;
      SharedPtr<ArgumentListContext> arguments;
      SharedPtr<MemberListContext>   enumValues;
      SharedPtr<MemberListContext>   enumValues;
      SharedPtr<FileContext>         fileDef;
      SharedPtr<FileContext>         fileDef;
      SharedPtr<NamespaceContext>    namespaceDef;
      SharedPtr<ClassContext>        classDef;
      SharedPtr<ClassContext>        classDef;
      SharedPtr<ClassContext>        anonymousType;
      SharedPtr<ClassContext>        anonymousType;
      SharedPtr<TemplateList>        templateDecls;
      SharedPtr<TemplateList>        templateDecls;
@@ -6519,6 +6543,9 @@ class GlobalsIndexContext::Private : public PropertyMapper
      addProperty("enums",       this,&Private::enums);
      addProperty("enums",       this,&Private::enums);
      addProperty("enumValues",  this,&Private::enumValues);
      addProperty("enumValues",  this,&Private::enumValues);
      addProperty("macros",      this,&Private::macros);
      addProperty("macros",      this,&Private::macros);
      addProperty("properties",  this,&Private::properties);
      addProperty("events",      this,&Private::events);
      addProperty("related",     this,&Private::related);
      addProperty("fileName",    this,&Private::fileName);
      addProperty("fileName",    this,&Private::fileName);
      addProperty("relPath",     this,&Private::relPath);
      addProperty("relPath",     this,&Private::relPath);
      addProperty("highlight",   this,&Private::highlight);
      addProperty("highlight",   this,&Private::highlight);
@@ -6582,6 +6609,18 @@ class GlobalsIndexContext::Private : public PropertyMapper
    {
    {
      return getMembersFiltered(m_cache.macros,&MemberDef::isDefine);
      return getMembersFiltered(m_cache.macros,&MemberDef::isDefine);
    }
    }
    TemplateVariant properties() const
    {
      return FALSE;
    }
    TemplateVariant events() const
    {
      return FALSE;
    }
    TemplateVariant related() const
    {
      return FALSE;
    }
    TemplateVariant fileName() const
    TemplateVariant fileName() const
    {
    {
      return "globals";
      return "globals";
@@ -6647,7 +6686,8 @@ class ClassMembersIndexContext::Private : public PropertyMapper
      addProperty("variables",   this,&Private::variables);
      addProperty("variables",   this,&Private::variables);
      addProperty("typedefs",    this,&Private::typedefs);
      addProperty("typedefs",    this,&Private::typedefs);
      addProperty("enums",       this,&Private::enums);
      addProperty("enums",       this,&Private::enums);
      addProperty("enumvalues",  this,&Private::enumvalues);
      addProperty("enumValues",  this,&Private::enumValues);
      addProperty("macros",      this,&Private::macros);
      addProperty("properties",  this,&Private::properties);
      addProperty("properties",  this,&Private::properties);
      addProperty("events",      this,&Private::events);
      addProperty("events",      this,&Private::events);
      addProperty("related",     this,&Private::related);
      addProperty("related",     this,&Private::related);
@@ -6706,10 +6746,14 @@ class ClassMembersIndexContext::Private : public PropertyMapper
    {
    {
      return getMembersFiltered(m_cache.enums,&MemberDef::isEnumerate);
      return getMembersFiltered(m_cache.enums,&MemberDef::isEnumerate);
    }
    }
    TemplateVariant enumvalues() const
    TemplateVariant enumValues() const
    {
    {
      return getMembersFiltered(m_cache.enumValues,&MemberDef::isEnumValue);
      return getMembersFiltered(m_cache.enumValues,&MemberDef::isEnumValue);
    }
    }
    TemplateVariant macros() const
    {
      return FALSE;
    }
    TemplateVariant properties() const
    TemplateVariant properties() const
    {
    {
      return getMembersFiltered(m_cache.properties,&MemberDef::isProperty);
      return getMembersFiltered(m_cache.properties,&MemberDef::isProperty);
@@ -6790,6 +6834,10 @@ class NamespaceMembersIndexContext::Private : public PropertyMapper
      addProperty("typedefs",    this,&Private::typedefs);
      addProperty("typedefs",    this,&Private::typedefs);
      addProperty("enums",       this,&Private::enums);
      addProperty("enums",       this,&Private::enums);
      addProperty("enumValues",  this,&Private::enumValues);
      addProperty("enumValues",  this,&Private::enumValues);
      addProperty("macros",      this,&Private::macros);
      addProperty("properties",  this,&Private::properties);
      addProperty("events",      this,&Private::events);
      addProperty("related",     this,&Private::related);
      addProperty("fileName",    this,&Private::fileName);
      addProperty("fileName",    this,&Private::fileName);
      addProperty("relPath",     this,&Private::relPath);
      addProperty("relPath",     this,&Private::relPath);
      addProperty("highlight",   this,&Private::highlight);
      addProperty("highlight",   this,&Private::highlight);
@@ -6849,6 +6897,22 @@ class NamespaceMembersIndexContext::Private : public PropertyMapper
    {
    {
      return getMembersFiltered(m_cache.enumValues,&MemberDef::isEnumValue);
      return getMembersFiltered(m_cache.enumValues,&MemberDef::isEnumValue);
    }
    }
    TemplateVariant macros() const
    {
      return FALSE;
    }
    TemplateVariant properties() const
    {
      return FALSE;
    }
    TemplateVariant events() const
    {
      return FALSE;
    }
    TemplateVariant related() const
    {
      return FALSE;
    }
    TemplateVariant fileName() const
    TemplateVariant fileName() const
    {
    {
      return "namespacemembers";
      return "namespacemembers";
+24 −0
Original line number Original line Diff line number Diff line
@@ -768,6 +768,29 @@ class FilterAdd
    }
    }
};
};


//-----------------------------------------------------------------------------

/** @brief The implementation of the "get" filter */
class FilterGet
{
  public:
    static TemplateVariant apply(const TemplateVariant &v,const TemplateVariant &arg)
    {
      if (v.isValid() && v.type()==TemplateVariant::Struct && arg.type()==TemplateVariant::String)
      {
        TemplateVariant result = v.toStruct()->get(arg.toString());
        //printf("\nok[%s]=%d\n",arg.toString().data(),result.type());
        return result;
      }
      else
      {
        //printf("\nnok[%s]\n",arg.toString().data());
        return FALSE;
      }
    }
};


//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------


/** @brief The implementation of the "append" filter */
/** @brief The implementation of the "append" filter */
@@ -1356,6 +1379,7 @@ class TemplateFilterFactory


// register a handlers for each filter we support
// register a handlers for each filter we support
static TemplateFilterFactory::AutoRegister<FilterAdd>         fAdd("add");
static TemplateFilterFactory::AutoRegister<FilterAdd>         fAdd("add");
static TemplateFilterFactory::AutoRegister<FilterGet>         fGet("get");
static TemplateFilterFactory::AutoRegister<FilterAppend>      fAppend("append");
static TemplateFilterFactory::AutoRegister<FilterAppend>      fAppend("append");
static TemplateFilterFactory::AutoRegister<FilterLength>      fLength("length");
static TemplateFilterFactory::AutoRegister<FilterLength>      fLength("length");
static TemplateFilterFactory::AutoRegister<FilterNoWrap>      fNoWrap("nowrap");
static TemplateFilterFactory::AutoRegister<FilterNoWrap>      fNoWrap("nowrap");