21 #include <tjutils/tjutils.h>
25 #define _BRUKER_MODE_STRING_CAP_START_ 1000
26 #define _BRUKER_MODE_STRING_MIN_SIZE_ 256
27 #define _BRUKER_MODE_STRING_CAP_FACTOR_ 3
43 enum compatMode {bruker,notBroken};
54 LDRserBase() : top_level(
true), compmode(notBroken) {}
56 virtual STD_string get_default_file_prefix()
const = 0;
57 virtual STD_string get_description()
const = 0;
59 virtual STD_string get_top_header()
const = 0;
61 virtual STD_string get_prefix(
const LDRbase& ldr)
const = 0;
62 virtual STD_string get_postfix(
const LDRbase& ldr)
const = 0;
64 virtual STD_string extract_valstring(
const STD_string& parstring)
const = 0;
66 virtual STD_string remove_comments(
const STD_string& parstring)
const = 0;
68 virtual STD_string escape_characters(
const STD_string& parstring)
const = 0;
69 virtual STD_string deescape_characters(
const STD_string& parstring)
const = 0;
71 virtual STD_string print_string(
const STD_string& str)
const = 0;
72 virtual STD_string parse_string(
const STD_string& parstring)
const = 0;
74 virtual char left_string_quote()
const = 0;
75 virtual char right_string_quote()
const = 0;
77 virtual STD_string get_blocklabel(
const STD_string& parstring)
const = 0;
78 virtual STD_string get_blockbody(
const STD_string& parstring,
bool including_delimiters)
const = 0;
80 virtual STD_string get_parlabel(
const STD_string& parstring)
const = 0;
82 virtual void remove_next_ldr(STD_string& parstring)
const = 0;
85 compatMode get_jdx_compatmode()
const {
return compmode;}
88 mutable bool top_level;
106 LDRserJDX(compatMode compat_mode=notBroken) {LDRserBase::compmode=compat_mode;}
109 STD_string get_default_file_prefix()
const {
return "jdx";}
110 STD_string get_description()
const {
return "JCAMP-DX (Joint Committee on Atomic and Molecular Physical Data)";}
111 STD_string get_top_header()
const {
return "";}
112 STD_string get_prefix(
const LDRbase& ldr)
const;
113 STD_string get_postfix(
const LDRbase& ldr)
const;
114 STD_string extract_valstring(
const STD_string& parstring)
const;
115 STD_string remove_comments(
const STD_string& parstring)
const;
116 STD_string escape_characters(
const STD_string& parstring)
const;
117 STD_string deescape_characters(
const STD_string& parstring)
const;
118 STD_string print_string(
const STD_string& str)
const;
119 STD_string parse_string(
const STD_string& parstring)
const;
120 char left_string_quote()
const {
return '<';}
121 char right_string_quote()
const {
return '>';}
122 STD_string get_blocklabel(
const STD_string& parstring)
const;
123 STD_string get_blockbody(
const STD_string& parstring,
bool including_delimiters)
const;
124 STD_string get_parlabel(
const STD_string& parstring)
const;
125 void remove_next_ldr(STD_string& parstring)
const;
142 STD_string get_default_file_prefix()
const {
return "xml";}
143 STD_string get_description()
const {
return "XML (Extensible Markup Language)";}
144 STD_string get_top_header()
const {
return "<?xml version=\"1.0\"?>\n";}
145 STD_string get_prefix(
const LDRbase& ldr)
const;
146 STD_string get_postfix(
const LDRbase& ldr)
const;
147 STD_string extract_valstring(
const STD_string& parstring)
const;
148 STD_string remove_comments(
const STD_string& parstring)
const;
149 STD_string escape_characters(
const STD_string& parstring)
const;
150 STD_string deescape_characters(
const STD_string& parstring)
const;
151 STD_string print_string(
const STD_string& str)
const {
return str;}
152 STD_string parse_string(
const STD_string& parstring)
const;
153 char left_string_quote()
const {
return '\'';}
154 char right_string_quote()
const {
return '\'';}
155 STD_string get_blocklabel(
const STD_string& parstring)
const;
156 STD_string get_blockbody(
const STD_string& parstring,
bool including_delimiters)
const;
157 STD_string get_parlabel(
const STD_string& parstring)
const;
158 void remove_next_ldr(STD_string& parstring)
const;
161 STD_string str_between_delimiters(
const STD_string& parstring, STD_string& startdelim, STD_string& enddelim)
const;
162 static STD_string create_well_formed_tag(
const STD_string& ldrlabel);