Show cursor on exit
[utui.git] / doc.h
blob11e4c6151a8d4b75559490264d8be63a9a1c8aaf
1 // This file is part of the utui library, a terminal UI framework.
2 //
3 // Copyright (C) 2006 by Mike Sharov <msharov@users.sourceforge.net>
4 // This file is free software, distributed under the MIT License.
5 //
6 // doc.h
7 //
9 #ifndef DOC_H_7BBE3FAF41D4C26A3BB1D8E8391176E8
10 #define DOC_H_7BBE3FAF41D4C26A3BB1D8E8391176E8
12 #include "doccli.h"
14 /// \class CDocument doc.h doc.h
15 ///
16 /// Documents are the data storage side of the document-view architecture.
17 /// Any window can serve as a view to display the data it obtains by using
18 /// accessor functions of objects derived from CDocument through the pointer
19 /// sent to it in OnUpdate.
20 ///
21 class CDocument : public CDocumentClient {
22 public:
23 typedef const string& rcfname_t;
24 typedef CDocumentClient* pview_t;
25 public:
26 CDocument (void);
27 inline virtual ~CDocument (void) { }
28 void RegisterView (pview_t pView);
29 void UnregisterView (pview_t pView);
30 virtual void Open (rcfname_t filename);
31 virtual void Close (void);
32 inline rcfname_t Filename (void) const { return (m_Filename); }
33 inline virtual void read (istream&) { }
34 inline virtual void write (ostream&) const { }
35 inline virtual size_t stream_size (void) const { return (0); }
36 protected:
37 void UpdateAllViews (void);
38 private:
39 typedef vector<pview_t> vwvec_t;
40 private:
41 vwvec_t m_Views; ///< Registered views.
42 string m_Filename; ///< Name of the currently open file.
45 STD_STREAMABLE (CDocument)
47 #endif