/// <summary> /// Sets up the tag and severity of this source /// </summary> /// <param name="parent">Parent tag</param> /// <param name="severity">Source severity</param> public DebugSource( Tag parent, Severity severity ) : base(parent, severity) { }
/// <summary> /// Sets up this tag /// </summary> /// <param name="parent">The parent tag</param> /// <param name="name">Tag name</param> public Tag( Tag parent, string name ) { Construct( parent, name ); }
/// <summary> /// Builds or finds a source from a '.' seperated string /// </summary> /// <param name="str">Tags and source string</param> /// <returns>New/found source</returns> public static Source BuildFromString( string str ) { string[] sepStr = str.Split( new char[] { '.' } ); Tag curTag = Tag.Root; for ( int strIndex = 0; strIndex < sepStr.Length - 1; ++strIndex ) { Tag childTag = curTag.FindChildTag( sepStr[ strIndex ] ); if ( childTag == null ) { childTag = new Tag( curTag, sepStr[ strIndex ] ); } curTag = childTag; } Severity severity = ( Severity )Enum.Parse( typeof( Severity ), sepStr[ sepStr.Length - 1 ] ); return curTag.GetSource( severity ); }
/// <summary> /// Construction helper /// </summary> /// <param name="parent">Parent tag</param> /// <param name="name">Tag name</param> private void Construct( Tag parent, string name ) { m_Parent = parent; m_Name = name; m_Parent.m_ChildTags.Add( this ); m_FullName = ( m_Parent.IsRootTag ? name : m_Parent.FullName + "." + name ); for ( int severity = 0; severity < ( int )Severity.Count; ++severity ) { m_DebugSources[ severity ] = new DebugSource( this, ( Severity )severity ); m_Sources[ severity ] = new Source( this, ( Severity )severity ); } }
/// <summary> /// Sets up the source object /// </summary> /// <param name="parent">The parent of the source</param> /// <param name="severity">Source severity</param> public Source( Tag parent, Severity severity ) { m_Severity = severity; m_Name = severity.ToString( ); m_FullName = ( parent.IsRootTag ? m_Name : parent.FullName + "." + m_Name ); }