// Constructor
 public CPlaceStructure( CPlaceStructure ps )
     : base(ps.Gedcom)
 {
     m_sPlaceName = ps.m_sPlaceName;
     m_sPlaceHierarchy = ps.m_sPlaceHierarchy;
     m_sPlacePhoneticVariation = ps.m_sPlacePhoneticVariation;
     m_sPlacePhoneticType = ps.m_sPlacePhoneticType;
     m_sPlaceRomanizedVariation = ps.m_sPlaceRomanizedVariation;
     m_sPlaceRomanizedType = ps.m_sPlaceRomanizedType;
     m_sPlaceLatitude = ps.m_sPlaceLatitude;
     m_sPlaceLongitude = ps.m_sPlaceLongitude;
     m_alNoteStructures = new ArrayList();
     foreach( CNoteStructure ns in ps.m_alNoteStructures )
     {
         m_alNoteStructures.Add( ns.CopyConstructor() );
     }
     m_alSourceCitations = new ArrayList();
     foreach( CSourceCitation sc in ps.m_alSourceCitations )
     {
         m_alSourceCitations.Add( sc.CopyConstructor() );
     }
 }
        // Parser
        public static CPlaceStructure Parse( CGedcom gedcom, int level )
        {
            CGedcomLine gedcomLine;

            // Temporary holders for class members. Saves constructing a class early.
            string sPlaceName;
            string sPlaceHierarchy = "";
            string sPlacePhoneticVariation = "";
            string sPlacePhoneticType = "";
            string sPlaceRomanizedVariation = "";
            string sPlaceRomanizedType = "";
            string sPlaceLatitude = "";
            string sPlaceLongitude = "";
            ArrayList noteStructures = new ArrayList();
            ArrayList sourceCitations = new ArrayList();

            CSourceCitation sourceCitation;
            CNoteStructure noteStructure;

            // There must be one of these, it defines the object.
            if ((gedcomLine = gedcom.GetLine(level, "PLAC")) == null)
            {
                // Not one of us
                return null;
            }
            sPlaceName = gedcomLine.LineItem;
            gedcom.IncrementLineIndex(1);

            bool bParsingFinished;
            do
            {
                bParsingFinished = true;

                if( (gedcomLine = gedcom.GetLine(level+1, "FORM")) != null )
                {
                    sPlaceHierarchy = gedcomLine.LineItem;
                    gedcom.IncrementLineIndex(1);
                    bParsingFinished = false;
                }
                else if( (gedcomLine = gedcom.GetLine(level+1, "FONE")) != null ) // WRONG!! These are 0:M
                {
                    sPlacePhoneticVariation = gedcomLine.LineItem;
                    gedcom.IncrementLineIndex(1);
                    if( (gedcomLine = gedcom.GetLine(level+2, "TYPE")) != null )
                    {
                        sPlacePhoneticType = gedcomLine.LineItem;
                        gedcom.IncrementLineIndex(1);
                    }
                    bParsingFinished = false;
                }
                else if( (gedcomLine = gedcom.GetLine(level+1, "ROMN")) != null ) // WRONG!! These are 0:M
                {
                    sPlaceRomanizedVariation = gedcomLine.LineItem;
                    gedcom.IncrementLineIndex(1);
                    if( (gedcomLine = gedcom.GetLine(level+2, "TYPE")) != null )
                    {
                        sPlaceRomanizedType = gedcomLine.LineItem;
                        gedcom.IncrementLineIndex(1);
                    }
                    bParsingFinished = false;
                }
                else if( (gedcomLine = gedcom.GetLine(level+1, "MAP")) != null )
                {
                    gedcom.IncrementLineIndex(1);
                    bool bParsingFinished2;
                    do
                    {
                        bParsingFinished2 = true;
                        if( (gedcomLine = gedcom.GetLine(level+2, "LATI")) != null )
                        {
                            sPlaceLatitude = gedcomLine.LineItem;
                            gedcom.IncrementLineIndex(1);
                            bParsingFinished2 = false;
                        }
                        else if( (gedcomLine = gedcom.GetLine(level+2, "LONG")) != null )
                        {
                            sPlaceLongitude = gedcomLine.LineItem;
                            gedcom.IncrementLineIndex(1);
                            bParsingFinished2 = false;
                        }
                    }
                    while( !bParsingFinished2 );

                    bParsingFinished = false;
                }
                else if( (sourceCitation = CSourceCitation.Parse( gedcom, level+1 )) != null )
                {
                    sourceCitations.Add( sourceCitation );
                    bParsingFinished = false;
                }
                else if( (noteStructure = CNoteStructure.Parse( gedcom, level+1 )) != null )
                {
                    noteStructures.Add( noteStructure );
                    bParsingFinished = false;
                }
                else if( ( gedcomLine = gedcom.GetLine()).Level > level )
                {
                    LogFile.TheLogFile.WriteLine( LogFile.DT_GEDCOM, LogFile.EDebugLevel.Warning, "Unknown tag :" );
                    LogFile.TheLogFile.WriteLine( LogFile.DT_GEDCOM, LogFile.EDebugLevel.Warning, gedcomLine.ToString() );
                    gedcom.IncrementLineIndex(1);
                    bParsingFinished = false;
                }
            }
            while( !bParsingFinished );

            // Parsing went ok. Construct a new object and return it.
            CPlaceStructure ps = new CPlaceStructure( gedcom );
            ps.m_sPlaceName = sPlaceName;
            ps.m_sPlaceHierarchy = sPlaceHierarchy;
            ps.m_sPlacePhoneticVariation = sPlacePhoneticVariation;
            ps.m_sPlacePhoneticType = sPlacePhoneticType;
            ps.m_sPlaceRomanizedVariation = sPlaceRomanizedVariation;
            ps.m_sPlaceRomanizedType = sPlaceRomanizedType;
            ps.m_sPlaceLatitude = sPlaceLatitude;
            ps.m_sPlaceLongitude = sPlaceLongitude;
            ps.m_alNoteStructures = noteStructures;
            ps.m_alSourceCitations = sourceCitations;
            return ps;
        }
Пример #3
0
 // Copy constructor
 public CEventDetail( CEventDetail ed )
     : base(ed.Gedcom)
 {
     m_sEventOrFactClassification = ed.m_sEventOrFactClassification;
     if( ed.m_dateValue != null )
     {
         m_dateValue = new CPGDate( ed.m_dateValue );
     }
     else
     {
         m_dateValue = null;
     }
     if( ed.m_placeStructure != null )
     {
         m_placeStructure = new CPlaceStructure( ed.m_placeStructure );
     }
     else
     {
         m_placeStructure = null;
     }
     if( ed.m_addressStructure != null )
     {
         m_addressStructure = new CAddressStructure( ed.m_addressStructure );
     }
     else
     {
         m_addressStructure = null;
     }
     m_sResponsibleAgency = ed.m_sResponsibleAgency;
     m_sReligiousAffiliation = ed.m_sReligiousAffiliation;
     m_sCauseOfEvent = ed.m_sCauseOfEvent;
     m_sRestrictionNotice = ed.m_sRestrictionNotice;
     m_alNoteStructures = new ArrayList();
     foreach( CNoteStructure ns in ed.m_alNoteStructures )
     {
         m_alNoteStructures.Add( ns.CopyConstructor() );
     }
     m_alSourceCitations = new ArrayList();
     foreach( CSourceCitation sc in ed.m_alSourceCitations )
     {
         m_alSourceCitations.Add( sc.CopyConstructor() );
     }
     m_alMultimediaLinks = new ArrayList();
     foreach( CMultimediaLink ml in ed.m_alMultimediaLinks )
     {
         m_alMultimediaLinks.Add( ml.CopyConstructor() );
     }
     m_sAgeAtEvent = ed.m_sAgeAtEvent;
     m_sHusbandAgeAtEvent = ed.m_sHusbandAgeAtEvent;
     m_sWifeAgeAtEvent = ed.m_sWifeAgeAtEvent;
     m_xrefFam = ed.m_xrefFam;
     m_bAdoptedByHusband = ed.m_bAdoptedByHusband;
     m_bAdoptedByWife = ed.m_bAdoptedByWife;
     m_xrefAdoptedChild = ed.m_xrefAdoptedChild;
     m_sAlternativePlace = ed.m_sAlternativePlace;
 }