text: // MusicXML Class Library
  // Copyright (c) by Matthew James Briggs
  // Distributed under the MIT License
  
  #include "../../core/elements/OtherPlayAttributes.h"
  #include "../../core/FromXElement.h"
  #include <iostream>
  
  namespace mx
  {
      namespace core
      {
          OtherPlayAttributes::OtherPlayAttributes()
          :type()
          ,hasType( true )
          {}
  
  
          bool OtherPlayAttributes::hasValues() const
          {
              return hasType;
          }
  
  
          std::ostream& OtherPlayAttributes::toStream( std::ostream& os ) const
          {
              if ( hasValues() )
              {
                  streamAttribute( os, type, "type", hasType );
              }
              return os;
          }
  
  
          bool OtherPlayAttributes::fromXElement( std::ostream& message, xml::XElement& xelement )
          {
              const char* const className = "OtherPlayAttributes";
              bool isSuccess = true;
              bool isTypeFound = false;
          
              auto it = xelement.attributesBegin();
              auto endIter = xelement.attributesEnd();
          
              for( ; it != endIter; ++it )
              {
                  if( parseAttribute( message, it, className, isSuccess, type, isTypeFound, "type" ) ) { continue; }
              }
          
              if( !isTypeFound )
              {
                  isSuccess = false;
                  message << className << ": 'number' is a required attribute but was not found" << std::endl;
              }
          
              return isSuccess;
          }
  
      }
  }
  