File: delayedchoiceelementparser.h

package info (click to toggle)
libcitygml 2.5.2-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 2,200 kB
  • sloc: cpp: 8,666; makefile: 15
file content (37 lines) | stat: -rw-r--r-- 1,355 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once

#include <vector>
#include <memory>

#include "parser/elementparser.h"

namespace citygml {

    /**
     * @brief The DelayedChoiceElementParser allows to parse xml elements of which the concrete type is not known in advance
     *
     * The DelayedChoiceElementParser is initialized with a list of possible parses. When the start element of the next node is parsed it chooses the
     * first parser that can handle the element.
     */
    class DelayedChoiceElementParser : public ElementParser {
    public:

        /**
         * @brief creates a DelayedChoiceElementParser
         * @param documentParser
         * @param logger
         * @param choices the parsers to choose from. The DelayedChoiceElementParser takes ownership of the parsers.
         */
        DelayedChoiceElementParser(CityGMLDocumentParser& documentParser, std::shared_ptr<CityGMLLogger> logger, std::vector<ElementParser*> choices);

        // ElementParser interface
        virtual bool startElement(const NodeType::XMLNode& node, Attributes& attributes);
        virtual bool endElement(const NodeType::XMLNode& node, const std::string& characters);
        virtual bool handlesElement(const NodeType::XMLNode& node) const;
        virtual std::string elementParserName() const;

    private:
        std::vector<ElementParser*> m_choices;
    };

}