word.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. /* INFO THIS
  2. * file: word.c */
  3. # ifndef L_LIB_WORD_U
  4. # define L_LIB_WORD_U
  5. // /* USE
  6. // * THIS word__clear
  7. // * THIS word__copy */
  8. // # include <stdio.h>
  9. // /* INCLUDE
  10. // * printf */
  11. /* */
  12. # include <iostream>
  13. /* INCLUDE
  14. * std::cout
  15. * std::endl */
  16. // /* USE
  17. // * THIS word__create */
  18. // # include <stdlib.h>
  19. // /* INCLUDE
  20. // * malloc
  21. // * free */
  22. /* TODO THOUGH
  23. * word__clear = word__init ??? */
  24. /* USE
  25. * THIS word__clear
  26. * THIS word__init */
  27. # include <stddef.h>
  28. /* INCLUDE
  29. * NULL */
  30. /* USE
  31. * THIS word__clear
  32. * THIS word__copy */
  33. # include "word.h"
  34. /* INCLUDE
  35. * Word
  36. * Word.value
  37. * Word.previous
  38. * Word.next
  39. * word__clear
  40. * word__copy */
  41. /* USE
  42. * THIS symbols__clear
  43. * THIS symbols__copy */
  44. // # include "symbols.h"
  45. /* INCLUDE
  46. * Symbols
  47. * String
  48. * symbols__clear
  49. * symbols__copy */
  50. /* INFO
  51. * do: COPY Word */
  52. Word::Word (Word &word)
  53. {
  54. /* set value */
  55. this->value = word.value;
  56. /* set point previous */
  57. this->previous = word.previous;
  58. /* set point next */
  59. this->next = word.next;
  60. /* log */
  61. printf ("word copyed\n");
  62. }
  63. // /* INFO
  64. // * do: CHECK symbols */
  65. // void
  66. // int__check (int *self)
  67. // {
  68. // if (self == NULL)
  69. // {
  70. // printf ("12");
  71. // }
  72. // }
  73. /* INFO
  74. * do: REMOVE Word */
  75. Word::~Word ()
  76. {
  77. /* if self void then error not will */
  78. // int__check (&self->value__for__test);
  79. /* */
  80. this->clear ();
  81. /* log */
  82. fprintf (stderr, "word delete\n\n");
  83. }
  84. /* INFO
  85. * do: PRINT Word */
  86. void
  87. Word::print ()
  88. {
  89. /* print */
  90. std::cout << this->value << std::endl;
  91. }
  92. /* USE
  93. * L__LIB_WORD__CREATE THIS
  94. * L__LIB_WORD__DELETE THIS */
  95. /* INFO word__clear
  96. * do: Clear Word */
  97. void
  98. Word::clear ()
  99. {
  100. // symbols__clear (this->value);
  101. // symbols__copy (this->value, "this text is empty");
  102. // symbols__copy (this->value, "this text is empty");
  103. /* clear point previous */
  104. this->value = "";
  105. /* clear point previous */
  106. this->previous = NULL;
  107. /* clear point next */
  108. this->next = NULL;
  109. /* log */
  110. fprintf (stderr, "word clear\n");
  111. }
  112. /* INFO word__create
  113. * do: CREATE Word */
  114. Word::Word ()
  115. {
  116. /* log */
  117. fprintf (stderr, "\nword create\n");
  118. /* create new Word in Dinamic Memory */
  119. // Word *self = new Word;
  120. // self->value = malloc (sizeof (Symbols));
  121. /* init self Word */
  122. // word__init (self) or
  123. // word__zero (self) or
  124. this->clear ();
  125. }
  126. # endif /* L_LIB_WORD_U */