Esempio n. 1
0
        public void AddRange(GDMList <T> list)
        {
            if (list != null && list.fDataList != null)
            {
                if (fDataList == null)
                {
                    fDataList = new List <T>();
                }

                fDataList.AddRange(list.fDataList);
            }
        }
Esempio n. 2
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (fTags != null)
         {
             fTags.Dispose();
             fTags = null;
         }
     }
     base.Dispose(disposing);
 }
Esempio n. 3
0
        public GDMSourceRecord(GDMTree tree) : base(tree)
        {
            SetName(GEDCOMTagType.SOUR);

            fData                = new GDMSourceData();
            fOriginator          = new GDMTextTag((int)GEDCOMTagType.AUTH);
            fPublication         = new GDMTextTag((int)GEDCOMTagType.PUBL);
            fRepositoryCitations = new GDMList <GDMRepositoryCitation>();
            fShortTitle          = string.Empty;
            fText                = new GDMTextTag((int)GEDCOMTagType.TEXT);
            fTitle               = new GDMTextTag((int)GEDCOMTagType.TITL);
        }
Esempio n. 4
0
        public GDMPersonalName()
        {
            SetName(GEDCOMTagType.NAME);

            fFirstPart = string.Empty;
            fSurname   = string.Empty;
            fLastPart  = string.Empty;

            fPieces          = new GDMPersonalNamePieces();
            fNotes           = new GDMList <GDMNotes>();
            fSourceCitations = new GDMList <GDMSourceCitation>();
        }
Esempio n. 5
0
        public void Test_AddWebPage1()
        {
            string     value    = "http://www.bitboost.com/ref/international-address-formats/russia/";
            GDMAddress instance = new GDMAddress(null);

            instance.AddWebPage(value);
            GDMList <GDMTag> wp = instance.WebPages;

            Assert.AreEqual(1, wp.Count);
            string res = wp.Extract(0).StringValue;

            Assert.AreEqual(res, value);
        }
Esempio n. 6
0
        public GDMSourceCitation()
        {
            SetName(GEDCOMTagType.SOUR);

            fCertaintyAssessment = -1;
            fDescription         = new GDMLines();
            fPage = string.Empty;

            fData            = new GDMSourceCitationData();
            fText            = new GDMTextTag((int)GEDCOMTagType.TEXT);
            fNotes           = new GDMList <GDMNotes>();
            fMultimediaLinks = new GDMList <GDMMultimediaLink>();
        }
Esempio n. 7
0
        public GDMTag FindTag(string tagName, int startIndex)
        {
            if (fTags == null)
            {
                return(null);
            }

            string su = GEDCOMUtils.InvariantTextInfo.ToUpper(tagName);

            int    pos = su.IndexOf('\\');
            string S   = (pos >= 0) ? su.Substring(0, pos) : su;

            GDMTag tempTag = this;

            while (true)
            {
                int index = (S == su) ? startIndex : 0;

                GDMList <GDMTag> tempSubTags = tempTag.fTags;
                int tempSubCount             = tempSubTags.Count;
                while (index < tempSubCount && tempSubTags[index].GetTagName() != S)
                {
                    index++;
                }
                if (index >= tempSubCount)
                {
                    break;
                }
                tempTag = tempSubTags[index];

                pos = su.IndexOf('\\');
                if (pos >= 0)
                {
                    su = su.Substring(pos + 1);

                    pos = su.IndexOf('\\');
                    S   = (pos >= 0) ? su.Substring(0, pos) : su;
                }
                else
                {
                    su = "";
                }

                if (su == "")
                {
                    return(tempTag);
                }
            }

            return(null);
        }
Esempio n. 8
0
        public void Test_AddPhoneNumber2()
        {
            string     value1   = "(214) 748-3647";
            string     value2   = "(999) 748-3647";
            GDMAddress instance = new GDMAddress(null);

            instance.AddPhoneNumber(value1);
            instance.AddPhoneNumber(value2);
            GDMList <GDMTag> pl = instance.PhoneNumbers;

            Assert.AreEqual(2, pl.Count);
            string res = pl[0].StringValue;

            Assert.AreEqual(res, value1);
            res = pl[1].StringValue;
            Assert.AreEqual(res, value2);
        }
Esempio n. 9
0
        public GDMAddress()
        {
            SetName(GEDCOMTagType.ADDR);

            fLines             = new GDMLines();
            fAddressLine1      = string.Empty;
            fAddressLine2      = string.Empty;
            fAddressLine3      = string.Empty;
            fAddressCity       = string.Empty;
            fAddressState      = string.Empty;
            fAddressPostalCode = string.Empty;
            fAddressCountry    = string.Empty;

            fPhoneList = new GDMList <GDMTag>();
            fEmailList = new GDMList <GDMTag>();
            fFaxList   = new GDMList <GDMTag>();
            fWWWList   = new GDMList <GDMTag>();
        }
Esempio n. 10
0
        public GDMAddress(GDMObject owner) : base(owner)
        {
            SetName(GEDCOMTagType.ADDR);

            fLines             = new StringList();
            fAddressLine1      = string.Empty;
            fAddressLine2      = string.Empty;
            fAddressLine3      = string.Empty;
            fAddressCity       = string.Empty;
            fAddressState      = string.Empty;
            fAddressPostalCode = string.Empty;
            fAddressCountry    = string.Empty;

            fPhoneList = new GDMList <GDMTag>(this);
            fEmailList = new GDMList <GDMTag>(this);
            fFaxList   = new GDMList <GDMTag>(this);
            fWWWList   = new GDMList <GDMTag>(this);
        }
Esempio n. 11
0
        public void Test_AddWebPage2()
        {
            string     value1   = "http://www.bitboost.com/ref/international-address-formats/russia/";
            string     value2   = "http://google.com/search";
            GDMAddress instance = new GDMAddress(null);

            instance.AddWebPage(value1);
            instance.AddWebPage(value2);
            GDMList <GDMTag> wp = instance.WebPages;

            Assert.AreEqual(2, wp.Count);
            string res1 = wp[0].StringValue;

            Assert.AreEqual(res1, value1);
            string res2 = wp[1].StringValue;

            Assert.AreEqual(res2, value2);
        }
Esempio n. 12
0
        /// <summary>
        /// Copying the sub-tags from the source to the current tag.
        /// </summary>
        /// <param name="source">A source tag.</param>
        public virtual void Assign(GDMTag source)
        {
            if (source == null)
            {
                return;
            }

            SetName(source.fId);
            ParseString(source.StringValue);

            if (source.fTags != null && source.fTags.Count > 0)
            {
                if (fTags == null)
                {
                    fTags = new GDMList <GDMTag>(this);
                }
                AssignList(source.fTags, this.fTags);
            }
        }
Esempio n. 13
0
        public void Test_Common()
        {
            GDMTag obj1 = new GDMTag();
            GDMTag obj2 = new GDMTag();

            using (var list = new GDMList <GDMTag>()) {
                // internal list is null (all routines instant returned)
                list.Delete(null);
                list.Exchange(0, 1);
                Assert.IsNull(list.Extract(0));
                Assert.IsNull(list.Extract(null));

                // normal checks
                list.Add(obj1);
                list.Add(obj2);
                Assert.AreEqual(0, list.IndexOf(obj1));
                Assert.AreEqual(1, list.IndexOf(obj2));

                using (var list2 = new GDMList <GDMTag>()) {
                    list2.AddRange(list);
                    Assert.AreEqual(2, list2.Count);
                }

                list.Delete(obj1);
                Assert.AreEqual(-1, list.IndexOf(obj1));
                Assert.AreEqual(0, list.IndexOf(obj2));

                list.Add(obj1);
                Assert.AreEqual(1, list.IndexOf(obj1));
                Assert.AreEqual(0, list.IndexOf(obj2));
                list.Exchange(0, 1);
                Assert.AreEqual(0, list.IndexOf(obj1));
                Assert.AreEqual(1, list.IndexOf(obj2));

                Assert.AreEqual(null, list.Extract(null));
                list.Add(obj1);
                Assert.AreEqual(obj1, list.Extract(obj1));
            }
        }
Esempio n. 14
0
        public void Test_Common()
        {
            GDMTag obj1 = new GDMTag(null);
            GDMTag obj2 = new GDMTag(null);

            using (GDMList <GDMTag> list = new GDMList <GDMTag>(null)) {
                // internal list is null (all routines instant returned)
                list.Delete(null);
                list.Exchange(0, 1);
                Assert.IsNull(list.Extract(0));
                Assert.IsNull(list.Extract(null));

                // normal checks
                list.Add(obj1);
                list.Add(obj2);
                Assert.AreEqual(0, list.IndexOf(obj1));
                Assert.AreEqual(1, list.IndexOf(obj2));

                list.Delete(obj1);
                Assert.AreEqual(-1, list.IndexOf(obj1));
                Assert.AreEqual(0, list.IndexOf(obj2));

                list.Add(obj1);
                Assert.AreEqual(1, list.IndexOf(obj1));
                Assert.AreEqual(0, list.IndexOf(obj2));
                list.Exchange(0, 1);
                Assert.AreEqual(0, list.IndexOf(obj1));
                Assert.AreEqual(1, list.IndexOf(obj2));

                Assert.AreEqual(null, list.Extract(null));
                list.Add(obj1);
                Assert.AreEqual(obj1, list.Extract(obj1));

                foreach (GDMObject obj in list)
                {
                }
            }
        }
Esempio n. 15
0
 protected GDMRecordWithEvents(GDMTree tree) : base(tree)
 {
     fEvents = new GDMList <GDMCustomEvent>();
 }
Esempio n. 16
0
        public GDMMultimediaRecord(GDMTree tree) : base(tree)
        {
            SetName(GEDCOMTagType.OBJE);

            fFileReferences = new GDMList <GDMFileReferenceWithTitle>();
        }
Esempio n. 17
0
 public GDMAssociation()
 {
     SetName(GEDCOMTagType.ASSO);
     fSourceCitations = new GDMList <GDMSourceCitation>();
 }
Esempio n. 18
0
 protected GDMRecordWithEvents(GDMObject owner) : base(owner)
 {
     fEvents = new GDMList <GDMCustomEvent>(this);
 }
Esempio n. 19
0
        public GDMMultimediaRecord(GDMObject owner) : base(owner)
        {
            SetName(GEDCOMTagType.OBJE);

            fFileReferences = new GDMList <GDMFileReferenceWithTitle>(this);
        }
Esempio n. 20
0
 public GDMPointerWithNotes(GDMObject owner) : base(owner)
 {
     fNotes = new GDMList <GDMNotes>(this);
 }
Esempio n. 21
0
 public GDMAssociation(GDMObject owner) : base(owner)
 {
     SetName(GEDCOMTagType.ASSO);
     fSourceCitations = new GDMList <GDMSourceCitation>(this);
 }
Esempio n. 22
0
 public GDMPointerWithNotes()
 {
     fNotes = new GDMList <GDMNotes>();
 }