src/lib/ASN1Reader.h
author František Kučera <franta-hg@frantovo.cz>
Sat, 24 Jul 2021 17:35:27 +0200
branchv_0
changeset 1 68a281aefa76
permissions -rw-r--r--
import common parser code from relpipe-in-asn1table (85b6f13f1088)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
/**
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
 * Relational pipes
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
 * Copyright © 2021 František Kučera (Frantovo.cz, GlobalCode.info)
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
 *
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
 * This program is free software: you can redistribute it and/or modify
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
 * the Free Software Foundation, version 3 of the License.
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
 *
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
 * GNU General Public License for more details.
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
 *
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
 */
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
#pragma once
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
#include <memory>
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    20
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    21
#include "AbstractParser.h"
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    22
#include "ASN1ContentHandler.h"
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    23
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
namespace relpipe {
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    25
namespace in {
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    26
namespace asn1 {
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    27
namespace lib {
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    28
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    29
class ASN1Reader : public AbstractParser {
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    30
public:
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    31
	virtual ~ASN1Reader() = default;
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    32
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    33
	virtual void addHandler(std::shared_ptr<ASN1ContentHandler> handler) {
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    34
		handlers->addHandler(handler);
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    35
	};
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    36
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    37
	/**
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    38
	 * @param uri identifier of the option
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    39
	 * @param value value of the option
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    40
	 * @return whether this option is supported and was applied here
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    41
	 */
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    42
	virtual bool setOption(const std::string& uri, const std::string& value) {
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    43
		return false;
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    44
	}
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    45
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    46
protected:
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    47
	std::shared_ptr<ASN1ContentHandlerProxy> handlers = std::make_shared<ASN1ContentHandlerProxy>();
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    48
};
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    49
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    50
}
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    51
}
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    52
}
68a281aefa76 import common parser code from relpipe-in-asn1table (85b6f13f1088)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    53
}