/*
 * Copyright (c) 2008
 * Evan Teran
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose and without fee is hereby granted, provided
 * that the above copyright notice appears in all copies and that both the
 * copyright notice and this permission notice appear in supporting
 * documentation, and that the same name not be used in advertising or
 * publicity pertaining to distribution of the software without specific,
 * written prior permission. We make no representations about the
 * suitability this software for any purpose. It is provided "as is"
 * without express or implied warranty.
 */

#include <iostream>
#include "Property.h"


class TestClass {
public:
	// make sure to initialize the properties with pointers to the object
	// which owns the property
	TestClass() : m_Prop1(0), m_Prop3(0.5), prop1(this), prop2(this), prop3(this) {
	}

private:
	int getProp1() const {
		return m_Prop1;
	}
	
	void setProp1(int value) {
		m_Prop1 = value;
	}
	
	int getProp2() const {
		return 1234;
	}
	
	void setProp3(double value) {
		m_Prop3 = value;
	}
	
	int m_Prop1;
	double m_Prop3;
	
public:
	PropertyRW<int, TestClass, &TestClass::getProp1, &TestClass::setProp1> prop1;
	PropertyRO<int, TestClass, &TestClass::getProp2> prop2;
	PropertyWO<double, TestClass, &TestClass::setProp3> prop3;
};


int main() {
	unsigned int a;
	TestClass t;
	t.prop1 = 10;
	a = t.prop1;
	t.prop3 = 5;
	a = t.prop2;
	std::cout << a << std::endl;
	return 0;
}
