AttributesIndex

Namespace: Itinero
We found 10 examples in language CSharp for this search. You will see 44 fragments of code.

        public void AddAttribute(string key, string value)
        {
            if (nodes.Count == 0)
            {
                return;
            }
            var node = nodes.Peek();
            value = XmlString.Escape(value);
            string attribute = $" {key}=\"{value}\"";
            result.Insert(node.AttributesIndex, attribute);
            node.AttributesIndex += attribute.Length;
        }

        public void PushNode(string name)
        {
            DisableCompoundClose();
            Indent();
            result.Append($"<{name}");
            int attributesIndex = result.Length;
            result.Append($">\n");
            nodes.Push(new Node
            {
                Name = name,
                AttributesIndex = attributesIndex,
            });
        }

        public void PopNode()
        {
            var top = nodes.Pop();
            if (top.HasChildren)
            {
                Indent();
                result.Append($"</{top.Name}>\n");
            }
            else
            {
                result.Insert(top.AttributesIndex, '/');
            }
        }


        public override void MoveToRoot() {
            m_Index = 0;
            AttributesIndex = -1;
        }

        public override bool MoveTo(XPathNavigator other) {
            Navigator otherNav = (Navigator)other;
            Root = otherNav.Root;
            AttributesIndex = otherNav.AttributesIndex;

            m_Index = otherNav.m_Index;
            for (int i = 0; i <= m_Index; i++) {
                m_ChildrenIndex[i] = otherNav.m_ChildrenIndex[i];
                m_Parents[i] = otherNav.m_Parents[i];
            }
            return true;
        }

        public override bool IsSamePosition(XPathNavigator other) {
            if (other == null) return false;
            Navigator otherNav = (Navigator)other;
            return Current == otherNav.Current && // Same element
                AttributesIndex == otherNav.AttributesIndex; // Same attribute
        }

        public override bool MoveToParent() {
            bool result = false;
            if (AttributesIndex > -1) {
                AttributesIndex = -1;
                result = true;
            } else result = Pop();
            return result;
        }

        // Elements
        public override bool MoveToFirstChild() {
            if (AttributesIndex > -1) return false; // Attributes don't have children
            return State.MoveToFirstChild(this);
        }


      public override IEnumerator<Tag> GetEnumerator()
      {
        return (IEnumerator<Tag>) new AttributesIndex.InternalTagsEnumerator(this._stringIndex, this._tags);
      }


        public override void MoveToRoot() {
            m_Index = 0;
            AttributesIndex = -1;
        }

        public override bool MoveTo(XPathNavigator other) {
            Navigator otherNav = (Navigator)other;
            Root = otherNav.Root;
            AttributesIndex = otherNav.AttributesIndex;

            m_Index = otherNav.m_Index;
            for (int i = 0; i <= m_Index; i++) {
                m_ChildrenIndex[i] = otherNav.m_ChildrenIndex[i];
                m_Parents[i] = otherNav.m_Parents[i];
            }
            return true;
        }

        public override bool IsSamePosition(XPathNavigator other) {
            if (other == null) return false;
            Navigator otherNav = (Navigator)other;
            return Current == otherNav.Current && // Same element
                AttributesIndex == otherNav.AttributesIndex; // Same attribute
        }

        public override bool MoveToParent() {
            bool result = false;
            if (AttributesIndex > -1) {
                AttributesIndex = -1;
                result = true;
            } else result = Pop();
            return result;
        }

        // Elements
        public override bool MoveToFirstChild() {
            if (AttributesIndex > -1) return false; // Attributes don't have children
            return State.MoveToFirstChild(this);
        }


        public override void MoveToRoot() {
            m_Index = 0;
            AttributesIndex = -1;
        }

        public override bool MoveTo(XPathNavigator other) {
            Navigator otherNav = (Navigator)other;
            Root = otherNav.Root;
            AttributesIndex = otherNav.AttributesIndex;

            m_Index = otherNav.m_Index;
            for (int i = 0; i <= m_Index; i++) {
                m_ChildrenIndex[i] = otherNav.m_ChildrenIndex[i];
                m_Parents[i] = otherNav.m_Parents[i];
            }
            return true;
        }

        public override bool IsSamePosition(XPathNavigator other) {
            if (other == null) return false;
            Navigator otherNav = (Navigator)other;
            return Current == otherNav.Current && // Same element
                AttributesIndex == otherNav.AttributesIndex; // Same attribute
        }

        public override bool MoveToParent() {
            bool result = false;
            if (AttributesIndex > -1) {
                AttributesIndex = -1;
                result = true;
            } else result = Pop();
            return result;
        }

        // Elements
        public override bool MoveToFirstChild() {
            if (AttributesIndex > -1) return false; // Attributes don't have children
            return State.MoveToFirstChild(this);
        }


        public override void MoveToRoot() {
            m_Index = 0;
            AttributesIndex = -1;
        }

        public override bool MoveTo(XPathNavigator other) {
            Navigator otherNav = (Navigator)other;
            Root = otherNav.Root;
            AttributesIndex = otherNav.AttributesIndex;

            m_Index = otherNav.m_Index;
            for (int i = 0; i <= m_Index; i++) {
                m_ChildrenIndex[i] = otherNav.m_ChildrenIndex[i];
                m_Parents[i] = otherNav.m_Parents[i];
            }
            return true;
        }

        public override bool IsSamePosition(XPathNavigator other) {
            if (other == null) return false;
            Navigator otherNav = (Navigator)other;
            return Current == otherNav.Current && // Same element
                AttributesIndex == otherNav.AttributesIndex; // Same attribute
        }

        public override bool MoveToParent() {
            bool result = false;
            if (AttributesIndex > -1) {
                AttributesIndex = -1;
                result = true;
            } else result = Pop();
            return result;
        }

        // Elements
        public override bool MoveToFirstChild() {
            if (AttributesIndex > -1) return false; // Attributes don't have children
            return State.MoveToFirstChild(this);
        }

        /// <summary>
        /// Adds a new attributes collection.
        /// </summary>
        public static uint Add(this AttributesIndex index, IEnumerable<Attribute> attributes)
        {
            return index.Add(new AttributeCollection(attributes));
        }

        /// <summary>
        /// Adds a new tag collection.
        /// </summary>
        public static uint Add(this AttributesIndex index, params Attribute[] attributes)
        {
            return index.Add(new AttributeCollection(attributes));
        }

        public void Push(int i, object newParent) {
            m_ChildrenIndex[++m_Index] = i;
            m_Parents[m_Index] = newParent;
        }
        public bool Pop() { 
            bool result = m_Index > 0;
            if (result)
                --m_Index;
            return result;
        }
        public int IncrementChildIndex() { return ++m_ChildrenIndex[m_Index]; }
        public void ResetChildIndex() { m_ChildrenIndex[m_Index] = 0; }

        public override void MoveToRoot() {
            m_Index = 0;
            AttributesIndex = -1;
        }

        public override XPathNavigator Clone() {
            Navigator newNav = new Navigator();
            newNav.MoveTo(this);
            return newNav;
        }

        public void Push(int i, object newParent) {
            m_ChildrenIndex[++m_Index] = i;
            m_Parents[m_Index] = newParent;
        }
        public bool Pop() { 
            bool result = m_Index > 0;
            if (result)
                --m_Index;
            return result;
        }
        public int IncrementChildIndex() { return ++m_ChildrenIndex[m_Index]; }
        public void ResetChildIndex() { m_ChildrenIndex[m_Index] = 0; }

        public override void MoveToRoot() {
            m_Index = 0;
            AttributesIndex = -1;
        }

        public override XPathNavigator Clone() {
            Navigator newNav = new Navigator();
            newNav.MoveTo(this);
            return newNav;
        }


        /// <summary>
        /// Generates a new guid.
        /// </summary>
        /// <remarks>To use then the network was changed externally and was already writting to disk before.</remarks>
        public void NewGuid()
        {
            _guid = Guid.NewGuid();
        }

        /// <summary>
        /// Returns true if the given vehicle is supported.
        /// </summary>
        public bool Supports(string vehicleName)
        {
            return _supportedVehicles.ContainsKey(vehicleName.ToLowerInvariant());
        }

        /// <summary>
        /// Gets one of the supported vehicles.
        /// </summary>
        public Vehicle GetSupportedVehicle(string vehicleName)
        {
            return _supportedVehicles[vehicleName.ToLowerInvariant()];
        }

        /// <summary>
        /// Gets all the supported vehicle.
        /// </summary>
        /// <returns></returns>
        public IEnumerable<Vehicle> GetSupportedVehicles()
        {
            return _supportedVehicles.Values;
        }

        /// <summary>
        /// Adds a supported vehicle.
        /// </summary>
        public void AddSupportedVehicle(Profiles.Vehicle vehicle)
        {
            _supportedVehicles[vehicle.Name.ToLowerInvariant()] = vehicle;
            foreach(var profile in vehicle.GetProfiles())
            {
                _supportedProfiles[profile.FullName.ToLowerInvariant()] = profile;
            }
        }

        /// <summary>
        /// Returns true if the profile with the given name is supported.
        /// </summary>
        public bool SupportProfile(string profileName)
        {
            return _supportedProfiles.ContainsKey(profileName);
        }

Itinero.Attributes.AttributesIndex : Object

Constructors :

public AttributesIndex(AttributesIndexMode mode = ReverseAll)
public AttributesIndex(MemoryMap map = , AttributesIndexMode mode = ReverseAll)

Methods :

public Boolean get_IsReadonly()
public Boolean get_CheckDuplicates()
public UInt32 get_Count()
public AttributesIndexMode get_IndexMode()
public IAttributeCollection Get(UInt32 tagsId = )
public UInt32 Add(IAttributeCollection tags = )
public Int64 Serialize(Stream stream = )
public static AttributesIndex Deserialize(Stream stream = , Boolean copy = False, AttributesIndexMode defaultIndexMode = ReverseStringIndexKeysOnly)
public Type GetType()
public String ToString()
public Boolean Equals(Object obj = )
public Int32 GetHashCode()

Other methods