// joycub V2 - an interpeter for the programming language Joy
// (c) 2004-2006 Sergey Zubkov 
// prototype.cc - prototype module to test out the new design considerations
static char RCSID[] ="$Id: int.cc,v 1.1 2006/02/27 18:50:34 cubbi Exp cubbi $";

#include <iostream>
#include <sstream>
#include "int.h"

// global object counters (for memory debugging)
int int_type_count = 0;

void JC_int::calc_key(void) {
	std::ostringstream tmp_string;
	tmp_string << content;
	_key=tmp_string.str();
}

JC_int::JC_int(void) {
	content=0;
	calc_key();
};

JC_int::JC_int(int i) {
	content=i;
	calc_key();
	int_type_count++;
};

JC_int::JC_int(const std::string& s) {
	content = atoi(s.c_str());
	calc_key();
	int_type_count++;
}

JC_int::JC_int(const JC_int& j) {
	int_type_count++;
	content = j.content;
	calc_key();
};

JC_int::~JC_int(void) {
	int_type_count--;
};

std::string JC_int::to_string(void) const {
	std::ostringstream s;
	s << content;
	return s.str();
}
