File indexing completed on 2023-03-17 10:51:48
0001 #ifndef DETECTOR_DESCRIPTION_PARSER_DDL_SAX2_FILE_HANDLER_H
0002 #define DETECTOR_DESCRIPTION_PARSER_DDL_SAX2_FILE_HANDLER_H
0003
0004 #include <cstddef>
0005 #include <map>
0006 #include <string>
0007 #include <vector>
0008 #include <xercesc/sax2/Attributes.hpp>
0009
0010 #include "DetectorDescription/Core/interface/DDCompactView.h"
0011 #include "DetectorDescription/Core/interface/DDName.h"
0012 #include "DetectorDescription/Parser/interface/DDLElementRegistry.h"
0013 #include "DetectorDescription/Parser/interface/DDLSAX2Handler.h"
0014
0015 class DDCompactView;
0016 class DDLElementRegistry;
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 class DDLSAX2FileHandler : public DDLSAX2Handler {
0036 public:
0037 DDLSAX2FileHandler(DDCompactView& cpv, DDLElementRegistry&);
0038 ~DDLSAX2FileHandler() override;
0039
0040 void init();
0041
0042
0043
0044
0045
0046 void startElement(const XMLCh* uri, const XMLCh* localname, const XMLCh* qname, const Attributes& attrs) override;
0047 void endElement(const XMLCh* uri, const XMLCh* localname, const XMLCh* qname) override;
0048 void characters(const XMLCh* chars, XMLSize_t length) override;
0049 void comment(const XMLCh* chars, XMLSize_t length) override;
0050
0051
0052 void createDDConstants() const;
0053
0054 protected:
0055 DDLElementRegistry& registry() { return registry_; }
0056
0057 private:
0058 virtual const std::string& parent() const;
0059 virtual const std::string& self() const;
0060
0061 private:
0062 std::vector<std::string> namesMap_;
0063 std::vector<size_t> names_;
0064 DDCompactView& cpv_;
0065 DDLElementRegistry& registry_;
0066 };
0067
0068 #endif