예제 #1
0
	bool parse_entity(const char * & ptr,pfc::string8 & name,pfc::string8 & value) {
		char delimiter = '\0';
		char tmp;
		t_size n = 0;
		while(isspace((unsigned char) *ptr)) ptr++;
		while(tmp = ptr[n], tmp && !isspace((unsigned char) tmp) && tmp != '=') n++;
		if (!ptr[n]) return false;
		name.set_string(ptr, n);
		ptr += n;
		while(isspace((unsigned char) *ptr)) ptr++;
		if (*ptr != '=') return false;
		ptr++;
		while(isspace((unsigned char) *ptr)) ptr++;
		// check delimiter
		if (*ptr == '\'' || *ptr == '"') {
			delimiter = *ptr;
			ptr++;
		}
		if (!*ptr) return false;

		n = 0;
		if (delimiter == '\0') {
			while(tmp = ptr[n], tmp && !isspace((unsigned char) tmp) && tmp != ';') n++;
		} else {
			while(tmp = ptr[n], tmp && tmp != delimiter) n++;
		}
		//if (!ptr[n]) return false;
		value.set_string(ptr, n);
		ptr += n;
		if (delimiter && *ptr == delimiter) ptr++;
		while(*ptr == ';' || isspace((unsigned char) *ptr)) ptr++;
		return true;
	}
bool find_menu_path( GUID & parent, pfc::string8 & out )
{
   if ( parent == pfc::guid_null )
   {
      out.set_string( "main menu" );
      return true;
   }
   else
   {
      service_enum_t<mainmenu_group> e;
	   service_ptr_t<mainmenu_group> ptr;

      while ( e.next( ptr ) )
      {
         if ( ptr->get_guid() == parent )
         {
            pfc::string8 tmp;

            service_ptr_t<mainmenu_group_popup> popup;

            if ( ptr->service_query_t( popup ) )
            {
               popup->get_display_string( tmp );  
               find_menu_path( ptr->get_parent(), out );
               out.add_string( "/" );
               out.add_string( tmp );
               return true;
            }
            else
            {
               find_menu_path( ptr->get_parent(), out );
               return true;
            }
         }
      }
   }

   out.set_string( "main menu" );
   return false;
}