internal virtual bool IsSamePosition(ObjectNavigatorState other)
 {
     return(other._node == _node &&
            other._index == _index &&
            other._name == _name &&
            other._parent == _parent);
 }
		internal virtual bool IsSamePosition(ObjectNavigatorState other)
		{
			return other._node == _node &&
				other._index == _index &&
				other._name == _name &&
				other._parent == _parent;
		}
		/// <summary>
		/// Create a new navigator for the object graph
		/// starting at node. The node's name is nodeName.
		/// </summary>
		/// <param name="node">root</param>
		/// <param name="nodeName">root's name</param>
		public XPathObjectNavigator(object node, string nodeName)
		{
			_context = new ObjectNavigationContext();
			_context.NameTable.Add(string.Empty);			
			_root = new ObjectNavigatorStateRoot(_context, node, nodeName);
			_state = _root.MoveToFirstChild();
			_lang = _context.NameTable.Add("en-US");
		}
		public ObjectNavigatorState(ObjectNavigationContext context, ObjectNavigatorState parent, object node, string name)
		{			
			_parent = parent;
			_context = context;
			_node = node;
			_name = _context.NameTable.Add(name);
			_index = 0;
		}
 public ObjectNavigatorState(ObjectNavigationContext context, ObjectNavigatorState parent, object node, string name)
 {
     _parent  = parent;
     _context = context;
     _node    = node;
     _name    = _context.NameTable.Add(name);
     _index   = 0;
 }
		internal ObjectNavigatorStateRoot(ObjectNavigationContext context, object node, string nodeName) : base(context, null, node, "#document")
		{
			if (null == nodeName)
			{
				nodeName = _node.GetType().Name;
			}
			
			_child = CreateElementState(context, this, node, nodeName);
		}
        internal ObjectNavigatorStateRoot(ObjectNavigationContext context, object node, string nodeName) : base(context, null, node, "#document")
        {
            if (null == nodeName)
            {
                nodeName = _node.GetType().Name;
            }

            _child = CreateElementState(context, this, node, nodeName);
        }
Exemple #8
0
 internal override ObjectNavigatorState MoveToChild(int index)
 {
     while (index < _children.Count)
     {
         object child = _children[index];
         if (null != child)
         {
             ObjectNavigatorState state = CreateElementState(_context, this, child, child.GetType().Name);
             state.Index = index;
             return(state);
         }
         ++index;
     }
     return(null);
 }
Exemple #9
0
 internal override ObjectNavigatorState MoveToChild(int index)
 {
     while (index < _children.Count)
     {
         object key   = _children[index];
         object child = _dictionary[key];
         if (null != child)
         {
             ObjectNavigatorState state = CreateElementState(_context, this, child, key.ToString());
             state.Index = index;
             return(state);
         }
         ++index;
     }
     return(null);
 }
Exemple #10
0
 internal override ObjectNavigatorState MoveToChild(int index)
 {
     CheckChildren();
     while (index < _children.Length)
     {
         object child = _children[index].GetValue(_node);
         if (null != child)
         {
             ObjectNavigatorState state = CreateElementState(_context, this, child, _children[index].Name);
             state.Index = index;
             return(state);
         }
         ++index;
     }
     return(null);
 }
Exemple #11
0
 internal ObjectNavigatorStateList(ObjectNavigationContext context, ObjectNavigatorState parent, object node, string name) :
     base(context, parent, node, name)
 {
     _children = (IList)node;
 }
		/// <summary>
		/// copy constructor.
		/// </summary>
		/// <param name="other">navigator to be copied</param>
		public XPathObjectNavigator(XPathObjectNavigator other)
		{
			_context = other._context;
			_state = other._state;
			_root = other._root;
			_lang = other._lang;
		}
		/// <summary>
		/// See <see cref="System.Xml.XPath.XPathNavigator.MoveToParent" /> for details.
		/// </summary>
		public override bool MoveToParent()
		{
			Trace("MoveToParent");
			if (null != _state.Parent)
			{
				_state = _state.Parent;
				return true;
			}
			return false;
		}
		/// <summary>
		/// See <see cref="System.Xml.XPath.XPathNavigator.MoveToRoot" /> for details.
		/// </summary>
		public override void MoveToRoot()
		{
			Trace("MoveToRoot");
			_state = _root;
		}
		/// <summary>
		/// See <see cref="System.Xml.XPath.XPathNavigator.MoveToNext" /> for details.
		/// </summary>
		public override bool MoveToNext()
		{
			Trace("MoveToNext");
			ObjectNavigatorState newstate = _state.MoveToNext();
			if (null != newstate)
			{
				_state = newstate;
				return true;
			}
			return false;
		}
		/// <summary>
		/// See <see cref="System.Xml.XPath.XPathNavigator.MoveToFirstChild" /> for details.
		/// </summary>
		public override bool MoveToFirstChild()
		{
			Trace("MoveToFirstChild");
			ObjectNavigatorState newstate = _state.MoveToFirstChild();
			if (null == newstate)
			{
				return false;
			}
			_state = newstate;
			return true;
		}
Exemple #17
0
 internal ObjectNavigatorStateDictionary(ObjectNavigationContext context, ObjectNavigatorState parent, object node, string name) :
     base(context, parent, node, name)
 {
     _dictionary = (IDictionary)node;
     _children   = new ArrayList(_dictionary.Keys);
 }
 internal static ObjectNavigatorState CreateElementState(ObjectNavigationContext context, ObjectNavigatorState parent, object node, string name)
 {
     if (node is IDictionary)
     {
         return(new ObjectNavigatorStateDictionary(context, parent, node, name));
     }
     else if (node is IList)
     {
         return(new ObjectNavigatorStateList(context, parent, node, name));
     }
     else
     {
         return(new ObjectNavigatorStateItem(context, parent, node, name));
     }
 }
		internal ObjectNavigatorStateDictionary(ObjectNavigationContext context, ObjectNavigatorState parent, object node, string name) :
			base(context, parent, node, name)
		{
			_dictionary = (IDictionary)node;
			_children = new ArrayList(_dictionary.Keys);
		}
		internal static ObjectNavigatorState CreateElementState(ObjectNavigationContext context, ObjectNavigatorState parent, object node, string name)
		{
			if (node is IDictionary)
			{
				return new ObjectNavigatorStateDictionary(context, parent, node, name);
			}
			else if (node is IList)
			{
				return new ObjectNavigatorStateList(context, parent, node, name);
			}
			else
			{
				return new ObjectNavigatorStateItem(context, parent, node, name);
			}
		}
Exemple #21
0
 internal ObjectNavigatorStateItem(ObjectNavigationContext context, ObjectNavigatorState parent, object node, string name) :
     base(context, parent, node, name)
 {
 }
		internal ObjectNavigatorStateList(ObjectNavigationContext context, ObjectNavigatorState parent, object node, string name) :
			base(context, parent, node, name)
		{
			_children = (IList)node;			
		}
		/// <summary>
		/// See <see cref="System.Xml.XPath.XPathNavigator.MoveTo" /> for details.
		/// </summary>
		public override bool MoveTo(System.Xml.XPath.XPathNavigator other)
		{
			Trace("MoveTo");
			XPathObjectNavigator navigator = other as XPathObjectNavigator;
			if (null == other)
			{
				return false;
			}
			_state = navigator._state;
			_root = navigator._root;
			_context = navigator._context;
			return true;
		}