myString.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #pragma once
  2. #include <iostream>
  3. #include "Counter.h"
  4. class Counter;
  5. class MyString
  6. {
  7. Counter* m_pCounter;
  8. public:
  9. explicit MyString(const char* Str = " ");// êîíñòðóêòîð, explicit çàïðåùàåò êîìïèëÿòîðó ïðèâîäèòü òèï íåÿâíî
  10. MyString(const MyString&); //êîíñòðóêòîð êîïèðîâàíèÿ
  11. MyString(MyString&&); //ïåðåìåùàþùèé êîíñòðóêòîð êîïèðîâàíèÿ
  12. ~MyString();//äåñòðóêòîð
  13. MyString& operator= (const MyString&);//îïåðàòîð ïðèñâàèâàíèÿ ïðèíèìàþùèé êëàññ
  14. MyString& operator= (MyString&&);//ïåðåìåùàþùèé îïåðàòîð ïðèñâàèâàíèÿ
  15. const char* GetString() const; //ìåòîä, êîòîðûé îáåñïå÷èò äîñòóï ê õðàíÿùåéñÿ ñòðîêå
  16. void SetNewString(const char*); //ìåòîä, êîòîðûé áóäåò çàìåíÿòü ñòðîêó íà íîâóþ
  17. //ðàñïå÷àòàòü âñå ñòðîêè
  18. static void PrintAllStrings();
  19. //âî âñåõ îáúåêòàõ MyString èçìåíèòü ðåãèñòð
  20. static void ChangeRegister();
  21. //âûâåñòè ñòðîêè ïî àëôàâèòó
  22. static void PrintSortedStrings();
  23. friend std::ostream& operator<<(std::ostream& , const MyString&);
  24. };
  25. std::ostream& operator<<(std::ostream&, const MyString&);