Lempek

List.h

May 24th, 2014
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.02 KB | None | 0 0
  1. /*
  2.  * List.h
  3.  *
  4.  */
  5.  
  6. #pragma once
  7. #include <iostream>
  8. #include <string>
  9. class List {
  10. private:
  11.     class Node {
  12.     public:
  13.         Node() : data(0), next(nullptr), previous(nullptr){}
  14.         Node(int data) : data(data), next(nullptr), previous(nullptr){}
  15.         Node(const Node& node) {}
  16.         ~Node();
  17.         int data;
  18.         Node* next;
  19.         Node* previous;
  20.     };
  21.     Node* head;
  22.     Node* tail;
  23.     int n; // Rozmiar listy
  24. public:
  25.     List() :
  26.         head(nullptr), tail(nullptr), n(0) {
  27.     }
  28.     List(const List& list) {}
  29.     virtual ~List();
  30.  
  31.     void push_front(int object);
  32.     void pop_front();
  33.     void push_back(int obiekt);
  34.     void pop_back();
  35.     void insert(int index, int object);
  36.     void erase(int index);
  37.     void swap(int index1, int index2);
  38.     int size();
  39.     int get_index_of(const int object);
  40.     Node& get_node_ref(int index);
  41.     Node* get_node_ptr(int index);
  42.     void save_to_file(std::string file_name);
  43.     void load_from_file(std::string file_name);
  44.  
  45.     // Operatory
  46.     //bool operator==(const List &L);
  47.     //List& operator=(const List &L);
  48.     int& operator[](int index);
  49. };
Advertisement
Add Comment
Please, Sign In to add comment