Made function to update the line count of a view private
This commit is contained in:
@ -78,6 +78,26 @@ static char* build_obiview_file_name();
|
|||||||
int create_obiview_file(int dms_file_descriptor);
|
int create_obiview_file(int dms_file_descriptor);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Internal function to update the line count in the context of a view.
|
||||||
|
*
|
||||||
|
* All columns of the view are enlarged to contain at least the new line count.
|
||||||
|
*
|
||||||
|
* @warning The view must be writable.
|
||||||
|
*
|
||||||
|
* @param view A pointer on the view.
|
||||||
|
* @param line_count The new line count.
|
||||||
|
*
|
||||||
|
* @returns A value indicating the success of the operation.
|
||||||
|
* @retval 0 if the operation was successfully completed.
|
||||||
|
* @retval -1 if an error occurred.
|
||||||
|
*
|
||||||
|
* @since February 2016
|
||||||
|
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||||
|
*/
|
||||||
|
int update_lines(Obiview_p view, index_t line_count);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal function preparing to set a value in a column, in the context of a view.
|
* Internal function preparing to set a value in a column, in the context of a view.
|
||||||
*
|
*
|
||||||
@ -249,6 +269,26 @@ int create_obiview_file(int dms_file_descriptor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int update_lines(Obiview_p view, index_t line_count)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i=0; i<(view->column_count); i++)
|
||||||
|
{
|
||||||
|
while (line_count > (((view->columns)[i])->header)->line_count)
|
||||||
|
{
|
||||||
|
// Enlarge the column
|
||||||
|
if (obi_enlarge_column((view->columns)[i]) < 0)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
view->line_count = line_count;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int prepare_to_set_value_in_column(Obiview_p view, OBIDMS_column_p* column_pp, index_t* line_nb_p)
|
int prepare_to_set_value_in_column(Obiview_p view, OBIDMS_column_p* column_pp, index_t* line_nb_p)
|
||||||
{
|
{
|
||||||
// Check that the view is not read-only
|
// Check that the view is not read-only
|
||||||
@ -277,7 +317,7 @@ int prepare_to_set_value_in_column(Obiview_p view, OBIDMS_column_p* column_pp, i
|
|||||||
|
|
||||||
if (((*line_nb_p)+1) > view->line_count)
|
if (((*line_nb_p)+1) > view->line_count)
|
||||||
{
|
{
|
||||||
if (obi_view_update_lines(view, ((*line_nb_p)+1)) < 0)
|
if (update_lines(view, ((*line_nb_p)+1)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -936,26 +976,6 @@ int obi_select_lines(Obiview_p view, index_t* line_nbs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int obi_view_update_lines(Obiview_p view, index_t line_count)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i=0; i<(view->column_count); i++)
|
|
||||||
{
|
|
||||||
while (line_count > (((view->columns)[i])->header)->line_count)
|
|
||||||
{
|
|
||||||
// Enlarge the column
|
|
||||||
if (obi_enlarge_column((view->columns)[i]) < 0)
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
view->line_count = line_count;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int obi_save_view(Obiview_p view)
|
int obi_save_view(Obiview_p view)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -439,26 +439,6 @@ int obi_select_line(Obiview_p view, index_t line_nb);
|
|||||||
int obi_select_lines(Obiview_p view, index_t* line_nbs);
|
int obi_select_lines(Obiview_p view, index_t* line_nbs);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Update the line count in the context of a view.
|
|
||||||
*
|
|
||||||
* All columns of the view are enlarged to contain at least the new line count.
|
|
||||||
*
|
|
||||||
* @warning The view must be writable.
|
|
||||||
*
|
|
||||||
* @param view A pointer on the view.
|
|
||||||
* @param line_count The new line count.
|
|
||||||
*
|
|
||||||
* @returns A value indicating the success of the operation.
|
|
||||||
* @retval 0 if the operation was successfully completed.
|
|
||||||
* @retval -1 if an error occurred.
|
|
||||||
*
|
|
||||||
* @since February 2016
|
|
||||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
|
||||||
*/
|
|
||||||
int obi_view_update_lines(Obiview_p view, index_t line_count);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Saves a view, writing it in the view file.
|
* @brief Saves a view, writing it in the view file.
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user