#include "listdata.h"

//Implements class ListData for list node with information
//field with type char[4].

ListData::ListData()
//Default constructor.
{
  strcpy(Info, "   ");
}

ListData::~ListData()
//Default destructor.
{
}

void ListData::Init(InfoType Item)
//Initializes instance of object ListData.
//Pre : Item is defined.
//Post: Info set to value contained in Item.
{
  strcpy(Info, Item);
}

void ListData::ReadInfo()
//Prompts user to enter values to initialize ListData instance.
//Pre : Object initialized.
//Post: Info contains input string.
{
  cin >> Info;
}

void ListData::Display()
//Displays contents of ListData data members.
//Pre : Object initialized.
//Post: Contents of Info displayed.
{
  cout << Info << "\n";
}

char* ListData::GetInfo()
//Returns value of data member Info.
{
  return(Info);
}

int ListData::IsEqual(ListData Item)
//Tests data member Info and ListData.Info for equality.
//Pre : Object initialized and Item defined.
//Post: Returns True is Info == Item.Info;
//      otherwise returns False.
{
  int Equal;
  char *Data;

  Data = Item.GetInfo();
  //strncmp returns 0 if strings are equal
  if (strncmp(Data, Info, MaxSize) == 0)
    Equal = True;
  else
    Equal = False;
  return(Equal);
}

int ListData::LessThan (ListData Item)
//Stub for method LessThan.
{
  return(Info < Item.Info);
}
