File Manager / inc / utils /

common-utils.h

  1. /*
  2. * Copyright 2014 - 2015 Samsung Electronics Co., Ltd All Rights Reserved
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. *
  16. */
  17.  
  18. #ifndef COMMON_UTILS_H_
  19. #define COMMON_UTILS_H_
  20.  
  21. #include <Eina.h>
  22. #include <stdbool.h>
  23.  
  24. /**
  25. * @brief Appends input strings into new one
  26. * @remark result string is newly allocated string, so it must be free after use
  27. * @remark last input parameter of function must be NULL
  28. * @param[in] string1,... Input strings for concatenation
  29. * @return newly concatenated sting
  30. */
  31. char *common_util_strconcat(const char *string1, ...);
  32.  
  33. /**
  34. * @brief Check string on empty state
  35. * @param[in] string String to check
  36. * @return true is string is empty, false otherwise
  37. */
  38. bool common_util_is_string_empty(const char *string);
  39.  
  40. /**
  41. * @brief Copy file list from one to another (for EINA_LISTs that data is "node_info" type)
  42. * @param[in] source_list Source file list
  43. * @param[in/out] dest_list Destination file list
  44. * @return Error code. RESULT_TYPE_OK if operation success.
  45. */
  46. int common_util_copy_selected_file_list(Eina_List *source_list, Eina_List **dest_list);
  47.  
  48. /**
  49. * @brief Clear file list (for EINA_LISTs that data is "node_info" type)
  50. * @param[in] file_list File list to clear
  51. */
  52. void common_util_clear_file_list(Eina_List **file_list);
  53.  
  54. /**
  55. * @brief Clear storage list (for EINA_LISTs that data is "storage_info" type)
  56. * @param[in] file_list File list to clear
  57. */
  58. void common_util_clear_storage_list(Eina_List **storage_list);
  59.  
  60. /**
  61. * @brief Gets the filename from a give path
  62. * @param[in] The complete path
  63. * @return Only the file name
  64. */
  65. const char *common_util_get_filename(const char *path);
  66.  
  67. #endif /* COMMON_UTILS_H_ */