Blame view

morfeusz/morfeusz2.h 18.5 KB
Michał Lenart authored
1
2
3
4
5
6
7
8
9
10
11
12
13
/* 
 * File:   morfeusz2.h
 * Author: mlenart
 *
 * Created on 13 czerwiec 2014, 17:28
 */

#ifndef MORFEUSZ2_H
#define	MORFEUSZ2_H

#include <vector>
#include <string>
#include <list>
Michał Lenart authored
14
#include <set>
Michał Lenart authored
15
Michał Lenart authored
16
17
18
19
20
#ifndef __WIN32
#define DLLIMPORT
#else
/* A Windows system.  Need to define DLLIMPORT. */
#if BUILDING_MORFEUSZ
Michał Lenart authored
21
#define DLLIMPORT __declspec (dllexport)
Michał Lenart authored
22
#else
Michał Lenart authored
23
#define DLLIMPORT __declspec (dllimport)
Michał Lenart authored
24
25
#endif
#endif
Michał Lenart authored
26
Michał Lenart authored
27
28
namespace morfeusz {
Michał Lenart authored
29
30
31
    class DLLIMPORT MorphInterpretation;
    class DLLIMPORT Morfeusz;
    class DLLIMPORT ResultsIterator;
Michał Lenart authored
32
    class DLLIMPORT IdResolver;
Michał Lenart authored
33
    class DLLIMPORT MorfeuszException;
Michał Lenart authored
34
35

    enum Charset {
Michał Lenart authored
36
        UTF8 = 11,
Michał Lenart authored
37
38
39
        //    UTF16LE,
        //    UTF16BE,
        //    UTF32,
Michał Lenart authored
40
41
42
        ISO8859_2 = 12,
        CP1250 = 13,
        CP852 = 14
Michał Lenart authored
43
    };
Michał Lenart authored
44
Michał Lenart authored
45
46
47
48
    enum TokenNumbering {
        /**
         * Start from 0. Reset counter for every invocation of Morfeusz::analyze
         */
Michał Lenart authored
49
        SEPARATE_NUMBERING = 201,
Michał Lenart authored
50
Michał Lenart authored
51
52
53
        /**
         * Also start from 0. Reset counter for every invocation of Morfeusz::setTokenNumbering only
         */
Michał Lenart authored
54
        CONTINUOUS_NUMBERING = 202
Michał Lenart authored
55
    };
Michał Lenart authored
56
Michał Lenart authored
57
58
59
60
    enum CaseHandling {
        /**
         * Case-sensitive but allows interpretations that do not match case but there are no alternatives
         */
Michał Lenart authored
61
        CONDITIONALLY_CASE_SENSITIVE = 100,
Michał Lenart authored
62
Michał Lenart authored
63
64
65
        /**
         * Strictly case-sensitive, reject all interpretations that do not match case
         */
Michał Lenart authored
66
        STRICTLY_CASE_SENSITIVE = 101,
Michał Lenart authored
67
Michał Lenart authored
68
69
70
        /**
         * Case-insensitive - ignores case
         */
Michał Lenart authored
71
        IGNORE_CASE = 102
Michał Lenart authored
72
    };
Michał Lenart authored
73
Michał Lenart authored
74
75
76
77
    enum WhitespaceHandling {
        /**
         * Ignore whitespaces
         */
Michał Lenart authored
78
        SKIP_WHITESPACES = 301,
Michał Lenart authored
79
Michał Lenart authored
80
81
82
        /**
         * Append whitespaces to previous MorphInterpretation
         */
Michał Lenart authored
83
        APPEND_WHITESPACES = 302,
Michał Lenart authored
84
Michał Lenart authored
85
86
87
        /**
         * Whitespaces are separate MorphInterpretation objects
         */
Michał Lenart authored
88
        KEEP_WHITESPACES = 303
Michał Lenart authored
89
    };
Michał Lenart authored
90
91

    enum MorfeuszUsage {
Michał Lenart authored
92
93
        ANALYSE_ONLY = 401,
        GENERATE_ONLY = 402,
Michał Lenart authored
94
95
        BOTH_ANALYSE_AND_GENERATE = 403
    };
Michał Lenart authored
96
97
98
99
100
101
102

    /**
     * Performs morphological analysis (analyze methods) and syntesis (generate methods).
     * 
     * It is NOT thread-safe
     * but it is possible to use separate Morfeusz instance for each concurrent thread.
     */
Michał Lenart authored
103
    class DLLIMPORT Morfeusz {
Michał Lenart authored
104
105
    public:
Michał Lenart authored
106
107
108
109
        /**
         * Returns a string containing library version.
         * @return 
         */
Michał Lenart authored
110
        static std::string getVersion();
Michał Lenart authored
111
112
113
114
115
116

        /**
         * Returns a string containing default dictionary name.
         * @return 
         */
        static std::string getDefaultDictName();
Michał Lenart authored
117
Michał Lenart authored
118
119
120
121
        /**
         * Creates actual instance of Morfeusz class.
         * The caller is responsible for destroying it.
         * 
Michał Lenart authored
122
123
         * @remarks NOT THREAD-SAFE (affects ALL Morfeusz instances)
         * @return new instance of Morfeusz.
Michał Lenart authored
124
         */
Michał Lenart authored
125
126
127
128
129
130
131
132
133
134
        static Morfeusz* createInstance(MorfeuszUsage usage=BOTH_ANALYSE_AND_GENERATE);

        /**
         * Creates actual instance of Morfeusz class with possibly non-default dictionary.
         * The caller is responsible for destroying it.
         * 
         * @remarks NOT THREAD-SAFE (affects ALL Morfeusz instances)
         * @return new instance of Morfeusz.
         */
        static Morfeusz* createInstance(const std::string& dictName, MorfeuszUsage usage=BOTH_ANALYSE_AND_GENERATE);
Michał Lenart authored
135
136

        /**
Michał Lenart authored
137
138
139
         * Creates exact copy of Morfeusz object.
         * 
         * @remarks NOT THREAD-SAFE (must have exclusive access to this instance. Does not affect other Morfeusz instances).
Michał Lenart authored
140
141
         */
        virtual Morfeusz* clone() const = 0;
Michał Lenart authored
142
143
144
145
146

        virtual ~Morfeusz();

        /**
         * Analyze given text and return the results as iterator.
Michał Lenart authored
147
148
         * Use this method for analysis of big texts.
         * Copies the text under the hood - use analyze(const char*) if you want to avoid this.
Michał Lenart authored
149
         * 
Michał Lenart authored
150
         * @param text - text for morphological analysis.
Michał Lenart authored
151
         * @remarks NOT THREAD-SAFE (must have exclusive access to this instance. Does not affect other Morfeusz instances).
Michał Lenart authored
152
153
         * @return - iterator over morphological analysis results
         */
Michał Lenart authored
154
        virtual ResultsIterator* analyse(const std::string& text) const = 0;
Michał Lenart authored
155
Michał Lenart authored
156
157
        /**
         * Analyze given text and return the results as iterator.
Michał Lenart authored
158
         * It does not store results for whole text at once, so may be less memory-consuming for analysis of big texts
Michał Lenart authored
159
160
161
         * 
         * 
         * @param text - text for morphological analysis. This pointer must not be deleted before returned ResultsIterator object.
Michał Lenart authored
162
         * @remarks NOT THREAD-SAFE (must have exclusive access to this instance. Does not affect other Morfeusz instances).
Michał Lenart authored
163
164
         * @return - iterator over morphological analysis results
         */
Michał Lenart authored
165
        virtual ResultsIterator* analyse(const char* text) const = 0;
Michał Lenart authored
166
167
168
169
170
171

        /**
         * Perform morphological analysis on a given text and put results in a vector.
         * 
         * @param text - text to be analyzed
         * @param result - results vector
Michał Lenart authored
172
         * @remarks NOT THREAD-SAFE (must have exclusive access to this instance. Does not affect other Morfeusz instances).
Michał Lenart authored
173
         */
Michał Lenart authored
174
        virtual void analyse(const std::string& text, std::vector<MorphInterpretation>& result) const = 0;
Michał Lenart authored
175
176
177
178
179
180

        /**
         * Perform morphological synthesis on a given lemma and put results in a vector.
         * 
         * @param lemma - lemma to be analyzed
         * @param result - results vector
Michał Lenart authored
181
         * @remarks NOT THREAD-SAFE (must have exclusive access to this instance. Does not affect other Morfeusz instances).
Michał Lenart authored
182
         * @throws MorfeuszException - when lemma parameter contains whitespaces.
Michał Lenart authored
183
184
185
186
187
188
189
190
191
192
         */
        virtual void generate(const std::string& lemma, std::vector<MorphInterpretation>& result) const = 0;

        /**
         * Perform morphological synthesis on a given lemma and put results in a vector.
         * Limit results to interpretations with the specified tag.
         * 
         * @param lemma - lemma to be analyzed
         * @param tag - tag of result interpretations
         * @param result - results vector
Michał Lenart authored
193
         * @remarks NOT THREAD-SAFE (must have exclusive access to this instance. Does not affect other Morfeusz instances).
Michał Lenart authored
194
         * @throws MorfeuszException - when lemma parameter contains whitespaces or tagId is outside tagset.
Michał Lenart authored
195
         */
Michał Lenart authored
196
        virtual void generate(const std::string& lemma, int tagId, std::vector<MorphInterpretation>& result) const = 0;
Michał Lenart authored
197
198
199
200
201

        /**
         * Set encoding for input and output string objects.
         * 
         * @param encoding
Michał Lenart authored
202
         * @remarks NOT THREAD-SAFE (must have exclusive access to this instance. Does not affect other Morfeusz instances).
Michał Lenart authored
203
204
         */
        virtual void setCharset(Charset encoding) = 0;
Michał Lenart authored
205
206
207
208
209
210

        /**
         * Get charset used for input and output string objects.
         * @return 
         */
        virtual Charset getCharset() const = 0;
Michał Lenart authored
211
212

        /**
Michał Lenart authored
213
         * Select agglutination rules
Michał Lenart authored
214
215
         * 
         * @param aggl
Michał Lenart authored
216
         * @remarks NOT THREAD-SAFE (must have exclusive access to this instance. Does not affect other Morfeusz instances).
Michał Lenart authored
217
         * @throws MorfeuszException - for invalid aggl parameter.
Michał Lenart authored
218
219
         */
        virtual void setAggl(const std::string& aggl) = 0;
Michał Lenart authored
220
221
222
223
224
225

        /**
         * Get current agglutination rules option
         * @return 
         */
        virtual std::string getAggl() const = 0;
Michał Lenart authored
226
227

        /**
Michał Lenart authored
228
         * Select past tense segmentation
Michał Lenart authored
229
230
         * 
         * @param praet
Michał Lenart authored
231
         * @remarks NOT THREAD-SAFE (must have exclusive access to this instance. Does not affect other Morfeusz instances).
Michał Lenart authored
232
         * @throws MorfeuszException - for invalid aggl praet parameter.
Michał Lenart authored
233
234
         */
        virtual void setPraet(const std::string& praet) = 0;
Michał Lenart authored
235
236
237
238
239
240

        /**
         * Get current past tense segmentation option
         * @return 
         */
        virtual std::string getPraet() const = 0;
Michał Lenart authored
241
242

        /**
Michał Lenart authored
243
         * Set case handling.
Michał Lenart authored
244
245
         * 
         * @param caseSensitive
Michał Lenart authored
246
         * @remarks NOT THREAD-SAFE (must have exclusive access to this instance. Does not affect other Morfeusz instances).
Michał Lenart authored
247
         */
Michał Lenart authored
248
        virtual void setCaseHandling(CaseHandling caseHandling) = 0;
Michał Lenart authored
249
250
251
252
253
254

        /**
         * Get case handling policy.
         * @return 
         */
        virtual CaseHandling getCaseHandling() const = 0;
Michał Lenart authored
255
Michał Lenart authored
256
257
258
259
        /**
         * Set token numbering policy.
         * 
         * @param numbering
Michał Lenart authored
260
         * @remarks NOT THREAD-SAFE (must have exclusive access to this instance. Does not affect other Morfeusz instances).
Michał Lenart authored
261
262
         */
        virtual void setTokenNumbering(TokenNumbering numbering) = 0;
Michał Lenart authored
263
264
265
266
267
268

        /**
         * Get token numbering policy.
         * @return 
         */
        virtual TokenNumbering getTokenNumbering() const = 0;
Michał Lenart authored
269
Michał Lenart authored
270
271
272
273
        /**
         * Set whitespace handling.
         * 
         * @param numbering
Michał Lenart authored
274
         * @remarks NOT THREAD-SAFE (must have exclusive access to this instance. Does not affect other Morfeusz instances).
Michał Lenart authored
275
276
         */
        virtual void setWhitespaceHandling(WhitespaceHandling whitespaceHandling) = 0;
Michał Lenart authored
277
278
279
280
281
282

        /**
         * Get whitespace handling.
         * @return 
         */
        virtual WhitespaceHandling getWhitespaceHandling() const = 0;
Michał Lenart authored
283
284
285
286
287
288
289

        /**
         * Set debug option value.
         * 
         * @param debug
         */
        virtual void setDebug(bool debug) = 0;
Michał Lenart authored
290
Michał Lenart authored
291
        /**
Michał Lenart authored
292
293
294
         * Get reference to tagset currently being in use.
         * 
         * @return currently used tagset
Michał Lenart authored
295
         */
Michał Lenart authored
296
        virtual const IdResolver& getIdResolver() const = 0;
Michał Lenart authored
297
Michał Lenart authored
298
        /**
Michał Lenart authored
299
300
         * Set current dictionary to the one with provided name.
         * 
Michał Lenart authored
301
         * This is NOT THREAD SAFE - no other thread may invoke setDictionary 
Michał Lenart authored
302
303
304
         * either within this instance, or any other in the same application.
         * 
         * @param dictName dictionary name
Michał Lenart authored
305
         * @remarks NOT THREAD-SAFE (affects ALL Morfeusz instances)
Michał Lenart authored
306
307
         * @throws MorfeuszException - when dictionary not found.
         * @throws std::ios_base::failure - when IO error occurred when loading given dictionary.
Michał Lenart authored
308
         */
Michał Lenart authored
309
310
311
312
        virtual void setDictionary(const std::string& dictName) = 0;

        /**
         * List of paths where current Morfeusz instance will look for dictionaries.
Michał Lenart authored
313
         * Modifying it is NOT THREAD-SAFE.
Michał Lenart authored
314
         */
Michał Lenart authored
315
        static std::list<std::string> dictionarySearchPaths;
Michał Lenart authored
316
Michał Lenart authored
317
        /**
Michał Lenart authored
318
319
         * Get available parameters for "setAggl" method.
         * @return 
Michał Lenart authored
320
         */
Michał Lenart authored
321
322
323
324
325
326
327
        virtual const std::set<std::string>& getAvailableAgglOptions() const = 0;

        /**
         * Get available parameters for "setPraet" method.
         * @return 
         */
        virtual const std::set<std::string>& getAvailablePraetOptions() const = 0;
Michał Lenart authored
328
Michał Lenart authored
329
330
331
332
333
    protected:
        /**
         * Same as analyze(text) but copies the text under the hood.
         * Useful for wrappers to other languages.
         */
Michał Lenart authored
334
        virtual ResultsIterator* analyseWithCopy(const char* text) const = 0;
Michał Lenart authored
335
336
    };
Michał Lenart authored
337
    class DLLIMPORT ResultsIterator {
Michał Lenart authored
338
    public:
Michał Lenart authored
339
340
341
342
        /**
         * 
         * @return true iff this iterator contains more elements.
         */
Michał Lenart authored
343
        virtual bool hasNext() = 0;
Michał Lenart authored
344
345
346
347
348
349

        /**
         * 
         * @return the element, that will be returned in next next() invocation.
         * @throws std::out_of_range when this iterator has already reached the end.
         */
Michał Lenart authored
350
        virtual const MorphInterpretation& peek() = 0;
Michał Lenart authored
351
352
353
354
355
356

        /**
         * 
         * @return next analysis result.
         * @throws std::out_of_range when this iterator has already reached the end.
         */
Michał Lenart authored
357
        virtual MorphInterpretation next() = 0;
Michał Lenart authored
358
Michał Lenart authored
359
360
        virtual ~ResultsIterator() {
        }
Michał Lenart authored
361
    };
Michał Lenart authored
362
363

    /**
Michał Lenart authored
364
     * Represents mappings for tags, names and labels.
Michał Lenart authored
365
     */
Michał Lenart authored
366
    class DLLIMPORT IdResolver {
Michał Lenart authored
367
    public:
Michał Lenart authored
368
369
370
371
372
373
374

        /**
         * Returns current TAGSET-ID (as specified in first line of tagset file)
         * 
         * @return tagset id string
         */
        virtual const std::string getTagsetId() const = 0;
Michał Lenart authored
375
Michał Lenart authored
376
377
378
379
380
        /**
         * Returns tag (denoted by its index).
         * 
         * @param tagNum - tag index in the tagset.
         * @return - the tag
Michał Lenart authored
381
         * @throws std::out_of_range when invalid tagId is provided.
Michał Lenart authored
382
         */
Michał Lenart authored
383
        virtual const std::string& getTag(const int tagId) const = 0;
Michał Lenart authored
384
Michał Lenart authored
385
386
387
388
389
        /**
         * Returns identifier for given tag.
         * Throws MorfeuszException when none exists.
         * 
         * @return identifier for given tag
Michał Lenart authored
390
         * @throws MorfeuszException when invalid tag parameter is provided.
Michał Lenart authored
391
392
         */
        virtual int getTagId(const std::string& tag) const = 0;
Michał Lenart authored
393
394
395
396
397
398

        /**
         * Returns named entity type (denoted by its index).
         * 
         * @param nameNum - name index in the tagset.
         * @return - the named entity type
Michał Lenart authored
399
         * @throws std::out_of_range when invalid nameId is provided.
Michał Lenart authored
400
         */
Michał Lenart authored
401
        virtual const std::string& getName(const int nameId) const = 0;
Michał Lenart authored
402
Michał Lenart authored
403
404
405
406
407
        /**
         * Returns identifier for given named entity.
         * Throws MorfeuszException when none exists.
         * 
         * @return identifier for given named entity
Michał Lenart authored
408
         * @throws MorfeuszException when invalid name parameter is provided.
Michał Lenart authored
409
410
         */
        virtual int getNameId(const std::string& name) const = 0;
Michał Lenart authored
411
Michał Lenart authored
412
413
414
415
416
417
418
        /**
         * Returns labels string for given labelsId.
         * 
         * @param labelsId
         * @return labels as string
         * @throws std::out_of_range when invalid labelsId is provided.
         */
Michał Lenart authored
419
        virtual const std::string& getLabelsAsString(int labelsId) const = 0;
Michał Lenart authored
420
Michał Lenart authored
421
422
423
424
425
426
        /**
         * Returns labels as set of strings for given labelsId.
         * @param labelsId
         * @return labels as set of strings
         * @throws std::out_of_range when invalid labelsId is provided.
         */
Michał Lenart authored
427
        virtual const std::set<std::string>& getLabels(int labelsId) const = 0;
Michał Lenart authored
428
Michał Lenart authored
429
430
431
432
433
434
435
        /**
         * Get labelsId for given labels as string.
         * 
         * @param labelsStr
         * @return labelsId
         * @throws MorfeuszException when invalid tag is provided.
         */
Michał Lenart authored
436
        virtual int getLabelsId(const std::string& labelsStr) const = 0;
Michał Lenart authored
437
Michał Lenart authored
438
        /**
Michał Lenart authored
439
         * Returns number of tags this tagset contains.
Michał Lenart authored
440
441
442
         * 
         * @return 
         */
Michał Lenart authored
443
        virtual size_t getTagsCount() const = 0;
Michał Lenart authored
444
Michał Lenart authored
445
        /**
Michał Lenart authored
446
         * Returns number of named entity types this tagset contains.
Michał Lenart authored
447
448
449
         * 
         * @return 
         */
Michał Lenart authored
450
        virtual size_t getNamesCount() const = 0;
Michał Lenart authored
451
Michał Lenart authored
452
453
454
        /**
         * Returns number of different labels combinations.
         */
Michał Lenart authored
455
        virtual size_t getLabelsCount() const = 0;
Michał Lenart authored
456
Michał Lenart authored
457
        virtual ~IdResolver() {
Michał Lenart authored
458
        }
Michał Lenart authored
459
460
    };
Michał Lenart authored
461
    /**
Michał Lenart authored
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
     The result of analysis is  a directed acyclic graph with numbered
     nodes representing positions  in text (points _between_ segments)
     and edges representing interpretations of segments that span from
     one node to another.  E.g.,

         {0,1,"ja","ja","ppron12:sg:nom:m1.m2.m3.f.n1.n2:pri"}
         |
         |      {1,2,"został","zostać","praet:sg:m1.m2.m3:perf"}
         |      |
       __|  ____|   __{2,3,"em","być","aglt:sg:pri:imperf:wok"}
      /  \ /     \ / \
     * Ja * został*em *
     0    1       2   3

     Note that the word 'zostałem' got broken into 2 separate segments.
Michał Lenart authored
477
     * One MorphInterpretation instance describes one edge of this DAG.
Michał Lenart authored
478
     */
Michał Lenart authored
479
    struct DLLIMPORT MorphInterpretation {
Michał Lenart authored
480
481
482
483

        MorphInterpretation()
        : startNode(0), endNode(0), orth(), lemma(), tagId(0), nameId(0), labelsId(0) {}
Michał Lenart authored
484
485
486
        /**
         * Creates new instance with "ign" tag (meaning: "not found in the dictionary")
         */
Michał Lenart authored
487
        static MorphInterpretation createIgn(
Michał Lenart authored
488
489
                int startNode, int endNode,
                const std::string& orth, const std::string& lemma);
Michał Lenart authored
490
Michał Lenart authored
491
492
493
        /**
         * Creates new instance with "sp" tag (meaning: "this is a sequence of whitespaces")
         */
Michał Lenart authored
494
        static MorphInterpretation createWhitespace(int startNode, int endNode, const std::string& orth);
Michał Lenart authored
495
Michał Lenart authored
496
497
498
499
        /**
         * 
         * @return true iff this instance represents an unknown word.
         */
Michał Lenart authored
500
        inline bool isIgn() const {
Michał Lenart authored
501
            return tagId == 0;
Michał Lenart authored
502
        }
Michał Lenart authored
503
Michał Lenart authored
504
505
506
507
        /**
         * 
         * @return true iff this instance represents a whitespace.
         */
Michał Lenart authored
508
        inline bool isWhitespace() const {
Michał Lenart authored
509
            return tagId == 1;
Michał Lenart authored
510
        }
Michał Lenart authored
511
Michał Lenart authored
512
513
514
515
516
517
        /**
         * Get tag as string.
         * 
         * @param morfeusz Morfeusz instance this interpretation was created by.
         * @return 
         */
Michał Lenart authored
518
519
520
521
        inline const std::string& getTag(const Morfeusz& morfeusz) const {
            return morfeusz.getIdResolver().getTag(this->tagId);
        }
Michał Lenart authored
522
523
524
525
526
527
        /**
         * Get name as string.
         * 
         * @param morfeusz Morfeusz instance this interpretation was created by.
         * @return 
         */
Michał Lenart authored
528
529
530
531
        inline const std::string& getName(const Morfeusz& morfeusz) const {
            return morfeusz.getIdResolver().getName(this->nameId);
        }
Michał Lenart authored
532
533
534
535
536
537
        /**
         * Get labels as string.
         * 
         * @param morfeusz Morfeusz instance this interpretation was created by.
         * @return 
         */
Michał Lenart authored
538
539
540
541
        inline const std::string& getLabelsAsString(const Morfeusz& morfeusz) const {
            return morfeusz.getIdResolver().getLabelsAsString(this->labelsId);
        }
Michał Lenart authored
542
543
544
545
546
547
        /**
         * Get tag as set of strings.
         * 
         * @param morfeusz Morfeusz instance this interpretation was created by.
         * @return 
         */
Michał Lenart authored
548
549
550
        inline const std::set<std::string>& getLabels(const Morfeusz& morfeusz) const {
            return morfeusz.getIdResolver().getLabels(this->labelsId);
        }
Michał Lenart authored
551
Michał Lenart authored
552
553
554
555
        int startNode;
        int endNode;
        std::string orth;
        std::string lemma;
Michał Lenart authored
556
557
558
        int tagId;
        int nameId;
        int labelsId;
Michał Lenart authored
559
    };
Michał Lenart authored
560
Michał Lenart authored
561
    class DLLIMPORT MorfeuszException : public std::exception {
Michał Lenart authored
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
    public:

        MorfeuszException(const std::string& what) : msg(what.c_str()) {
        }

        virtual ~MorfeuszException() throw () {
        }

        virtual const char* what() const throw () {
            return this->msg.c_str();
        }
    private:
        const std::string msg;
    };
Michał Lenart authored
577
    class DLLIMPORT FileFormatException : public MorfeuszException {
Michał Lenart authored
578
579
    public:
Michał Lenart authored
580
        FileFormatException(const std::string& what) : MorfeuszException(what) {
Michał Lenart authored
581
582
583
584
585
586
        }
    };
}

#endif	/* MORFEUSZ2_H */