コード例 #1
0
ファイル: nav_flat.c プロジェクト: AndreyMostovov/asf
//! This function goes to a position in file list FLAT
//!
//! @param     u16_newpos     new position to select (0 is the first position)
//!
//! @return    false in case of error, see global value "fs_g_status" for more detail
//! @return    true otherwise
//!
bool  nav_flat_goto( uint16_t u16_newpos )
{
   if (u16_newpos < (nav_flat_get()/2))
   {
      // Restart at the beginning of list to accelerate the search
      if (!nav_flat_reset())
         return false;
   }
   if (!nav_flat_validpos())
   {
      // Go to first position
      if (!nav_flat_next())
         return false;  // Empty list
   }

   while(u16_newpos < nav_flat_get())
   {
      if( !nav_flat_previous())
         return false; // Position error
   }
   while(u16_newpos > nav_flat_get())
   {
      if( !nav_flat_next())
         return false; // End of the list, then the position is bad
   }
   return true;
}
コード例 #2
0
ファイル: nav_flat.c プロジェクト: AndreyMostovov/asf
//! This function searches a file name in file list FLAT
//!
//! @param     sz_name        name to search (UNICODE or ASCII) <br>
//!                           It must be terminated by NULL or '*' value
//! @param     b_match_case   false to ignore the case
//!
//! @return    false in case of error, see global value "fs_g_status" for more detail
//! @return    true otherwise
//!
//! @verbatim
//! This function starts a search at the next position of the current in file list
//! @endverbatim
//!
bool  nav_flat_findname( const FS_STRING sz_name , bool b_match_case )
{
   while( 1 )
   {
      if ( !nav_flat_next() )
         return false;
      if ( nav_file_name( sz_name , 0 , FS_NAME_CHECK , b_match_case ))
         return true;
   }
}
コード例 #3
0
ファイル: nav_flat.c プロジェクト: derkling/adplayer
//! This function searchs a file name in file list FLAT
//!
//! @param     sz_name        name to search (UNICODE or ASCII) <br>
//!                           It must be terminated by NULL or '*' value
//! @param     b_match_case   FALSE to ignore the case
//!
//! @return    FALSE in case of error, see global value "fs_g_status" for more detail
//! @return    TRUE otherwise
//!
//! @verbatim
//! This function starts a search at the next position of the current in file list
//! @endverbatim
//!
Bool  nav_flat_findname( const FS_STRING sz_name , Bool b_match_case )
{
    while( 1 )
    {
        if ( !nav_flat_next() )
            return FALSE;
        if ( nav_file_name( sz_name , 0 , FS_NAME_CHECK , b_match_case ))
            return TRUE;
    }
}
コード例 #4
0
ファイル: nav_flat.c プロジェクト: AndreyMostovov/asf
//! This function goes to the parent directory
//!
//! @return  false in case of error, see global value "fs_g_status" for more detail
//! @return  true otherwise
//!
//! @verbatim
//! After the selected file is the first entry of the new file list FLAT
//! @endverbatim
//!
bool  nav_flat_gotoparent( void )
{
   _MEM_TYPE_SLOW_ Fs_index index;
   index = nav_getindex();
   while( 0 != fs_g_nav.u8_flat_dir_level )
   {
      fs_g_nav.u8_flat_dir_level--;
      nav_dir_gotoparent();
   }
   if( !nav_dir_gotoparent() )
   {
      nav_gotoindex( &index );
      return false;
   }
   // Go to at the beginning of FLAT list
   fs_g_nav.u8_flat_dir_level   = 0;
   fs_g_nav.u16_flat_pos_offset = 0;
   nav_filelist_reset();
   nav_flat_next();
   return true;
}
コード例 #5
0
ファイル: nav_flat.c プロジェクト: AndreyMostovov/asf
//! This function computes the number of files and directories present in the file list FLAT
//!
//! @return    number of files and directories present in the file list FLAT
//!
uint16_t   nav_flat_nb( void )
{
   uint16_t   u16_save_position;
   uint16_t   u16_number;

   // Save current position
   u16_save_position = nav_flat_get();

   // Reset position
   if ( !nav_flat_reset())
      return 0;

   // Scan all directories
   u16_number  = 0;
   while( nav_flat_next() )
   {
      u16_number++;
   }
   // Restore previous position
   nav_flat_goto( u16_save_position );

   return u16_number;
}