diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2014-07-13 13:03:24 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2014-08-02 12:36:45 (GMT) |
commit | 7e3e890fedfb20e7018fadfa87ed97eef7f2b720 (patch) | |
tree | f723fb9267ff92228c57b6bec9ccc4cdbaaa8f5a /src/template.cpp | |
parent | 064992b0c901661b49de24ce1a1d9a06e9957a93 (diff) | |
download | Doxygen-7e3e890fedfb20e7018fadfa87ed97eef7f2b720.zip Doxygen-7e3e890fedfb20e7018fadfa87ed97eef7f2b720.tar.gz Doxygen-7e3e890fedfb20e7018fadfa87ed97eef7f2b720.tar.bz2 |
Added get filter, unified index properties
Diffstat (limited to 'src/template.cpp')
-rw-r--r-- | src/template.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/template.cpp b/src/template.cpp index 9070b98..2f9f69c 100644 --- a/src/template.cpp +++ b/src/template.cpp @@ -770,6 +770,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 */ class FilterAppend { @@ -1356,6 +1379,7 @@ class TemplateFilterFactory // register a handlers for each filter we support static TemplateFilterFactory::AutoRegister<FilterAdd> fAdd("add"); +static TemplateFilterFactory::AutoRegister<FilterGet> fGet("get"); static TemplateFilterFactory::AutoRegister<FilterAppend> fAppend("append"); static TemplateFilterFactory::AutoRegister<FilterLength> fLength("length"); static TemplateFilterFactory::AutoRegister<FilterNoWrap> fNoWrap("nowrap"); |