strange switch case problem
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: strange switch case problem

Threaded View

  1. #1
    Join Date
    Dec 2010
    Posts
    589

    strange switch case problem

    Code:
    template<class T>
    T GetValue<T>::get(TiXmlNode* pParent)
    {
    	T attr;
    	if ( !pParent ) return attr;
    
    	TiXmlNode* pChild;
    	TiXmlText* pText;
    	int t = pParent->Type();
    	
    	 
     
    
    	switch ( t )
    	{
    	case TiXmlNode::TINYXML_DOCUMENT:
    	 
    		break;
    
    	case TiXmlNode::TINYXML_ELEMENT:
    	 
    		 attr =get_attribs(pParent->ToElement());
    		break;
    
    	case TiXmlNode::TINYXML_COMMENT:
    	 
    		break;
    
    	case TiXmlNode::TINYXML_UNKNOWN:
    		 
    		break;
    
    	case TiXmlNode::TINYXML_TEXT:
    		pText = pParent->ToText();
    		 
    		break;
    
    	case TiXmlNode::TINYXML_DECLARATION:
    		 
    		break;
    	default:
    		break;
    	}
    	 
    	for ( pChild = pParent->FirstChild(); pChild != 0; pChild = pChild->NextSibling()) 
    	{
    		get( pChild );
    	}
    
    	return attr;
    
    }
    A breakpoint at
    case TiXmlNode::TINYXML_DOCUMENT:

    break; // here

    is never hit, why? It falls thru to the for loop straight off. The matching value is correct.
    Thanks
    Jack
    Last edited by lucky6969b; December 28th, 2012 at 01:31 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center