pub struct EntryCodeMappingOverlay {
    pub attribute_entry_codes_mapping: BTreeMap<String, Vec<String>>,
    /* private fields */
}

Fields§

§attribute_entry_codes_mapping: BTreeMap<String, Vec<String>>

Implementations§

Examples found in repository?
src/state/oca.rs (line 626)
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
    pub fn add_attribute(mut self, attr: Attribute) -> OCABuilder {
        self.oca.capture_base.add(&attr);

        if attr.mapping.is_some() {
            let mut attribute_mapping_ov = self
                .oca
                .overlays
                .iter_mut()
                .find(|x| x.overlay_type().contains("/mapping/"));
            if attribute_mapping_ov.is_none() {
                self.oca.overlays.push(overlay::AttributeMapping::new());
                attribute_mapping_ov = self.oca.overlays.last_mut();
            }

            if let Some(ov) = attribute_mapping_ov {
                ov.add(&attr)
            }
        }

        if attr.condition.is_some() {
            let mut conditional_ov = self
                .oca
                .overlays
                .iter_mut()
                .find(|x| x.overlay_type().contains("/conditional/"));
            if conditional_ov.is_none() {
                self.oca.overlays.push(overlay::Conditional::new());
                conditional_ov = self.oca.overlays.last_mut();
            }
            if let Some(ov) = conditional_ov {
                ov.add(&attr);
            }
        }

        if attr.cardinality.is_some() {
            let mut cardinality_ov = self
                .oca
                .overlays
                .iter_mut()
                .find(|x| x.overlay_type().contains("/cardinality/"));
            if cardinality_ov.is_none() {
                self.oca.overlays.push(overlay::Cardinality::new());
                cardinality_ov = self.oca.overlays.last_mut();
            }

            if let Some(ov) = cardinality_ov {
                ov.add(&attr)
            }
        }

        if attr.conformance.is_some() {
            let mut conformance_ov = self
                .oca
                .overlays
                .iter_mut()
                .find(|x| x.overlay_type().contains("/conformance/"));
            if conformance_ov.is_none() {
                self.oca.overlays.push(overlay::Conformance::new());
                conformance_ov = self.oca.overlays.last_mut();
            }

            if let Some(ov) = conformance_ov {
                ov.add(&attr)
            }
        }

        if attr.encoding.is_some() {
            let encoding_ov = self
                .oca
                .overlays
                .iter_mut()
                .find(|x| x.overlay_type().contains("/character_encoding/"));
            if let Some(ov) = encoding_ov {
                ov.add(&attr);
            }
        }

        if attr.format.is_some() {
            let mut format_ov = self
                .oca
                .overlays
                .iter_mut()
                .find(|x| x.overlay_type().contains("/format/"));
            if format_ov.is_none() {
                self.oca.overlays.push(overlay::Format::new());
                format_ov = self.oca.overlays.last_mut();
            }

            if let Some(ov) = format_ov {
                ov.add(&attr)
            }
        }

        if attr.unit.is_some() {
            let mut unit_ov = self.oca.overlays.iter_mut().find(|x| {
                if let Some(o_metric_system) = x.metric_system() {
                    return o_metric_system == attr.metric_system.as_ref().unwrap()
                        && x.overlay_type().contains("/unit/");
                }
                false
            });
            if unit_ov.is_none() {
                self.oca.overlays.push(overlay::Unit::new(
                    attr.metric_system.as_ref().unwrap().clone(),
                ));
                unit_ov = self.oca.overlays.last_mut();
            }

            if let Some(ov) = unit_ov {
                ov.add(&attr)
            }
        }

        if attr.entry_codes.is_some() {
            let mut entry_code_ov = self
                .oca
                .overlays
                .iter_mut()
                .find(|x| x.overlay_type().contains("/entry_code/"));
            if entry_code_ov.is_none() {
                self.oca.overlays.push(overlay::EntryCode::new());
                entry_code_ov = self.oca.overlays.last_mut();
            }

            if let Some(ov) = entry_code_ov {
                ov.add(&attr)
            }
        }

        if attr.entry_codes_mapping.is_some() {
            let mut entry_code_mapping_ov = self
                .oca
                .overlays
                .iter_mut()
                .find(|x| x.overlay_type().contains("/entry_code_mapping/"));
            if entry_code_mapping_ov.is_none() {
                self.oca.overlays.push(overlay::EntryCodeMapping::new());
                entry_code_mapping_ov = self.oca.overlays.last_mut();
            }

            if let Some(ov) = entry_code_mapping_ov {
                ov.add(&attr)
            }
        }

        if !attr.translations.is_empty() {
            if self.cat_attributes.lang.is_empty() {
                self.cat_attributes.lang = attr.translations.keys().next().unwrap().clone();
            }
            let attr_tr = attr.translations.get(&self.cat_attributes.lang).unwrap();
            if let Some(value) = &attr_tr.label {
                let mut splitted = value.split('|').collect::<Vec<&str>>();
                splitted.pop();
                self.cat_attributes
                    .add_to_category(splitted, attr.name.clone(), attr.sai.clone());
            }
            for (lang, attr_tr) in attr.translations.iter() {
                let mut label_ov = self.oca.overlays.iter_mut().find(|x| {
                    if let Some(o_lang) = x.language() {
                        return o_lang == lang && x.overlay_type().contains("/label/");
                    }
                    false
                });
                if label_ov.is_none() {
                    self.oca
                        .overlays
                        .push(overlay::Label::new(lang.to_string()));
                    label_ov = self.oca.overlays.last_mut();
                }
                if let Some(ov) = label_ov {
                    ov.add(&attr);
                }

                if attr_tr.information.is_some() {
                    let mut information_ov = self.oca.overlays.iter_mut().find(|x| {
                        if let Some(o_lang) = x.language() {
                            return o_lang == lang && x.overlay_type().contains("/information/");
                        }
                        false
                    });
                    if information_ov.is_none() {
                        self.oca
                            .overlays
                            .push(overlay::Information::new(lang.to_string()));
                        information_ov = self.oca.overlays.last_mut();
                    }
                    if let Some(ov) = information_ov {
                        ov.add(&attr);
                    }
                }

                if attr_tr.entries.is_some() {
                    let mut entry_ov = self.oca.overlays.iter_mut().find(|x| {
                        if let Some(o_lang) = x.language() {
                            return o_lang == lang && x.overlay_type().contains("/entry/");
                        }
                        false
                    });
                    if entry_ov.is_none() {
                        self.oca
                            .overlays
                            .push(overlay::Entry::new(lang.to_string()));
                        entry_ov = self.oca.overlays.last_mut();
                    }
                    if let Some(ov) = entry_ov {
                        ov.add(&attr);
                    }
                }
            }
        }
        self
    }

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.