////////////////////////////////////////////////////////////////////////////////////////////// // DocNet is licensed under the MIT License (MIT) // Copyright(c) 2016 Frans Bouma // Get your copy at: https://github.com/FransBouma/DocNet // // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in the // Software without restriction, including without limitation the rights to use, copy, // modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, // and to permit persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included in all copies // or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. ////////////////////////////////////////////////////////////////////////////////////////////// using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Docnet { public abstract class NavigationElement : INavigationElement where T : class { /// /// Generates the output for this navigation element /// /// The active configuration to use for the output. /// The active path navigated through the ToC to reach this element. /// true if everything went well, false otherwise public abstract void GenerateOutput(Config activeConfig, NavigatedPath activePath); /// /// Generates the ToC fragment for this element, which can either be a simple line or a full expanded menu. /// /// The navigated path to the current element, which doesn't necessarily have to be this element. /// The relative path back to the URL root, e.g. ../.., so it can be used for links to elements in this path. /// public abstract string GenerateToCFragment(NavigatedPath navigatedPath, string relativePathToRoot); /// /// Collects the search index entries. These are created from simple navigation elements found in this container, which aren't index element. /// /// The collected entries. /// The active path currently navigated. public abstract void CollectSearchIndexEntries(List collectedEntries, NavigatedPath activePath); #region Properties public abstract string TargetURL { get; } /// /// Gets / sets a value indicating whether this element is the __index element /// public abstract bool IsIndexElement { get; set; } public string Name { get; set; } /// /// Gets or sets the value of this element, which can either be a string or a NavigationLevel /// public T Value { get; set; } object INavigationElement.Value { get { return this.Value; } set { this.Value = value as T; } } public NavigationLevel ParentContainer { get; set; } #endregion } }