Coverage Report

Created: 2026-09-06 07:18

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libe-book/src/lib/FictionBook2MetadataContext.cpp
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/*
3
 * This file is part of the libe-book project.
4
 *
5
 * This Source Code Form is subject to the terms of the Mozilla Public
6
 * License, v. 2.0. If a copy of the MPL was not distributed with this
7
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
 */
9
10
#include <deque>
11
12
#include <librevenge/librevenge.h>
13
14
#include "FictionBook2Collector.h"
15
#include "FictionBook2MetadataContext.h"
16
#include "FictionBook2Token.h"
17
18
namespace libebook
19
{
20
21
class FictionBook2Authors
22
{
23
public:
24
  struct Data
25
  {
26
    Data();
27
28
    librevenge::RVNGString firstName;
29
    librevenge::RVNGString middleName;
30
    librevenge::RVNGString lastName;
31
    librevenge::RVNGString nickname;
32
  };
33
34
  FictionBook2Authors();
35
36
  void setFirstName(const librevenge::RVNGString &name);
37
  void setMiddleName(const librevenge::RVNGString &name);
38
  void setLastName(const librevenge::RVNGString &name);
39
  void setNickname(const librevenge::RVNGString &name);
40
  void finishAuthor();
41
42
  const std::deque<Data> &getAuthors() const;
43
44
private:
45
  std::deque<Data> m_authors;
46
  Data m_current;
47
};
48
49
}
50
51
namespace libebook
52
{
53
54
FictionBook2Authors::Data::Data()
55
114k
  : firstName()
56
114k
  , middleName()
57
114k
  , lastName()
58
114k
  , nickname()
59
114k
{
60
114k
}
61
62
FictionBook2Authors::FictionBook2Authors()
63
6.14k
  : m_authors()
64
6.14k
  , m_current()
65
6.14k
{
66
6.14k
}
67
68
void FictionBook2Authors::setFirstName(const librevenge::RVNGString &name)
69
22.8k
{
70
22.8k
  m_current.firstName = name;
71
22.8k
}
72
73
void FictionBook2Authors::setMiddleName(const librevenge::RVNGString &name)
74
0
{
75
0
  m_current.middleName = name;
76
0
}
77
78
void FictionBook2Authors::setLastName(const librevenge::RVNGString &name)
79
28.4k
{
80
28.4k
  m_current.lastName = name;
81
28.4k
}
82
83
void FictionBook2Authors::setNickname(const librevenge::RVNGString &name)
84
0
{
85
0
  m_current.nickname = name;
86
0
}
87
88
void FictionBook2Authors::finishAuthor()
89
108k
{
90
108k
  m_authors.push_back(m_current);
91
108k
  m_current = Data();
92
108k
}
93
94
const std::deque<FictionBook2Authors::Data> &FictionBook2Authors::getAuthors() const
95
3.56k
{
96
3.56k
  return m_authors;
97
3.56k
}
98
99
}
100
101
namespace libebook
102
{
103
104
FictionBook2AnnotationContext::FictionBook2AnnotationContext(std::shared_ptr<FictionBook2ParserContext> parentContext, const FictionBook2BlockFormat &format)
105
1.09k
  : FictionBook2BlockFormatContextBase(parentContext, format)
106
1.09k
{
107
1.09k
}
108
109
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2AnnotationContext::element(const FictionBook2TokenData &name, const FictionBook2TokenData &ns)
110
373
{
111
  // TODO: implement me
112
373
  if (FictionBook2Token::NS_FICTIONBOOK == getFictionBook2TokenID(ns))
113
301
  {
114
301
    switch (getFictionBook2TokenID(name))
115
301
    {
116
301
    default :
117
301
      break;
118
301
    }
119
301
  }
120
121
373
  return std::make_shared<FictionBook2SkipElementContext>(shared_from_this());
122
373
}
123
124
void FictionBook2AnnotationContext::startOfElement()
125
1.09k
{
126
  // TODO: implement me
127
1.09k
}
128
129
void FictionBook2AnnotationContext::endOfElement()
130
1.07k
{
131
  // TODO: implement me
132
1.07k
}
133
134
void FictionBook2AnnotationContext::attribute(const FictionBook2TokenData &name, const FictionBook2TokenData *ns, const char *value)
135
2
{
136
  // TODO: implement me
137
2
  (void) value;
138
2
  if (FictionBook2_NO_NAMESPACE(ns))
139
1
  {
140
1
    switch (getFictionBook2TokenID(name))
141
1
    {
142
1
    default :
143
1
      break;
144
1
    }
145
1
  }
146
2
}
147
148
void FictionBook2AnnotationContext::text(const char *)
149
286
{
150
286
}
151
152
FictionBook2AuthorContext::FictionBook2AuthorContext(std::shared_ptr<FictionBook2ParserContext> parentContext, FictionBook2Authors &authors)
153
108k
  : FictionBook2ParserContext(parentContext)
154
108k
  , m_authors(authors)
155
108k
{
156
108k
}
157
158
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2AuthorContext::element(const FictionBook2TokenData &name, const FictionBook2TokenData &ns)
159
52.5k
{
160
52.5k
  if (FictionBook2Token::NS_FICTIONBOOK == getFictionBook2TokenID(ns))
161
52.1k
  {
162
52.1k
    switch (getFictionBook2TokenID(name))
163
52.1k
    {
164
22.6k
    case FictionBook2Token::first_name :
165
22.6k
      return std::make_shared<FictionBook2FirstNameContext>(shared_from_this(), m_authors);
166
0
    case FictionBook2Token::middle_name :
167
0
      return std::make_shared<FictionBook2MiddleNameContext>(shared_from_this(), m_authors);
168
28.4k
    case FictionBook2Token::last_name :
169
28.4k
      return std::make_shared<FictionBook2LastNameContext>(shared_from_this(), m_authors);
170
44
    case FictionBook2Token::nickname :
171
44
      return std::make_shared<FictionBook2NicknameContext>(shared_from_this(), m_authors);
172
0
    case FictionBook2Token::email :
173
0
    case FictionBook2Token::home_page :
174
      // ignore
175
0
      break;
176
992
    default :
177
992
      break;
178
52.1k
    }
179
52.1k
  }
180
181
1.36k
  return std::make_shared<FictionBook2SkipElementContext>(shared_from_this());
182
52.5k
}
183
184
void FictionBook2AuthorContext::startOfElement()
185
108k
{
186
108k
}
187
188
void FictionBook2AuthorContext::endOfElement()
189
108k
{
190
108k
  m_authors.finishAuthor();
191
108k
}
192
193
void FictionBook2AuthorContext::attribute(const FictionBook2TokenData &, const FictionBook2TokenData *, const char *)
194
209
{
195
209
}
196
197
void FictionBook2AuthorContext::text(const char *)
198
5.90k
{
199
5.90k
}
200
201
FictionBook2BookNameContext::FictionBook2BookNameContext(std::shared_ptr<FictionBook2ParserContext> parentContext)
202
0
  : FictionBook2ParserContext(parentContext)
203
0
{
204
0
}
205
206
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2BookNameContext::element(const FictionBook2TokenData &name, const FictionBook2TokenData &ns)
207
0
{
208
  // TODO: implement me
209
0
  if (FictionBook2Token::NS_FICTIONBOOK == getFictionBook2TokenID(ns))
210
0
  {
211
0
    switch (getFictionBook2TokenID(name))
212
0
    {
213
0
    default :
214
0
      break;
215
0
    }
216
0
  }
217
218
0
  return std::make_shared<FictionBook2SkipElementContext>(shared_from_this());
219
0
}
220
221
void FictionBook2BookNameContext::startOfElement()
222
0
{
223
  // TODO: implement me
224
0
}
225
226
void FictionBook2BookNameContext::endOfElement()
227
0
{
228
  // TODO: implement me
229
0
}
230
231
void FictionBook2BookNameContext::attribute(const FictionBook2TokenData &name, const FictionBook2TokenData *ns, const char *value)
232
0
{
233
  // TODO: implement me
234
0
  (void) value;
235
0
  if (FictionBook2_NO_NAMESPACE(ns))
236
0
  {
237
0
    switch (getFictionBook2TokenID(name))
238
0
    {
239
0
    default :
240
0
      break;
241
0
    }
242
0
  }
243
0
}
244
245
void FictionBook2BookNameContext::text(const char *value)
246
0
{
247
  // TODO: implement me
248
0
  librevenge::RVNGString str(value);
249
0
  (void) str;
250
0
}
251
252
FictionBook2BookTitleContext::FictionBook2BookTitleContext(std::shared_ptr<FictionBook2ParserContext> parentContext)
253
4.02k
  : FictionBook2ParserContext(parentContext)
254
4.02k
{
255
4.02k
}
256
257
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2BookTitleContext::element(const FictionBook2TokenData &, const FictionBook2TokenData &)
258
5
{
259
5
  return nullptr;
260
5
}
261
262
void FictionBook2BookTitleContext::startOfElement()
263
4.02k
{
264
4.02k
}
265
266
void FictionBook2BookTitleContext::endOfElement()
267
4.01k
{
268
4.01k
}
269
270
void FictionBook2BookTitleContext::attribute(const FictionBook2TokenData &, const FictionBook2TokenData *, const char *)
271
66
{
272
66
}
273
274
void FictionBook2BookTitleContext::text(const char *value)
275
9.61k
{
276
9.61k
  getCollector()->defineMetadataEntry("dc:subject", value);
277
9.61k
}
278
279
FictionBook2CityContext::FictionBook2CityContext(std::shared_ptr<FictionBook2ParserContext> parentContext)
280
0
  : FictionBook2ParserContext(parentContext)
281
0
{
282
0
}
283
284
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2CityContext::element(const FictionBook2TokenData &name, const FictionBook2TokenData &ns)
285
0
{
286
  // TODO: implement me
287
0
  if (FictionBook2Token::NS_FICTIONBOOK == getFictionBook2TokenID(ns))
288
0
  {
289
0
    switch (getFictionBook2TokenID(name))
290
0
    {
291
0
    default :
292
0
      break;
293
0
    }
294
0
  }
295
296
0
  return std::make_shared<FictionBook2SkipElementContext>(shared_from_this());
297
0
}
298
299
void FictionBook2CityContext::startOfElement()
300
0
{
301
  // TODO: implement me
302
0
}
303
304
void FictionBook2CityContext::endOfElement()
305
0
{
306
  // TODO: implement me
307
0
}
308
309
void FictionBook2CityContext::attribute(const FictionBook2TokenData &name, const FictionBook2TokenData *ns, const char *value)
310
0
{
311
  // TODO: implement me
312
0
  (void) value;
313
0
  if (FictionBook2_NO_NAMESPACE(ns))
314
0
  {
315
0
    switch (getFictionBook2TokenID(name))
316
0
    {
317
0
    default :
318
0
      break;
319
0
    }
320
0
  }
321
0
}
322
323
void FictionBook2CityContext::text(const char *value)
324
0
{
325
  // TODO: implement me
326
0
  librevenge::RVNGString str(value);
327
0
  (void) str;
328
0
}
329
330
FictionBook2CoverpageContext::FictionBook2CoverpageContext(std::shared_ptr<FictionBook2ParserContext> parentContext)
331
10
  : FictionBook2ParserContext(parentContext)
332
10
{
333
10
}
334
335
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2CoverpageContext::element(const FictionBook2TokenData &name, const FictionBook2TokenData &ns)
336
0
{
337
  // TODO: implement me
338
0
  if (FictionBook2Token::NS_FICTIONBOOK == getFictionBook2TokenID(ns))
339
0
  {
340
0
    switch (getFictionBook2TokenID(name))
341
0
    {
342
0
    default :
343
0
      break;
344
0
    }
345
0
  }
346
347
0
  return std::make_shared<FictionBook2SkipElementContext>(shared_from_this());
348
0
}
349
350
void FictionBook2CoverpageContext::startOfElement()
351
10
{
352
  // TODO: implement me
353
10
}
354
355
void FictionBook2CoverpageContext::endOfElement()
356
10
{
357
  // TODO: implement me
358
10
}
359
360
void FictionBook2CoverpageContext::attribute(const FictionBook2TokenData &name, const FictionBook2TokenData *ns, const char *value)
361
0
{
362
  // TODO: implement me
363
0
  (void) value;
364
0
  if (FictionBook2_NO_NAMESPACE(ns))
365
0
  {
366
0
    switch (getFictionBook2TokenID(name))
367
0
    {
368
0
    default :
369
0
      break;
370
0
    }
371
0
  }
372
0
}
373
374
void FictionBook2CoverpageContext::text(const char *value)
375
0
{
376
  // TODO: implement me
377
0
  librevenge::RVNGString str(value);
378
0
  (void) str;
379
0
}
380
381
FictionBook2CustomInfoContext::FictionBook2CustomInfoContext(std::shared_ptr<FictionBook2ParserContext> parentContext)
382
0
  : FictionBook2ParserContext(parentContext)
383
0
  , m_type()
384
0
  , m_text()
385
0
{
386
0
}
387
388
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2CustomInfoContext::element(const FictionBook2TokenData &, const FictionBook2TokenData &)
389
0
{
390
0
  return nullptr;
391
0
}
392
393
void FictionBook2CustomInfoContext::startOfElement()
394
0
{
395
0
}
396
397
void FictionBook2CustomInfoContext::endOfElement()
398
0
{
399
0
  librevenge::RVNGString info(m_type);
400
0
  info.append(": ");
401
0
  info.append(m_text);
402
  // TODO: there might be more than one comment. Must properties be unique?
403
0
  getCollector()->defineMetadataEntry("librevenge:comments", info.cstr());
404
0
}
405
406
void FictionBook2CustomInfoContext::attribute(const FictionBook2TokenData &name, const FictionBook2TokenData *ns, const char *value)
407
0
{
408
0
  if (FictionBook2_NO_NAMESPACE(ns))
409
0
  {
410
0
    switch (getFictionBook2TokenID(name))
411
0
    {
412
0
    case FictionBook2Token::info_type :
413
0
      m_type = value;
414
0
    default :
415
0
      break;
416
0
    }
417
0
  }
418
0
}
419
420
void FictionBook2CustomInfoContext::text(const char *value)
421
0
{
422
0
  m_text = value;
423
0
}
424
425
FictionBook2DateContext::FictionBook2DateContext(std::shared_ptr<FictionBook2ParserContext> parentContext, const char *const name)
426
15.1k
  : FictionBook2ParserContext(parentContext)
427
15.1k
  , m_name(name)
428
15.1k
{
429
15.1k
}
430
431
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2DateContext::element(const FictionBook2TokenData &, const FictionBook2TokenData &)
432
13
{
433
13
  return nullptr;
434
13
}
435
436
void FictionBook2DateContext::startOfElement()
437
15.1k
{
438
15.1k
}
439
440
void FictionBook2DateContext::endOfElement()
441
15.1k
{
442
15.1k
}
443
444
void FictionBook2DateContext::attribute(const FictionBook2TokenData &name, const FictionBook2TokenData *ns, const char *value)
445
606
{
446
  // TODO: should we use the computer-readable date from attribute, if
447
  // present?
448
606
  (void) value;
449
606
  if (FictionBook2_NO_NAMESPACE(ns))
450
538
  {
451
538
    switch (getFictionBook2TokenID(name))
452
538
    {
453
0
    case FictionBook2Token::value :
454
0
      break;
455
538
    default :
456
538
      break;
457
538
    }
458
538
  }
459
606
}
460
461
void FictionBook2DateContext::text(const char *value)
462
15.3k
{
463
15.3k
  getCollector()->defineMetadataEntry(m_name, value);
464
15.3k
}
465
466
FictionBook2DescriptionContext::FictionBook2DescriptionContext(std::shared_ptr<FictionBook2ParserContext> parentContext, FictionBook2Collector *const collector)
467
6.01k
  : FictionBook2ParserContext(parentContext, collector)
468
6.01k
{
469
6.01k
}
470
471
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2DescriptionContext::element(const FictionBook2TokenData &name, const FictionBook2TokenData &ns)
472
12.6k
{
473
12.6k
  if (FictionBook2Token::NS_FICTIONBOOK == getFictionBook2TokenID(ns))
474
12.3k
  {
475
12.3k
    switch (getFictionBook2TokenID(name))
476
12.3k
    {
477
3.58k
    case FictionBook2Token::title_info :
478
3.58k
      return std::make_shared<FictionBook2TitleInfoContext>(shared_from_this());
479
0
    case FictionBook2Token::src_title_info :
480
      // not interesting -> skip
481
0
      break;
482
2.55k
    case FictionBook2Token::document_info :
483
2.55k
      return std::make_shared<FictionBook2TextInfoContext>(shared_from_this());
484
98
    case FictionBook2Token::publish_info :
485
98
      return std::make_shared<FictionBook2PublishInfoContext>(shared_from_this());
486
0
    case FictionBook2Token::custom_info :
487
0
      return std::make_shared<FictionBook2CustomInfoContext>(shared_from_this());
488
1
    case FictionBook2Token::output :
489
1
      return std::make_shared<FictionBook2OutputContext>(shared_from_this());
490
6.09k
    default :
491
6.09k
      break;
492
12.3k
    }
493
12.3k
  }
494
495
6.42k
  return std::make_shared<FictionBook2SkipElementContext>(shared_from_this());
496
12.6k
}
497
498
void FictionBook2DescriptionContext::startOfElement()
499
6.01k
{
500
6.01k
}
501
502
void FictionBook2DescriptionContext::endOfElement()
503
5.90k
{
504
5.90k
}
505
506
void FictionBook2DescriptionContext::attribute(const FictionBook2TokenData &, const FictionBook2TokenData *, const char *)
507
22
{
508
22
}
509
510
void FictionBook2DescriptionContext::text(const char *)
511
13.1k
{
512
13.1k
}
513
514
FictionBook2TextInfoContext::FictionBook2TextInfoContext(std::shared_ptr<FictionBook2ParserContext> parentContext)
515
2.55k
  : FictionBook2ParserContext(parentContext)
516
2.55k
  , m_authors(new FictionBook2Authors())
517
2.55k
{
518
2.55k
}
519
520
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2TextInfoContext::element(const FictionBook2TokenData &name, const FictionBook2TokenData &ns)
521
56.9k
{
522
56.9k
  if (FictionBook2Token::NS_FICTIONBOOK == getFictionBook2TokenID(ns))
523
56.7k
  {
524
56.7k
    switch (getFictionBook2TokenID(name))
525
56.7k
    {
526
596
    case FictionBook2Token::author :
527
596
      return std::make_shared<FictionBook2AuthorContext>(shared_from_this(), *m_authors);
528
14.9k
    case FictionBook2Token::date :
529
14.9k
      return std::make_shared<FictionBook2DateContext>(shared_from_this(), "dcterms:issued");
530
91
    case FictionBook2Token::src_url :
531
91
      return std::make_shared<FictionBook2SrcUrlContext>(shared_from_this());
532
39.3k
    case FictionBook2Token::version :
533
39.3k
      return std::make_shared<FictionBook2VersionContext>(shared_from_this());
534
158
    case FictionBook2Token::history :
535
158
      return std::make_shared<FictionBook2HistoryContext>(shared_from_this());
536
0
    case FictionBook2Token::id :
537
0
    case FictionBook2Token::program_used :
538
    // ignore
539
1.62k
    default :
540
1.62k
      break;
541
56.7k
    }
542
56.7k
  }
543
544
1.84k
  return std::make_shared<FictionBook2SkipElementContext>(shared_from_this());
545
56.9k
}
546
547
void FictionBook2TextInfoContext::startOfElement()
548
2.55k
{
549
2.55k
}
550
551
void FictionBook2TextInfoContext::endOfElement()
552
2.45k
{
553
  // TODO: handle authors
554
2.45k
}
555
556
void FictionBook2TextInfoContext::attribute(const FictionBook2TokenData &, const FictionBook2TokenData *, const char *)
557
39
{
558
39
}
559
560
void FictionBook2TextInfoContext::text(const char *)
561
3.58k
{
562
3.58k
}
563
564
FictionBook2EmailContext::FictionBook2EmailContext(std::shared_ptr<FictionBook2ParserContext> parentContext)
565
0
  : FictionBook2ParserContext(parentContext)
566
0
{
567
0
}
568
569
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2EmailContext::element(const FictionBook2TokenData &name, const FictionBook2TokenData &ns)
570
0
{
571
  // TODO: implement me
572
0
  if (FictionBook2Token::NS_FICTIONBOOK == getFictionBook2TokenID(ns))
573
0
  {
574
0
    switch (getFictionBook2TokenID(name))
575
0
    {
576
0
    default :
577
0
      break;
578
0
    }
579
0
  }
580
581
0
  return std::make_shared<FictionBook2SkipElementContext>(shared_from_this());
582
0
}
583
584
void FictionBook2EmailContext::startOfElement()
585
0
{
586
  // TODO: implement me
587
0
}
588
589
void FictionBook2EmailContext::endOfElement()
590
0
{
591
  // TODO: implement me
592
0
}
593
594
void FictionBook2EmailContext::attribute(const FictionBook2TokenData &name, const FictionBook2TokenData *ns, const char *value)
595
0
{
596
  // TODO: implement me
597
0
  (void) value;
598
0
  if (FictionBook2_NO_NAMESPACE(ns))
599
0
  {
600
0
    switch (getFictionBook2TokenID(name))
601
0
    {
602
0
    default :
603
0
      break;
604
0
    }
605
0
  }
606
0
}
607
608
void FictionBook2EmailContext::text(const char *value)
609
0
{
610
  // TODO: implement me
611
0
  librevenge::RVNGString str(value);
612
0
  (void) str;
613
0
}
614
615
FictionBook2FirstNameContext::FictionBook2FirstNameContext(std::shared_ptr<FictionBook2ParserContext> parentContext, FictionBook2Authors &authors)
616
22.6k
  : FictionBook2ParserContext(parentContext)
617
22.6k
  , m_authors(authors)
618
22.6k
{
619
22.6k
}
620
621
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2FirstNameContext::element(const FictionBook2TokenData &, const FictionBook2TokenData &)
622
1
{
623
1
  return nullptr;
624
1
}
625
626
void FictionBook2FirstNameContext::startOfElement()
627
22.6k
{
628
22.6k
}
629
630
void FictionBook2FirstNameContext::endOfElement()
631
22.6k
{
632
22.6k
}
633
634
void FictionBook2FirstNameContext::attribute(const FictionBook2TokenData &, const FictionBook2TokenData *, const char *)
635
73
{
636
73
}
637
638
void FictionBook2FirstNameContext::text(const char *value)
639
22.8k
{
640
22.8k
  const librevenge::RVNGString str(value);
641
22.8k
  m_authors.setFirstName(str);
642
22.8k
}
643
644
FictionBook2GenreContext::FictionBook2GenreContext(std::shared_ptr<FictionBook2ParserContext> parentContext)
645
0
  : FictionBook2ParserContext(parentContext)
646
0
{
647
0
}
648
649
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2GenreContext::element(const FictionBook2TokenData &name, const FictionBook2TokenData &ns)
650
0
{
651
  // TODO: implement me
652
0
  if (FictionBook2Token::NS_FICTIONBOOK == getFictionBook2TokenID(ns))
653
0
  {
654
0
    switch (getFictionBook2TokenID(name))
655
0
    {
656
0
    default :
657
0
      break;
658
0
    }
659
0
  }
660
661
0
  return std::make_shared<FictionBook2SkipElementContext>(shared_from_this());
662
0
}
663
664
void FictionBook2GenreContext::startOfElement()
665
0
{
666
  // TODO: implement me
667
0
}
668
669
void FictionBook2GenreContext::endOfElement()
670
0
{
671
  // TODO: implement me
672
0
}
673
674
void FictionBook2GenreContext::attribute(const FictionBook2TokenData &name, const FictionBook2TokenData *ns, const char *value)
675
0
{
676
  // TODO: implement me
677
0
  (void) value;
678
0
  if (FictionBook2_NO_NAMESPACE(ns))
679
0
  {
680
0
    switch (getFictionBook2TokenID(name))
681
0
    {
682
0
    default :
683
0
      break;
684
0
    }
685
0
  }
686
0
}
687
688
void FictionBook2GenreContext::text(const char *value)
689
0
{
690
  // TODO: implement me
691
0
  librevenge::RVNGString str(value);
692
0
  (void) str;
693
0
}
694
695
FictionBook2HistoryContext::FictionBook2HistoryContext(std::shared_ptr<FictionBook2ParserContext> parentContext)
696
158
  : FictionBook2ParserContext(parentContext)
697
158
{
698
158
}
699
700
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2HistoryContext::element(const FictionBook2TokenData &name, const FictionBook2TokenData &ns)
701
0
{
702
  // TODO: implement me
703
0
  if (FictionBook2Token::NS_FICTIONBOOK == getFictionBook2TokenID(ns))
704
0
  {
705
0
    switch (getFictionBook2TokenID(name))
706
0
    {
707
0
    default :
708
0
      break;
709
0
    }
710
0
  }
711
712
0
  return std::make_shared<FictionBook2SkipElementContext>(shared_from_this());
713
0
}
714
715
void FictionBook2HistoryContext::startOfElement()
716
158
{
717
  // TODO: implement me
718
158
}
719
720
void FictionBook2HistoryContext::endOfElement()
721
158
{
722
  // TODO: implement me
723
158
}
724
725
void FictionBook2HistoryContext::attribute(const FictionBook2TokenData &name, const FictionBook2TokenData *ns, const char *value)
726
134
{
727
  // TODO: implement me
728
134
  (void) value;
729
134
  if (FictionBook2_NO_NAMESPACE(ns))
730
124
  {
731
124
    switch (getFictionBook2TokenID(name))
732
124
    {
733
124
    default :
734
124
      break;
735
124
    }
736
124
  }
737
134
}
738
739
void FictionBook2HistoryContext::text(const char *value)
740
0
{
741
  // TODO: implement me
742
0
  librevenge::RVNGString str(value);
743
0
  (void) str;
744
0
}
745
746
FictionBook2HomePageContext::FictionBook2HomePageContext(std::shared_ptr<FictionBook2ParserContext> parentContext)
747
0
  : FictionBook2ParserContext(parentContext)
748
0
{
749
0
}
750
751
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2HomePageContext::element(const FictionBook2TokenData &name, const FictionBook2TokenData &ns)
752
0
{
753
  // TODO: implement me
754
0
  if (FictionBook2Token::NS_FICTIONBOOK == getFictionBook2TokenID(ns))
755
0
  {
756
0
    switch (getFictionBook2TokenID(name))
757
0
    {
758
0
    default :
759
0
      break;
760
0
    }
761
0
  }
762
763
0
  return std::make_shared<FictionBook2SkipElementContext>(shared_from_this());
764
0
}
765
766
void FictionBook2HomePageContext::startOfElement()
767
0
{
768
  // TODO: implement me
769
0
}
770
771
void FictionBook2HomePageContext::endOfElement()
772
0
{
773
  // TODO: implement me
774
0
}
775
776
void FictionBook2HomePageContext::attribute(const FictionBook2TokenData &name, const FictionBook2TokenData *ns, const char *value)
777
0
{
778
  // TODO: implement me
779
0
  (void) value;
780
0
  if (FictionBook2_NO_NAMESPACE(ns))
781
0
  {
782
0
    switch (getFictionBook2TokenID(name))
783
0
    {
784
0
    default :
785
0
      break;
786
0
    }
787
0
  }
788
0
}
789
790
void FictionBook2HomePageContext::text(const char *value)
791
0
{
792
  // TODO: implement me
793
0
  librevenge::RVNGString str(value);
794
0
  (void) str;
795
0
}
796
797
FictionBook2IdContext::FictionBook2IdContext(std::shared_ptr<FictionBook2ParserContext> parentContext)
798
0
  : FictionBook2ParserContext(parentContext)
799
0
{
800
0
}
801
802
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2IdContext::element(const FictionBook2TokenData &name, const FictionBook2TokenData &ns)
803
0
{
804
  // TODO: implement me
805
0
  if (FictionBook2Token::NS_FICTIONBOOK == getFictionBook2TokenID(ns))
806
0
  {
807
0
    switch (getFictionBook2TokenID(name))
808
0
    {
809
0
    default :
810
0
      break;
811
0
    }
812
0
  }
813
814
0
  return std::make_shared<FictionBook2SkipElementContext>(shared_from_this());
815
0
}
816
817
void FictionBook2IdContext::startOfElement()
818
0
{
819
  // TODO: implement me
820
0
}
821
822
void FictionBook2IdContext::endOfElement()
823
0
{
824
  // TODO: implement me
825
0
}
826
827
void FictionBook2IdContext::attribute(const FictionBook2TokenData &name, const FictionBook2TokenData *ns, const char *value)
828
0
{
829
  // TODO: implement me
830
0
  (void) value;
831
0
  if (FictionBook2_NO_NAMESPACE(ns))
832
0
  {
833
0
    switch (getFictionBook2TokenID(name))
834
0
    {
835
0
    default :
836
0
      break;
837
0
    }
838
0
  }
839
0
}
840
841
void FictionBook2IdContext::text(const char *value)
842
0
{
843
  // TODO: implement me
844
0
  librevenge::RVNGString str(value);
845
0
  (void) str;
846
0
}
847
848
FictionBook2IsbnContext::FictionBook2IsbnContext(std::shared_ptr<FictionBook2ParserContext> parentContext)
849
0
  : FictionBook2ParserContext(parentContext)
850
0
{
851
0
}
852
853
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2IsbnContext::element(const FictionBook2TokenData &name, const FictionBook2TokenData &ns)
854
0
{
855
  // TODO: implement me
856
0
  if (FictionBook2Token::NS_FICTIONBOOK == getFictionBook2TokenID(ns))
857
0
  {
858
0
    switch (getFictionBook2TokenID(name))
859
0
    {
860
0
    default :
861
0
      break;
862
0
    }
863
0
  }
864
865
0
  return std::make_shared<FictionBook2SkipElementContext>(shared_from_this());
866
0
}
867
868
void FictionBook2IsbnContext::startOfElement()
869
0
{
870
  // TODO: implement me
871
0
}
872
873
void FictionBook2IsbnContext::endOfElement()
874
0
{
875
  // TODO: implement me
876
0
}
877
878
void FictionBook2IsbnContext::attribute(const FictionBook2TokenData &name, const FictionBook2TokenData *ns, const char *value)
879
0
{
880
  // TODO: implement me
881
0
  (void) value;
882
0
  if (FictionBook2_NO_NAMESPACE(ns))
883
0
  {
884
0
    switch (getFictionBook2TokenID(name))
885
0
    {
886
0
    default :
887
0
      break;
888
0
    }
889
0
  }
890
0
}
891
892
void FictionBook2IsbnContext::text(const char *value)
893
0
{
894
  // TODO: implement me
895
0
  librevenge::RVNGString str(value);
896
0
  (void) str;
897
0
}
898
899
FictionBook2KeywordsContext::FictionBook2KeywordsContext(std::shared_ptr<FictionBook2ParserContext> parentContext)
900
0
  : FictionBook2ParserContext(parentContext)
901
0
{
902
0
}
903
904
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2KeywordsContext::element(const FictionBook2TokenData &, const FictionBook2TokenData &)
905
0
{
906
0
  return nullptr;
907
0
}
908
909
void FictionBook2KeywordsContext::startOfElement()
910
0
{
911
0
}
912
913
void FictionBook2KeywordsContext::endOfElement()
914
0
{
915
0
}
916
917
void FictionBook2KeywordsContext::attribute(const FictionBook2TokenData &, const FictionBook2TokenData *, const char *)
918
0
{
919
0
}
920
921
void FictionBook2KeywordsContext::text(const char *value)
922
0
{
923
0
  getCollector()->defineMetadataEntry("meta:keyword", value);
924
0
}
925
926
FictionBook2LangContext::FictionBook2LangContext(std::shared_ptr<FictionBook2ParserContext> parentContext)
927
4.70k
  : FictionBook2ParserContext(parentContext)
928
4.70k
{
929
4.70k
}
930
931
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2LangContext::element(const FictionBook2TokenData &, const FictionBook2TokenData &)
932
5
{
933
5
  return nullptr;
934
5
}
935
936
void FictionBook2LangContext::startOfElement()
937
4.70k
{
938
4.70k
}
939
940
void FictionBook2LangContext::endOfElement()
941
4.70k
{
942
4.70k
}
943
944
void FictionBook2LangContext::attribute(const FictionBook2TokenData &, const FictionBook2TokenData *, const char *)
945
419
{
946
419
}
947
948
void FictionBook2LangContext::text(const char *value)
949
4.76k
{
950
4.76k
  getCollector()->defineMetadataEntry("dc:language", value);
951
4.76k
}
952
953
FictionBook2LastNameContext::FictionBook2LastNameContext(std::shared_ptr<FictionBook2ParserContext> parentContext, FictionBook2Authors &authors)
954
28.4k
  : FictionBook2ParserContext(parentContext)
955
28.4k
  , m_authors(authors)
956
28.4k
{
957
28.4k
}
958
959
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2LastNameContext::element(const FictionBook2TokenData &, const FictionBook2TokenData &)
960
5
{
961
5
  return nullptr;
962
5
}
963
964
void FictionBook2LastNameContext::startOfElement()
965
28.4k
{
966
28.4k
}
967
968
void FictionBook2LastNameContext::endOfElement()
969
28.4k
{
970
28.4k
}
971
972
void FictionBook2LastNameContext::attribute(const FictionBook2TokenData &, const FictionBook2TokenData *, const char *)
973
66
{
974
66
}
975
976
void FictionBook2LastNameContext::text(const char *value)
977
28.4k
{
978
28.4k
  const librevenge::RVNGString str(value);
979
28.4k
  m_authors.setLastName(str);
980
28.4k
}
981
982
FictionBook2MiddleNameContext::FictionBook2MiddleNameContext(std::shared_ptr<FictionBook2ParserContext> parentContext, FictionBook2Authors &authors)
983
0
  : FictionBook2ParserContext(parentContext)
984
0
  , m_authors(authors)
985
0
{
986
0
}
987
988
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2MiddleNameContext::element(const FictionBook2TokenData &, const FictionBook2TokenData &)
989
0
{
990
0
  return nullptr;
991
0
}
992
993
void FictionBook2MiddleNameContext::startOfElement()
994
0
{
995
0
}
996
997
void FictionBook2MiddleNameContext::endOfElement()
998
0
{
999
0
}
1000
1001
void FictionBook2MiddleNameContext::attribute(const FictionBook2TokenData &, const FictionBook2TokenData *, const char *)
1002
0
{
1003
0
}
1004
1005
void FictionBook2MiddleNameContext::text(const char *value)
1006
0
{
1007
0
  const librevenge::RVNGString str(value);
1008
0
  m_authors.setMiddleName(str);
1009
0
}
1010
1011
FictionBook2NicknameContext::FictionBook2NicknameContext(std::shared_ptr<FictionBook2ParserContext> parentContext, FictionBook2Authors &authors)
1012
44
  : FictionBook2ParserContext(parentContext)
1013
44
  , m_authors(authors)
1014
44
{
1015
44
}
1016
1017
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2NicknameContext::element(const FictionBook2TokenData &, const FictionBook2TokenData &)
1018
0
{
1019
0
  return nullptr;
1020
0
}
1021
1022
void FictionBook2NicknameContext::startOfElement()
1023
44
{
1024
44
}
1025
1026
void FictionBook2NicknameContext::endOfElement()
1027
44
{
1028
44
}
1029
1030
void FictionBook2NicknameContext::attribute(const FictionBook2TokenData &, const FictionBook2TokenData *, const char *)
1031
0
{
1032
0
}
1033
1034
void FictionBook2NicknameContext::text(const char *value)
1035
0
{
1036
0
  const librevenge::RVNGString str(value);
1037
0
  m_authors.setNickname(str);
1038
0
}
1039
1040
FictionBook2OutputContext::FictionBook2OutputContext(std::shared_ptr<FictionBook2ParserContext> parentContext)
1041
1
  : FictionBook2ParserContext(parentContext)
1042
1
{
1043
1
}
1044
1045
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2OutputContext::element(const FictionBook2TokenData &name, const FictionBook2TokenData &ns)
1046
0
{
1047
  // TODO: implement me
1048
0
  if (FictionBook2Token::NS_FICTIONBOOK == getFictionBook2TokenID(ns))
1049
0
  {
1050
0
    switch (getFictionBook2TokenID(name))
1051
0
    {
1052
0
    default :
1053
0
      break;
1054
0
    }
1055
0
  }
1056
1057
0
  return std::make_shared<FictionBook2SkipElementContext>(shared_from_this());
1058
0
}
1059
1060
void FictionBook2OutputContext::startOfElement()
1061
1
{
1062
  // TODO: implement me
1063
1
}
1064
1065
void FictionBook2OutputContext::endOfElement()
1066
1
{
1067
  // TODO: implement me
1068
1
}
1069
1070
void FictionBook2OutputContext::attribute(const FictionBook2TokenData &name, const FictionBook2TokenData *ns, const char *value)
1071
0
{
1072
  // TODO: implement me
1073
0
  (void) value;
1074
0
  if (FictionBook2_NO_NAMESPACE(ns))
1075
0
  {
1076
0
    switch (getFictionBook2TokenID(name))
1077
0
    {
1078
0
    default :
1079
0
      break;
1080
0
    }
1081
0
  }
1082
0
}
1083
1084
void FictionBook2OutputContext::text(const char *value)
1085
0
{
1086
  // TODO: implement me
1087
0
  librevenge::RVNGString str(value);
1088
0
  (void) str;
1089
0
}
1090
1091
FictionBook2OutputDocumentClassContext::FictionBook2OutputDocumentClassContext(std::shared_ptr<FictionBook2ParserContext> parentContext)
1092
0
  : FictionBook2ParserContext(parentContext)
1093
0
{
1094
0
}
1095
1096
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2OutputDocumentClassContext::element(const FictionBook2TokenData &name, const FictionBook2TokenData &ns)
1097
0
{
1098
  // TODO: implement me
1099
0
  if (FictionBook2Token::NS_FICTIONBOOK == getFictionBook2TokenID(ns))
1100
0
  {
1101
0
    switch (getFictionBook2TokenID(name))
1102
0
    {
1103
0
    default :
1104
0
      break;
1105
0
    }
1106
0
  }
1107
1108
0
  return std::make_shared<FictionBook2SkipElementContext>(shared_from_this());
1109
0
}
1110
1111
void FictionBook2OutputDocumentClassContext::startOfElement()
1112
0
{
1113
  // TODO: implement me
1114
0
}
1115
1116
void FictionBook2OutputDocumentClassContext::endOfElement()
1117
0
{
1118
  // TODO: implement me
1119
0
}
1120
1121
void FictionBook2OutputDocumentClassContext::attribute(const FictionBook2TokenData &name, const FictionBook2TokenData *ns, const char *value)
1122
0
{
1123
  // TODO: implement me
1124
0
  (void) value;
1125
0
  if (FictionBook2_NO_NAMESPACE(ns))
1126
0
  {
1127
0
    switch (getFictionBook2TokenID(name))
1128
0
    {
1129
0
    default :
1130
0
      break;
1131
0
    }
1132
0
  }
1133
0
}
1134
1135
void FictionBook2OutputDocumentClassContext::text(const char *value)
1136
0
{
1137
  // TODO: implement me
1138
0
  librevenge::RVNGString str(value);
1139
0
  (void) str;
1140
0
}
1141
1142
FictionBook2PartContext::FictionBook2PartContext(std::shared_ptr<FictionBook2ParserContext> parentContext)
1143
0
  : FictionBook2ParserContext(parentContext)
1144
0
{
1145
0
}
1146
1147
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2PartContext::element(const FictionBook2TokenData &name, const FictionBook2TokenData &ns)
1148
0
{
1149
  // TODO: implement me
1150
0
  if (FictionBook2Token::NS_FICTIONBOOK == getFictionBook2TokenID(ns))
1151
0
  {
1152
0
    switch (getFictionBook2TokenID(name))
1153
0
    {
1154
0
    default :
1155
0
      break;
1156
0
    }
1157
0
  }
1158
1159
0
  return std::make_shared<FictionBook2SkipElementContext>(shared_from_this());
1160
0
}
1161
1162
void FictionBook2PartContext::startOfElement()
1163
0
{
1164
  // TODO: implement me
1165
0
}
1166
1167
void FictionBook2PartContext::endOfElement()
1168
0
{
1169
  // TODO: implement me
1170
0
}
1171
1172
void FictionBook2PartContext::attribute(const FictionBook2TokenData &name, const FictionBook2TokenData *ns, const char *value)
1173
0
{
1174
  // TODO: implement me
1175
0
  (void) value;
1176
0
  if (FictionBook2_NO_NAMESPACE(ns))
1177
0
  {
1178
0
    switch (getFictionBook2TokenID(name))
1179
0
    {
1180
0
    default :
1181
0
      break;
1182
0
    }
1183
0
  }
1184
0
}
1185
1186
void FictionBook2PartContext::text(const char *value)
1187
0
{
1188
  // TODO: implement me
1189
0
  librevenge::RVNGString str(value);
1190
0
  (void) str;
1191
0
}
1192
1193
FictionBook2ProgramUsedContext::FictionBook2ProgramUsedContext(std::shared_ptr<FictionBook2ParserContext> parentContext)
1194
0
  : FictionBook2ParserContext(parentContext)
1195
0
{
1196
0
}
1197
1198
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2ProgramUsedContext::element(const FictionBook2TokenData &name, const FictionBook2TokenData &ns)
1199
0
{
1200
  // TODO: implement me
1201
0
  if (FictionBook2Token::NS_FICTIONBOOK == getFictionBook2TokenID(ns))
1202
0
  {
1203
0
    switch (getFictionBook2TokenID(name))
1204
0
    {
1205
0
    default :
1206
0
      break;
1207
0
    }
1208
0
  }
1209
1210
0
  return std::make_shared<FictionBook2SkipElementContext>(shared_from_this());
1211
0
}
1212
1213
void FictionBook2ProgramUsedContext::startOfElement()
1214
0
{
1215
  // TODO: implement me
1216
0
}
1217
1218
void FictionBook2ProgramUsedContext::endOfElement()
1219
0
{
1220
  // TODO: implement me
1221
0
}
1222
1223
void FictionBook2ProgramUsedContext::attribute(const FictionBook2TokenData &name, const FictionBook2TokenData *ns, const char *value)
1224
0
{
1225
  // TODO: implement me
1226
0
  (void) value;
1227
0
  if (FictionBook2_NO_NAMESPACE(ns))
1228
0
  {
1229
0
    switch (getFictionBook2TokenID(name))
1230
0
    {
1231
0
    default :
1232
0
      break;
1233
0
    }
1234
0
  }
1235
0
}
1236
1237
void FictionBook2ProgramUsedContext::text(const char *value)
1238
0
{
1239
  // TODO: implement me
1240
0
  librevenge::RVNGString str(value);
1241
0
  (void) str;
1242
0
}
1243
1244
FictionBook2PublisherContext::FictionBook2PublisherContext(std::shared_ptr<FictionBook2ParserContext> parentContext)
1245
0
  : FictionBook2ParserContext(parentContext)
1246
0
{
1247
0
}
1248
1249
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2PublisherContext::element(const FictionBook2TokenData &, const FictionBook2TokenData &)
1250
0
{
1251
0
  return nullptr;
1252
0
}
1253
1254
void FictionBook2PublisherContext::startOfElement()
1255
0
{
1256
0
}
1257
1258
void FictionBook2PublisherContext::endOfElement()
1259
0
{
1260
0
}
1261
1262
void FictionBook2PublisherContext::attribute(const FictionBook2TokenData &, const FictionBook2TokenData *, const char *)
1263
0
{
1264
0
}
1265
1266
void FictionBook2PublisherContext::text(const char *value)
1267
0
{
1268
0
  getCollector()->defineMetadataEntry("dc:publisher", value);
1269
0
}
1270
1271
FictionBook2PublishInfoContext::FictionBook2PublishInfoContext(std::shared_ptr<FictionBook2ParserContext> parentContext)
1272
98
  : FictionBook2ParserContext(parentContext)
1273
98
{
1274
98
}
1275
1276
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2PublishInfoContext::element(const FictionBook2TokenData &name, const FictionBook2TokenData &ns)
1277
0
{
1278
0
  if (FictionBook2Token::NS_FICTIONBOOK == getFictionBook2TokenID(ns))
1279
0
  {
1280
0
    switch (getFictionBook2TokenID(name))
1281
0
    {
1282
0
    case FictionBook2Token::publisher :
1283
0
      return std::make_shared<FictionBook2PublisherContext>(shared_from_this());
1284
0
    case FictionBook2Token::book_name :
1285
0
    case FictionBook2Token::city :
1286
0
    case FictionBook2Token::isbn :
1287
0
    case FictionBook2Token::sequence :
1288
0
    case FictionBook2Token::year :
1289
      // ignore
1290
0
      break;
1291
0
    default :
1292
0
      break;
1293
0
    }
1294
0
  }
1295
1296
0
  return std::make_shared<FictionBook2SkipElementContext>(shared_from_this());
1297
0
}
1298
1299
void FictionBook2PublishInfoContext::startOfElement()
1300
98
{
1301
98
}
1302
1303
void FictionBook2PublishInfoContext::endOfElement()
1304
98
{
1305
98
}
1306
1307
void FictionBook2PublishInfoContext::attribute(const FictionBook2TokenData &, const FictionBook2TokenData *, const char *)
1308
35
{
1309
35
}
1310
1311
void FictionBook2PublishInfoContext::text(const char *)
1312
0
{
1313
0
}
1314
1315
FictionBook2SequenceContext::FictionBook2SequenceContext(std::shared_ptr<FictionBook2ParserContext> parentContext)
1316
0
  : FictionBook2ParserContext(parentContext)
1317
0
{
1318
0
}
1319
1320
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2SequenceContext::element(const FictionBook2TokenData &name, const FictionBook2TokenData &ns)
1321
0
{
1322
  // TODO: implement me
1323
0
  if (FictionBook2Token::NS_FICTIONBOOK == getFictionBook2TokenID(ns))
1324
0
  {
1325
0
    switch (getFictionBook2TokenID(name))
1326
0
    {
1327
0
    default :
1328
0
      break;
1329
0
    }
1330
0
  }
1331
1332
0
  return std::make_shared<FictionBook2SkipElementContext>(shared_from_this());
1333
0
}
1334
1335
void FictionBook2SequenceContext::startOfElement()
1336
0
{
1337
  // TODO: implement me
1338
0
}
1339
1340
void FictionBook2SequenceContext::endOfElement()
1341
0
{
1342
  // TODO: implement me
1343
0
}
1344
1345
void FictionBook2SequenceContext::attribute(const FictionBook2TokenData &name, const FictionBook2TokenData *ns, const char *value)
1346
0
{
1347
  // TODO: implement me
1348
0
  (void) value;
1349
0
  if (FictionBook2_NO_NAMESPACE(ns))
1350
0
  {
1351
0
    switch (getFictionBook2TokenID(name))
1352
0
    {
1353
0
    default :
1354
0
      break;
1355
0
    }
1356
0
  }
1357
0
}
1358
1359
void FictionBook2SequenceContext::text(const char *value)
1360
0
{
1361
  // TODO: implement me
1362
0
  librevenge::RVNGString str(value);
1363
0
  (void) str;
1364
0
}
1365
1366
FictionBook2SrcLangContext::FictionBook2SrcLangContext(std::shared_ptr<FictionBook2ParserContext> parentContext)
1367
0
  : FictionBook2ParserContext(parentContext)
1368
0
{
1369
0
}
1370
1371
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2SrcLangContext::element(const FictionBook2TokenData &name, const FictionBook2TokenData &ns)
1372
0
{
1373
  // TODO: implement me
1374
0
  if (FictionBook2Token::NS_FICTIONBOOK == getFictionBook2TokenID(ns))
1375
0
  {
1376
0
    switch (getFictionBook2TokenID(name))
1377
0
    {
1378
0
    default :
1379
0
      break;
1380
0
    }
1381
0
  }
1382
1383
0
  return std::make_shared<FictionBook2SkipElementContext>(shared_from_this());
1384
0
}
1385
1386
void FictionBook2SrcLangContext::startOfElement()
1387
0
{
1388
  // TODO: implement me
1389
0
}
1390
1391
void FictionBook2SrcLangContext::endOfElement()
1392
0
{
1393
  // TODO: implement me
1394
0
}
1395
1396
void FictionBook2SrcLangContext::attribute(const FictionBook2TokenData &name, const FictionBook2TokenData *ns, const char *value)
1397
0
{
1398
  // TODO: implement me
1399
0
  (void) value;
1400
0
  if (FictionBook2_NO_NAMESPACE(ns))
1401
0
  {
1402
0
    switch (getFictionBook2TokenID(name))
1403
0
    {
1404
0
    default :
1405
0
      break;
1406
0
    }
1407
0
  }
1408
0
}
1409
1410
void FictionBook2SrcLangContext::text(const char *value)
1411
0
{
1412
  // TODO: implement me
1413
0
  librevenge::RVNGString str(value);
1414
0
  (void) str;
1415
0
}
1416
1417
FictionBook2SrcOcrContext::FictionBook2SrcOcrContext(std::shared_ptr<FictionBook2ParserContext> parentContext)
1418
0
  : FictionBook2ParserContext(parentContext)
1419
0
{
1420
0
}
1421
1422
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2SrcOcrContext::element(const FictionBook2TokenData &name, const FictionBook2TokenData &ns)
1423
0
{
1424
  // TODO: implement me
1425
0
  if (FictionBook2Token::NS_FICTIONBOOK == getFictionBook2TokenID(ns))
1426
0
  {
1427
0
    switch (getFictionBook2TokenID(name))
1428
0
    {
1429
0
    default :
1430
0
      break;
1431
0
    }
1432
0
  }
1433
1434
0
  return std::make_shared<FictionBook2SkipElementContext>(shared_from_this());
1435
0
}
1436
1437
void FictionBook2SrcOcrContext::startOfElement()
1438
0
{
1439
  // TODO: implement me
1440
0
}
1441
1442
void FictionBook2SrcOcrContext::endOfElement()
1443
0
{
1444
  // TODO: implement me
1445
0
}
1446
1447
void FictionBook2SrcOcrContext::attribute(const FictionBook2TokenData &name, const FictionBook2TokenData *ns, const char *value)
1448
0
{
1449
  // TODO: implement me
1450
0
  (void) value;
1451
0
  if (FictionBook2_NO_NAMESPACE(ns))
1452
0
  {
1453
0
    switch (getFictionBook2TokenID(name))
1454
0
    {
1455
0
    default :
1456
0
      break;
1457
0
    }
1458
0
  }
1459
0
}
1460
1461
void FictionBook2SrcOcrContext::text(const char *value)
1462
0
{
1463
  // TODO: implement me
1464
0
  librevenge::RVNGString str(value);
1465
0
  (void) str;
1466
0
}
1467
1468
FictionBook2SrcTitleInfoContext::FictionBook2SrcTitleInfoContext(std::shared_ptr<FictionBook2ParserContext> parentContext)
1469
0
  : FictionBook2ParserContext(parentContext)
1470
0
{
1471
0
}
1472
1473
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2SrcTitleInfoContext::element(const FictionBook2TokenData &name, const FictionBook2TokenData &ns)
1474
0
{
1475
  // TODO: implement me
1476
0
  if (FictionBook2Token::NS_FICTIONBOOK == getFictionBook2TokenID(ns))
1477
0
  {
1478
0
    switch (getFictionBook2TokenID(name))
1479
0
    {
1480
0
    default :
1481
0
      break;
1482
0
    }
1483
0
  }
1484
1485
0
  return std::make_shared<FictionBook2SkipElementContext>(shared_from_this());
1486
0
}
1487
1488
void FictionBook2SrcTitleInfoContext::startOfElement()
1489
0
{
1490
  // TODO: implement me
1491
0
}
1492
1493
void FictionBook2SrcTitleInfoContext::endOfElement()
1494
0
{
1495
  // TODO: implement me
1496
0
}
1497
1498
void FictionBook2SrcTitleInfoContext::attribute(const FictionBook2TokenData &name, const FictionBook2TokenData *ns, const char *value)
1499
0
{
1500
  // TODO: implement me
1501
0
  (void) value;
1502
0
  if (FictionBook2_NO_NAMESPACE(ns))
1503
0
  {
1504
0
    switch (getFictionBook2TokenID(name))
1505
0
    {
1506
0
    default :
1507
0
      break;
1508
0
    }
1509
0
  }
1510
0
}
1511
1512
void FictionBook2SrcTitleInfoContext::text(const char *value)
1513
0
{
1514
  // TODO: implement me
1515
0
  librevenge::RVNGString str(value);
1516
0
  (void) str;
1517
0
}
1518
1519
FictionBook2SrcUrlContext::FictionBook2SrcUrlContext(std::shared_ptr<FictionBook2ParserContext> parentContext)
1520
91
  : FictionBook2ParserContext(parentContext)
1521
91
{
1522
91
}
1523
1524
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2SrcUrlContext::element(const FictionBook2TokenData &, const FictionBook2TokenData &)
1525
0
{
1526
0
  return nullptr;
1527
0
}
1528
1529
void FictionBook2SrcUrlContext::startOfElement()
1530
91
{
1531
91
}
1532
1533
void FictionBook2SrcUrlContext::endOfElement()
1534
91
{
1535
91
}
1536
1537
void FictionBook2SrcUrlContext::attribute(const FictionBook2TokenData &, const FictionBook2TokenData *, const char *)
1538
33
{
1539
33
}
1540
1541
void FictionBook2SrcUrlContext::text(const char *value)
1542
0
{
1543
0
  getCollector()->defineMetadataEntry("dc:source", value);
1544
0
}
1545
1546
FictionBook2TitleInfoContext::FictionBook2TitleInfoContext(std::shared_ptr<FictionBook2ParserContext> parentContext)
1547
3.58k
  : FictionBook2ParserContext(parentContext)
1548
3.58k
  , m_authors(new FictionBook2Authors())
1549
3.58k
{
1550
3.58k
}
1551
1552
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2TitleInfoContext::element(const FictionBook2TokenData &name, const FictionBook2TokenData &ns)
1553
118k
{
1554
  // TODO: implement me
1555
118k
  if (FictionBook2Token::NS_FICTIONBOOK == getFictionBook2TokenID(ns))
1556
117k
  {
1557
117k
    switch (getFictionBook2TokenID(name))
1558
117k
    {
1559
107k
    case FictionBook2Token::author :
1560
107k
      return std::make_shared<FictionBook2AuthorContext>(shared_from_this(), *m_authors);
1561
4.02k
    case FictionBook2Token::book_title :
1562
4.02k
      return std::make_shared<FictionBook2BookTitleContext>(shared_from_this());
1563
0
    case FictionBook2Token::keywords :
1564
0
      return std::make_shared<FictionBook2KeywordsContext>(shared_from_this());
1565
198
    case FictionBook2Token::date :
1566
198
      return std::make_shared<FictionBook2DateContext>(shared_from_this(), "meta:creation-date");
1567
10
    case FictionBook2Token::coverpage :
1568
10
      return std::make_shared<FictionBook2CoverpageContext>(shared_from_this());
1569
4.70k
    case FictionBook2Token::lang :
1570
4.70k
      return std::make_shared<FictionBook2LangContext>(shared_from_this());
1571
0
    case FictionBook2Token::annotation :
1572
0
    case FictionBook2Token::genre :
1573
0
    case FictionBook2Token::sequence :
1574
0
    case FictionBook2Token::src_lang :
1575
0
    case FictionBook2Token::translator :
1576
      // ignore
1577
0
      break;
1578
979
    default :
1579
979
      break;
1580
117k
    }
1581
117k
  }
1582
1583
1.40k
  return std::make_shared<FictionBook2SkipElementContext>(shared_from_this());
1584
118k
}
1585
1586
void FictionBook2TitleInfoContext::startOfElement()
1587
3.58k
{
1588
3.58k
}
1589
1590
void FictionBook2TitleInfoContext::endOfElement()
1591
3.56k
{
1592
3.56k
  typedef std::deque<FictionBook2Authors::Data> Authors_t;
1593
3.56k
  const Authors_t authors = m_authors->getAuthors();
1594
3.56k
  librevenge::RVNGString authorsStr;
1595
3.56k
  for (const auto &it : authors)
1596
106k
  {
1597
106k
    librevenge::RVNGString author;
1598
106k
    if (it.firstName.len() != 0)
1599
21.3k
    {
1600
21.3k
      author = it.firstName;
1601
21.3k
      if (it.middleName.len() != 0)
1602
0
      {
1603
0
        author.append(' ');
1604
0
        author.append(it.middleName);
1605
0
      }
1606
21.3k
      author.append(' ');
1607
21.3k
      author.append(it.lastName);
1608
21.3k
    }
1609
85.0k
    else
1610
85.0k
    {
1611
85.0k
      author = it.nickname;
1612
85.0k
    }
1613
1614
    // TODO: it would be better to push authors separately, if it's
1615
    // possible
1616
106k
    if (author.len() != 0)
1617
21.3k
    {
1618
21.3k
      if (authorsStr.len() != 0)
1619
20.6k
        authorsStr.append(", ");
1620
21.3k
      authorsStr.append(author);
1621
21.3k
    }
1622
106k
  }
1623
1624
3.56k
  if (authorsStr.len() != 0)
1625
757
    getCollector()->defineMetadataEntry("meta:initial-creator", authorsStr.cstr());
1626
3.56k
}
1627
1628
void FictionBook2TitleInfoContext::attribute(const FictionBook2TokenData &, const FictionBook2TokenData *, const char *)
1629
39
{
1630
39
}
1631
1632
void FictionBook2TitleInfoContext::text(const char *)
1633
91.0k
{
1634
91.0k
}
1635
1636
FictionBook2TranslatorContext::FictionBook2TranslatorContext(std::shared_ptr<FictionBook2ParserContext> parentContext)
1637
0
  : FictionBook2ParserContext(parentContext)
1638
0
{
1639
0
}
1640
1641
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2TranslatorContext::element(const FictionBook2TokenData &name, const FictionBook2TokenData &ns)
1642
0
{
1643
  // TODO: implement me
1644
0
  if (FictionBook2Token::NS_FICTIONBOOK == getFictionBook2TokenID(ns))
1645
0
  {
1646
0
    switch (getFictionBook2TokenID(name))
1647
0
    {
1648
0
    default :
1649
0
      break;
1650
0
    }
1651
0
  }
1652
1653
0
  return std::make_shared<FictionBook2SkipElementContext>(shared_from_this());
1654
0
}
1655
1656
void FictionBook2TranslatorContext::startOfElement()
1657
0
{
1658
  // TODO: implement me
1659
0
}
1660
1661
void FictionBook2TranslatorContext::endOfElement()
1662
0
{
1663
  // TODO: implement me
1664
0
}
1665
1666
void FictionBook2TranslatorContext::attribute(const FictionBook2TokenData &name, const FictionBook2TokenData *ns, const char *value)
1667
0
{
1668
  // TODO: implement me
1669
0
  (void) value;
1670
0
  if (FictionBook2_NO_NAMESPACE(ns))
1671
0
  {
1672
0
    switch (getFictionBook2TokenID(name))
1673
0
    {
1674
0
    default :
1675
0
      break;
1676
0
    }
1677
0
  }
1678
0
}
1679
1680
void FictionBook2TranslatorContext::text(const char *value)
1681
0
{
1682
  // TODO: implement me
1683
0
  librevenge::RVNGString str(value);
1684
0
  (void) str;
1685
0
}
1686
1687
FictionBook2VersionContext::FictionBook2VersionContext(std::shared_ptr<FictionBook2ParserContext> parentContext)
1688
39.3k
  : FictionBook2ParserContext(parentContext)
1689
39.3k
{
1690
39.3k
}
1691
1692
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2VersionContext::element(const FictionBook2TokenData &, const FictionBook2TokenData &)
1693
84
{
1694
84
  return nullptr;
1695
84
}
1696
1697
void FictionBook2VersionContext::startOfElement()
1698
39.3k
{
1699
39.3k
}
1700
1701
void FictionBook2VersionContext::endOfElement()
1702
39.2k
{
1703
39.2k
}
1704
1705
void FictionBook2VersionContext::attribute(const FictionBook2TokenData &, const FictionBook2TokenData *, const char *)
1706
70
{
1707
70
}
1708
1709
void FictionBook2VersionContext::text(const char *value)
1710
287k
{
1711
287k
  getCollector()->defineMetadataEntry("librevenge:version-number", value);
1712
287k
}
1713
1714
FictionBook2YearContext::FictionBook2YearContext(std::shared_ptr<FictionBook2ParserContext> parentContext)
1715
0
  : FictionBook2ParserContext(parentContext)
1716
0
{
1717
0
}
1718
1719
std::shared_ptr<FictionBook2XMLParserContext> FictionBook2YearContext::element(const FictionBook2TokenData &name, const FictionBook2TokenData &ns)
1720
0
{
1721
  // TODO: implement me
1722
0
  if (FictionBook2Token::NS_FICTIONBOOK == getFictionBook2TokenID(ns))
1723
0
  {
1724
0
    switch (getFictionBook2TokenID(name))
1725
0
    {
1726
0
    default :
1727
0
      break;
1728
0
    }
1729
0
  }
1730
1731
0
  return std::make_shared<FictionBook2SkipElementContext>(shared_from_this());
1732
0
}
1733
1734
void FictionBook2YearContext::startOfElement()
1735
0
{
1736
  // TODO: implement me
1737
0
}
1738
1739
void FictionBook2YearContext::endOfElement()
1740
0
{
1741
  // TODO: implement me
1742
0
}
1743
1744
void FictionBook2YearContext::attribute(const FictionBook2TokenData &name, const FictionBook2TokenData *ns, const char *value)
1745
0
{
1746
  // TODO: implement me
1747
0
  (void) value;
1748
0
  if (FictionBook2_NO_NAMESPACE(ns))
1749
0
  {
1750
0
    switch (getFictionBook2TokenID(name))
1751
0
    {
1752
0
    default :
1753
0
      break;
1754
0
    }
1755
0
  }
1756
0
}
1757
1758
void FictionBook2YearContext::text(const char *value)
1759
0
{
1760
  // TODO: implement me
1761
0
  librevenge::RVNGString str(value);
1762
0
  (void) str;
1763
0
}
1764
1765
}
1766
1767
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */