/// <summary> /// Constructs a GEDCOMRecord object /// </summary> /// <remarks> /// This constructor is primarily to allow sublasses of GEDCOMRecord /// to be constructed from the base class /// </remarks> /// <param name = "record">A GEDCOM Record</param> internal GEDCOMRecord(GEDCOMRecord record) { Level = record.Level; Id = record.Id; _xRefId = record.XRefId; Tag = record.Tag; _data = record.Data; _childRecords = record.ChildRecords; }
/// <summary> /// Constructs a GEDCOMRecord object /// </summary> /// <param name = "level">The level (or depth) of the GEDCOM Record</param> /// <param name = "id">the id of the record</param> /// <param name = "xRefId">An optional XrefId reference</param> /// <param name = "tag">The tag name of the GEDCOM Record</param> /// <param name = "data">The data part of the GEDCOM Record</param> internal GEDCOMRecord(int level, string id, string xRefId, string tag, string data) { Level = level; Id = id; _xRefId = xRefId; Tag = tag; _data = data; _childRecords = new GEDCOMRecordList(); }
/// <summary> /// Adds a list of records to the collection /// </summary> /// <param name = "records">A GEDCOMRecordList</param> public void AddRange(GEDCOMRecordList records) { for (int i = 0; i < records.Count; i++) { GEDCOMRecord item = records[i]; list.Add(item); AddToDictionary(item, true); } }
/// <summary> /// The GetXRefIDs method returns a string Collection of xREfIDs with /// the tagName specified /// </summary> /// <param name = "tagName">The tag</param> /// <returns>A string collection (empty if not present)</returns> public List <string> GetXRefIDs(GEDCOMTag tagName) { List <string> xRefIDs = null; GEDCOMRecordList records = GetLinesByTag(tagName); if (records != null) { xRefIDs = new List <string>(); for (int i = 0; i < records.Count; i++) { xRefIDs.Add(records[i].XRefId); } } return(xRefIDs); }
/// <summary> /// The GetLinesByTag method returns a GEDCOMRecords Collection of lines with /// the same tagName property /// </summary> /// <param name = "tagName">The provided tagName</param> /// <returns>A GEDCOMRecords collection (empty if not present)</returns> public GEDCOMRecordList GetLinesByTag(GEDCOMTag tagName) { List <GEDCOMRecord> tagList = null; GEDCOMRecordList records = new GEDCOMRecordList(); bool bFound = tagDictionary.TryGetValue(tagName, out tagList); if (bFound) { foreach (GEDCOMRecord record in tagList) { records.Add(record); } } return(records); }
/// <summary> /// Constructs a GEDCOMRecord object /// </summary> /// <param name = "record">The record of text that represents a GEDCOMRecord</param> internal GEDCOMRecord(string record) { Parse(record); _childRecords = new GEDCOMRecordList(); }