src/lib/JavaPropertiesDialect.h
author František Kučera <franta-hg@frantovo.cz>
Sun, 31 Oct 2021 17:30:40 +0100
branchv_0
changeset 33 c9a158da6c32
parent 29 06aaad12c207
permissions -rw-r--r--
java-manifest-mf dialect for parsing MANIFEST.MF files (import shared code from relpipe-in-ini)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
/**
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
 * Relational pipes
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
 * Copyright © 2020 František Kučera (Frantovo.cz, GlobalCode.info)
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
 *
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
 * This program is free software: you can redistribute it and/or modify
06aaad12c207 configurable dialects: in separate classes
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
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
 * the Free Software Foundation, version 3 of the License.
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
 *
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
 * GNU General Public License for more details.
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
 *
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
 */
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
#pragma once
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
#include "Dialect.h"
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    20
#include "uri.h"
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    21
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    22
using namespace std;
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    23
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
namespace relpipe {
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    25
namespace in {
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    26
namespace ini {
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    27
namespace lib {
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    28
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    29
class JavaPropertiesDialect : public Dialect {
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    30
public:
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    31
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    32
	void apply(INIReader& reader) override {
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    33
		reader.setOption(option::TrimContinuingLines, "true");
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    34
		reader.setOption(option::AllowSections, "false");
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    35
		reader.setOption(option::AllowSectionTags, "false");
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    36
		reader.setOption(option::AllowSubKeys, "false");
33
c9a158da6c32 java-manifest-mf dialect for parsing MANIFEST.MF files (import shared code from relpipe-in-ini)
František Kučera <franta-hg@frantovo.cz>
parents: 29
diff changeset
    37
		reader.setOption(option::CommentSeparators, "#!");
c9a158da6c32 java-manifest-mf dialect for parsing MANIFEST.MF files (import shared code from relpipe-in-ini)
František Kučera <franta-hg@frantovo.cz>
parents: 29
diff changeset
    38
		reader.setOption(option::KeyValueSeparators, "=");
29
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    39
		reader.setOption(option::Quotes, "");
33
c9a158da6c32 java-manifest-mf dialect for parsing MANIFEST.MF files (import shared code from relpipe-in-ini)
František Kučera <franta-hg@frantovo.cz>
parents: 29
diff changeset
    40
		reader.setOption(option::AllowLineContinuationWithEscaping, "true");
c9a158da6c32 java-manifest-mf dialect for parsing MANIFEST.MF files (import shared code from relpipe-in-ini)
František Kučera <franta-hg@frantovo.cz>
parents: 29
diff changeset
    41
		reader.setOption(option::AllowLineContinuationWithSpace, "false");
29
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    42
		// reader.setOption(unescaping::Basic, "false"); // TODO: maybe disable basic escaping and do exactly what is specified in JavaPropertiesUnescapingProcessor
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    43
		reader.setOption(unescaping::JavaProperties, "true");
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    44
	}
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    45
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    46
};
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    47
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    48
}
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    49
}
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    50
}
06aaad12c207 configurable dialects: in separate classes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    51
}