UpnpString.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. #ifndef STRING_H
  2. #define STRING_H
  3. /*!
  4. * \defgroup UpnpString The UpnpString Class
  5. *
  6. * \brief Implements string operations in the UPnP library.
  7. *
  8. * \author Marcelo Roberto Jimenez
  9. *
  10. * \version 1.0
  11. *
  12. * @{
  13. *
  14. * \file
  15. *
  16. * \brief UpnpString object declaration.
  17. */
  18. #include "UpnpGlobal.h" /* for EXPORT_SPEC */
  19. #include <stdlib.h> /* for size_t */
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif /* __cplusplus */
  23. /*!
  24. * \brief Type of the string objects inside libupnp.
  25. */
  26. typedef struct s_UpnpString UpnpString;
  27. /*!
  28. * \brief Constructor.
  29. *
  30. * \return A pointer to a new allocated object.
  31. */
  32. EXPORT_SPEC UpnpString *UpnpString_new();
  33. /*!
  34. * \brief Destructor.
  35. */
  36. EXPORT_SPEC void UpnpString_delete(
  37. /*! [in] The \em \b this pointer. */
  38. UpnpString *p);
  39. /*!
  40. * \brief Copy Constructor.
  41. *
  42. * \return A pointer to a new allocated copy of the original object.
  43. */
  44. EXPORT_SPEC UpnpString *UpnpString_dup(
  45. /*! [in] The \em \b this pointer. */
  46. const UpnpString *p);
  47. /*!
  48. * \brief Assignment operator.
  49. */
  50. EXPORT_SPEC void UpnpString_assign(
  51. /*! [in] The \em \b this pointer. */
  52. UpnpString *p,
  53. /*! [in] The \em \b that pointer. */
  54. const UpnpString *q);
  55. /*!
  56. * \brief Returns the length of the string.
  57. *
  58. * \return The length of the string.
  59. * */
  60. EXPORT_SPEC size_t UpnpString_get_Length(
  61. /*! [in] The \em \b this pointer. */
  62. const UpnpString *p);
  63. /*!
  64. * \brief Truncates the string to the specified lenght, or does nothing
  65. * if the current lenght is less than or equal to the requested length.
  66. * */
  67. EXPORT_SPEC void UpnpString_set_Length(
  68. /*! [in] The \em \b this pointer. */
  69. UpnpString *p,
  70. /*! [in] The requested length. */
  71. size_t n);
  72. /*!
  73. * \brief Returns the pointer to char.
  74. *
  75. * \return The pointer to char.
  76. */
  77. EXPORT_SPEC const char *UpnpString_get_String(
  78. /*! [in] The \em \b this pointer. */
  79. const UpnpString *p);
  80. /*!
  81. * \brief Sets the string from a pointer to char.
  82. */
  83. EXPORT_SPEC int UpnpString_set_String(
  84. /*! [in] The \em \b this pointer. */
  85. UpnpString *p,
  86. /*! [in] (char *) to copy from. */
  87. const char *s);
  88. /*!
  89. * \brief Sets the string from a pointer to char using a maximum of N chars.
  90. */
  91. EXPORT_SPEC int UpnpString_set_StringN(
  92. /*! [in] The \em \b this pointer. */
  93. UpnpString *p,
  94. /*! [in] (char *) to copy from. */
  95. const char *s,
  96. /*! Maximum number of chars to copy.*/
  97. size_t n);
  98. /*!
  99. * \brief Clears the string, sets its size to zero.
  100. */
  101. EXPORT_SPEC void UpnpString_clear(
  102. /*! [in] The \em \b this pointer. */
  103. UpnpString *p);
  104. /*!
  105. * \brief Compares two strings for equality. Case matters.
  106. *
  107. * \return The result of strcmp().
  108. */
  109. EXPORT_SPEC int UpnpString_cmp(
  110. /*! [in] The \em \b the first string. */
  111. UpnpString *p,
  112. /*! [in] The \em \b the second string. */
  113. UpnpString *q);
  114. /*!
  115. * \brief Compares two strings for equality. Case does not matter.
  116. *
  117. * \return The result of strcasecmp().
  118. */
  119. EXPORT_SPEC int UpnpString_casecmp(
  120. /*! [in] The \em \b the first string. */
  121. UpnpString *p,
  122. /*! [in] The \em \b the second string. */
  123. UpnpString *q);
  124. #ifdef __cplusplus
  125. }
  126. #endif /* __cplusplus */
  127. /* @} UpnpString The UpnpString API */
  128. #endif /* STRING_H */