Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/utils/handlers/GeneralHandler.h
193689 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2026 German Aerospace Center (DLR) and others.
4
// This program and the accompanying materials are made available under the
5
// terms of the Eclipse Public License 2.0 which is available at
6
// https://www.eclipse.org/legal/epl-2.0/
7
// This Source Code may also be made available under the following Secondary
8
// Licenses when the conditions for such availability set forth in the Eclipse
9
// Public License 2.0 are satisfied: GNU General Public License, version 2
10
// or later which is available at
11
// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13
/****************************************************************************/
14
/// @file GeneralHandler.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Sep 2021
17
///
18
// General element handler
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include <utils/xml/SUMOSAXHandler.h>
24
25
// ===========================================================================
26
// class declaration
27
// ===========================================================================
28
29
class FileBucket;
30
31
// ===========================================================================
32
// class definitions
33
// ===========================================================================
34
35
class GeneralHandler : public SUMOSAXHandler {
36
37
public:
38
/**@brief Constructor
39
* @param[in] bucket FileBucket in which place the element
40
*/
41
GeneralHandler(FileBucket* fileBucket);
42
43
/// @brief Destructor
44
~GeneralHandler();
45
46
/// @brief parse
47
bool parse();
48
49
private:
50
/// @brief start element
51
virtual void beginTag(SumoXMLTag tag, const SUMOSAXAttributes& attrs) = 0;
52
53
/// @brief end element
54
virtual void endTag() = 0;
55
56
/// @name inherited from SUMOSAXHandler
57
/// @{
58
/** @brief Called on the opening of a tag;
59
*
60
* @param[in] element ID of the currently opened element
61
* @param[in] attrs Attributes within the currently opened element
62
* @exception ProcessError If something fails
63
* @see GenericSAXHandler::myStartElement
64
* @todo Refactor/describe
65
*/
66
void myStartElement(int element, const SUMOSAXAttributes& attrs);
67
68
/** @brief Called when a closing tag occurs
69
*
70
* @param[in] element ID of the currently opened element
71
* @exception ProcessError If something fails
72
* @see GenericSAXHandler::myEndElement
73
* @todo Refactor/describe
74
*/
75
void myEndElement(int element);
76
77
/// @}
78
79
/// @brief invalidate default onstructor
80
GeneralHandler() = delete;
81
82
/// @brief invalidate copy constructor
83
GeneralHandler(const GeneralHandler& s) = delete;
84
85
/// @brief invalidate assignment operator
86
GeneralHandler& operator=(const GeneralHandler& s) = delete;
87
};
88
89
/****************************************************************************/
90
91