๐Ÿ’Ž๋ชฉํ‘œ

โญ๊ธฐ์กด ์ฝ”๋“œ

Document

View

โญํŒŒ์ผ ์ €์žฅ ๋ฐ ๋กœ๋“œ

image.png

void CG24W03MFCDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: ์—ฌ๊ธฐ์— ์ €์žฅ ์ฝ”๋“œ๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.
		ar << Point;
	}
	else
	{
		// TODO: ์—ฌ๊ธฐ์— ๋กœ๋”ฉ ์ฝ”๋“œ๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.
		ar >> Point;
	}
}

<aside> ๐Ÿฐ

์ฃผ์˜

CArchive์—์„œ operator overloading ๋˜์–ด ์žˆ์œผ๋ฏ€๋กœ ar๊ณผ Point์˜ ์ˆœ์„œ๋ฅผ ๋ฐ”๊พธ๋ฉด ์•ˆ๋จ

Point >> ar; // ์—๋Ÿฌ Point << ar; // ์—๋Ÿฌ

image.png

</aside>

image.png

โญ์ €์žฅํ•  ํ•„์š”๊ฐ€ ์žˆ๋Š”์ง€ ๊ด€๋ฆฌ

SetModifiedFlag() ํ•จ์ˆ˜

class CG24W03MFCDoc : public CDocument
{
protected:
	CPoint Point = CPoint(-100, -100);
public:
	CPoint GetPoint() { return Point; }
	void SetPoint(CPoint p) { 
		Point = p; 
		SetModifiedFlag();
	}