src/lib/UnescapingProcessor.h
branchv_0
changeset 28 0e7c57d48d1e
parent 27 fd669e73d39a
child 33 c9a158da6c32
equal deleted inserted replaced
27:fd669e73d39a 28:0e7c57d48d1e
       
     1 /**
       
     2  * Relational pipes
       
     3  * Copyright © 2020 František Kučera (Frantovo.cz, GlobalCode.info)
       
     4  *
       
     5  * This program is free software: you can redistribute it and/or modify
       
     6  * it under the terms of the GNU General Public License as published by
       
     7  * the Free Software Foundation, version 3 of the License.
       
     8  *
       
     9  * This program is distributed in the hope that it will be useful,
       
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
       
    12  * GNU General Public License for more details.
       
    13  *
       
    14  * You should have received a copy of the GNU General Public License
       
    15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
       
    16  */
       
    17 #pragma once
       
    18 
       
    19 #include <sstream>
       
    20 
       
    21 #include "INIReader.h"
       
    22 
       
    23 using namespace std;
       
    24 
       
    25 namespace relpipe {
       
    26 namespace in {
       
    27 namespace ini {
       
    28 namespace lib {
       
    29 
       
    30 class UnescapingProcessor {
       
    31 private:
       
    32 protected:
       
    33 	const char ESC = '\\';
       
    34 
       
    35 	std::stringstream& put(std::stringstream& result, const char& ch, int& i) {
       
    36 		result.put(ch);
       
    37 		i++;
       
    38 		return result;
       
    39 	}
       
    40 
       
    41 public:
       
    42 
       
    43 	enum class TextType {
       
    44 		SectionName,
       
    45 		SectionComment,
       
    46 		SectionTag,
       
    47 		EntryKey,
       
    48 		EntryValue,
       
    49 		EntryComment,
       
    50 		Comment,
       
    51 	};
       
    52 
       
    53 	virtual std::string unescape(const std::string& s, const TextType type) = 0;
       
    54 
       
    55 };
       
    56 
       
    57 }
       
    58 }
       
    59 }
       
    60 }