Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > 0102b942207b9d1f394a9a1ca1a811b6 > files > 76

bakery-devel-2.6.3-4.fc14.x86_64.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>bakery: Document.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.2-20100208 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
<h1>Document.h</h1><a href="Document_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * Copyright 2000 Murray Cumming</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> * This library is free software; you can redistribute it and/or</span>
<a name="l00005"></a>00005 <span class="comment"> * modify it under the terms of the GNU Library General Public</span>
<a name="l00006"></a>00006 <span class="comment"> * License as published by the Free Software Foundation; either</span>
<a name="l00007"></a>00007 <span class="comment"> * version 2 of the License, or (at your option) any later version.</span>
<a name="l00008"></a>00008 <span class="comment"> *</span>
<a name="l00009"></a>00009 <span class="comment"> * This library is distributed in the hope that it will be useful,</span>
<a name="l00010"></a>00010 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00011"></a>00011 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU</span>
<a name="l00012"></a>00012 <span class="comment"> * Library General Public License for more details.</span>
<a name="l00013"></a>00013 <span class="comment"> *</span>
<a name="l00014"></a>00014 <span class="comment"> * You should have received a copy of the GNU Library General Public</span>
<a name="l00015"></a>00015 <span class="comment"> * License along with this library; if not, write to the Free</span>
<a name="l00016"></a>00016 <span class="comment"> * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.</span>
<a name="l00017"></a>00017 <span class="comment"> */</span>
<a name="l00018"></a>00018 
<a name="l00019"></a>00019 <span class="preprocessor">#ifndef BAKERY_DOCUMENT_H</span>
<a name="l00020"></a>00020 <span class="preprocessor"></span><span class="preprocessor">#define BAKERY_DOCUMENT_H</span>
<a name="l00021"></a>00021 <span class="preprocessor"></span>
<a name="l00022"></a>00022 <span class="preprocessor">#include &quot;<a class="code" href="View_8h.html">bakery/View/View.h</a>&quot;</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &lt;glibmm.h&gt;</span>
<a name="l00024"></a>00024 
<a name="l00025"></a>00025 <span class="preprocessor">#include &lt;iostream&gt;</span>
<a name="l00026"></a>00026 
<a name="l00027"></a>00027 <span class="keyword">namespace </span>Bakery
<a name="l00028"></a>00028 {
<a name="l00029"></a>00029 
<a name="l00034"></a><a class="code" href="classBakery_1_1Document.html">00034</a> <span class="keyword">class </span><a class="code" href="classBakery_1_1Document.html" title="The Document is like the &amp;#39;Model&amp;#39; in the Model-View-Controller framework.">Document</a>
<a name="l00035"></a>00035 {
<a name="l00036"></a>00036 <span class="keyword">public</span>: 
<a name="l00037"></a>00037   <a class="code" href="classBakery_1_1Document.html#a7c8ee3e39c986f730a57c2291492e3e6">Document</a>();
<a name="l00038"></a>00038   <span class="keyword">virtual</span> <a class="code" href="classBakery_1_1Document.html#ab42446d2454b7803fc694ac08c7dd440">~Document</a>();
<a name="l00039"></a>00039 
<a name="l00040"></a>00040   <span class="comment">/* Saves the data to disk.</span>
<a name="l00041"></a>00041 <span class="comment">   * Asks the View to update this document before saving to disk,</span>
<a name="l00042"></a>00042 <span class="comment">   * but you should probably ensure that the document is updated more regularly than this,</span>
<a name="l00043"></a>00043 <span class="comment">   * so that different parts of the GUI are synchronized.</span>
<a name="l00044"></a>00044 <span class="comment">   * Only saves if the document has been modified.</span>
<a name="l00045"></a>00045 <span class="comment">   * bool indicates success.</span>
<a name="l00046"></a>00046 <span class="comment">   */</span>
<a name="l00047"></a>00047   <span class="keywordtype">bool</span> <a class="code" href="classBakery_1_1Document.html#a7337d846a8ba3f9631087389afc328cd">save</a>();
<a name="l00048"></a>00048 
<a name="l00049"></a>00049   <span class="comment">/* Loads data from disk, using the URI (set with set_file_uri()) then asks the View to update itself.</span>
<a name="l00050"></a>00050 <span class="comment">   * bool indicates success.</span>
<a name="l00051"></a>00051 <span class="comment">   */</span>
<a name="l00052"></a>00052   <span class="keywordtype">bool</span> <a class="code" href="classBakery_1_1Document.html#aa533fed6a13ad3a5de8492c1224f0164">load</a>();
<a name="l00053"></a>00053 
<a name="l00054"></a>00054   <span class="comment">//This can&#39;t be virtual because that would break ABI.</span>
<a name="l00055"></a>00055   <span class="comment">//Hopefully it doesn&#39;t need to be.</span>
<a name="l00056"></a>00056   <span class="comment">/* Loads data from disk, using the URI (set with set_file_uri()) then asks the View to update itself.</span>
<a name="l00057"></a>00057 <span class="comment">   * bool indicates success.</span>
<a name="l00058"></a>00058 <span class="comment">   */</span>
<a name="l00059"></a>00059   <span class="keywordtype">bool</span> <a class="code" href="classBakery_1_1Document.html#ace3fc10ef2d6cfec5de95e066b5c78f2">load_from_data</a>(<span class="keyword">const</span> guchar* data, std::size_t length);
<a name="l00060"></a>00060 
<a name="l00061"></a>00061 
<a name="l00062"></a>00062   <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classBakery_1_1Document.html#adcc7f60db54e784b43ecf38e2ab4d102">get_modified</a>() <span class="keyword">const</span>;
<a name="l00063"></a>00063   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBakery_1_1Document.html#a8fc72b3744005d61bd2e378478792e28">set_modified</a>(<span class="keywordtype">bool</span> bVal = <span class="keyword">true</span>);
<a name="l00064"></a>00064 
<a name="l00066"></a>00066   <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classBakery_1_1Document.html#a0662fd16f864461831e53555a2b7a1bf" title="Whether this just a default document.">get_is_new</a>() <span class="keyword">const</span>;
<a name="l00068"></a>00068   <span class="keywordtype">void</span> <a class="code" href="classBakery_1_1Document.html#a86bb01bf6427bdc21badfbfd886d6753" title="Called by App_WithDoc::init_create_document().">set_is_new</a>(<span class="keywordtype">bool</span> bVal);
<a name="l00069"></a>00069 
<a name="l00070"></a>00070   <span class="keyword">virtual</span> Glib::ustring <a class="code" href="classBakery_1_1Document.html#aa3bbc777bd34e17715382423c39cddd9">get_contents</a>() <span class="keyword">const</span>;
<a name="l00071"></a>00071   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBakery_1_1Document.html#a285690dac6be18c16068fde77a92fdfa">set_contents</a>(<span class="keyword">const</span> Glib::ustring&amp; strVal);
<a name="l00072"></a>00072 
<a name="l00073"></a>00073   <span class="keyword">virtual</span> Glib::ustring <a class="code" href="classBakery_1_1Document.html#a1c2569feb7008a7f3c1264d1a45f1400">get_file_uri_with_extension</a>(<span class="keyword">const</span> Glib::ustring&amp; uri);
<a name="l00074"></a>00074 
<a name="l00075"></a>00075   <span class="keyword">virtual</span> Glib::ustring <a class="code" href="classBakery_1_1Document.html#ab0537575a45eaa05a7b941b9950b26a9">get_file_uri</a>() <span class="keyword">const</span>;
<a name="l00076"></a>00076   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBakery_1_1Document.html#ad3ab690a2676c6e5ec487c94c28104e6">set_file_uri</a>(<span class="keyword">const</span> Glib::ustring&amp; file_uri, <span class="keywordtype">bool</span> bEnforceFileExtension = <span class="keyword">false</span>);
<a name="l00077"></a>00077 
<a name="l00079"></a>00079   <span class="keyword">virtual</span> Glib::ustring <a class="code" href="classBakery_1_1Document.html#a58b71b915756c7f5f5338d2e5ad2a3d6" title="Gets filename part of file_uri, or &amp;#39;untitled&amp;#39;.">get_name</a>() <span class="keyword">const</span>;
<a name="l00080"></a>00080   <span class="keyword">static</span> Glib::ustring <a class="code" href="classBakery_1_1Document.html#afe67976046a8d8647c681b639326abb2">util_file_uri_get_name</a>(<span class="keyword">const</span> Glib::ustring&amp; file_uri, <span class="keyword">const</span> Glib::ustring&amp; file_extension);
<a name="l00081"></a>00081 
<a name="l00082"></a>00082   <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classBakery_1_1Document.html#acc2fe6d1dd3b67276537d9d3517a85c7">get_read_only</a>() <span class="keyword">const</span>;
<a name="l00083"></a>00083   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBakery_1_1Document.html#a84378204e1397e3a7b06a5eba4100c55">set_read_only</a>(<span class="keywordtype">bool</span> bVal);
<a name="l00084"></a>00084 
<a name="l00086"></a>00086   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBakery_1_1Document.html#ad030b761012d9e7a82071dc097f0b462" title="If you don&amp;#39;t want to use a View, then don&amp;#39;t use set_view().">set_view</a>(<a class="code" href="classBakery_1_1ViewBase.html" title="This is a base class for View.">ViewBase</a>* pView);
<a name="l00087"></a>00087   <span class="keyword">virtual</span> <a class="code" href="classBakery_1_1ViewBase.html" title="This is a base class for View.">ViewBase</a>* <a class="code" href="classBakery_1_1Document.html#a61c6e857b9305e433f5206ecc30b1b06">get_view</a>();
<a name="l00088"></a>00088 
<a name="l00089"></a>00089   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBakery_1_1Document.html#a771de7542989245fc6673ae29ec9a3d4">set_file_extension</a>(<span class="keyword">const</span> Glib::ustring&amp; strVal);
<a name="l00090"></a>00090   <span class="keyword">virtual</span> Glib::ustring <a class="code" href="classBakery_1_1Document.html#a79f35deb0b982e17ff19ed6efeeddab3">get_file_extension</a>() <span class="keyword">const</span>;
<a name="l00091"></a>00091 
<a name="l00092"></a>00092   <span class="comment">//Signals</span>
<a name="l00095"></a><a class="code" href="classBakery_1_1Document.html#a7a7f15c6db7cb0921386c4fb63066e93">00095</a> <span class="comment"></span>  <span class="keyword">typedef</span> sigc::signal&lt;void, bool&gt; <a class="code" href="classBakery_1_1Document.html#a7a7f15c6db7cb0921386c4fb63066e93" title="For instance, void on_document_modified(bool modified);.">type_signal_modified</a>;
<a name="l00096"></a>00096 
<a name="l00100"></a>00100   <a class="code" href="classBakery_1_1Document.html#a7a7f15c6db7cb0921386c4fb63066e93" title="For instance, void on_document_modified(bool modified);.">type_signal_modified</a>&amp; <a class="code" href="classBakery_1_1Document.html#a921e0104ba71fd3e5d844fd0a86986fa" title="This signal is emitted when the document has been modified.">signal_modified</a>();
<a name="l00101"></a>00101 
<a name="l00102"></a><a class="code" href="classBakery_1_1Document.html#ad8d08d5cecd049ab1516dcb13d4eabaa">00102</a>   <span class="keyword">typedef</span> sigc::signal&lt;void&gt; <a class="code" href="classBakery_1_1Document.html#ad8d08d5cecd049ab1516dcb13d4eabaa">type_signal_forget</a>;
<a name="l00103"></a>00103 
<a name="l00107"></a>00107   <a class="code" href="classBakery_1_1Document.html#ad8d08d5cecd049ab1516dcb13d4eabaa">type_signal_forget</a>&amp; <a class="code" href="classBakery_1_1Document.html#ab49fc75dcd3f0838983bdc0b8641ca1b" title="This signal is emitted when the view should forget the document.">signal_forget</a>();
<a name="l00108"></a>00108 
<a name="l00110"></a>00110 
<a name="l00111"></a>00111 <span class="keyword">protected</span>:
<a name="l00115"></a>00115   <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classBakery_1_1Document.html#ac8607704505a4c571aca619c47e5e8c1" title="Allow app to update icons/title bar.">load_after</a>();
<a name="l00116"></a>00116 
<a name="l00120"></a>00120   <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classBakery_1_1Document.html#a29168b2c65715c5d2c331137296b99d2" title="overrideable.">save_before</a>();
<a name="l00121"></a>00121 
<a name="l00122"></a>00122   <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classBakery_1_1Document.html#aa78ec88a6a27d30ce1b0ff86861742c9">read_from_disk</a>();
<a name="l00123"></a>00123   <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classBakery_1_1Document.html#af2ef2bdf94ebe4fc198d5bbdfd9c37fd">write_to_disk</a>();
<a name="l00124"></a>00124 
<a name="l00125"></a><a class="code" href="classBakery_1_1Document.html#abe7a83f06449f2fbabbf73b4e881ba98">00125</a>   Glib::ustring <a class="code" href="classBakery_1_1Document.html#abe7a83f06449f2fbabbf73b4e881ba98">m_strContents</a>;
<a name="l00126"></a><a class="code" href="classBakery_1_1Document.html#ad87618dd347c51d4849441e47bc6c881">00126</a>   Glib::ustring <a class="code" href="classBakery_1_1Document.html#ad87618dd347c51d4849441e47bc6c881">m_file_uri</a>;
<a name="l00127"></a><a class="code" href="classBakery_1_1Document.html#a63acfbd446a6e7c2160fdff8a05f4d11">00127</a>   Glib::ustring <a class="code" href="classBakery_1_1Document.html#a63acfbd446a6e7c2160fdff8a05f4d11">m_file_extension</a>;
<a name="l00128"></a>00128 
<a name="l00129"></a><a class="code" href="classBakery_1_1Document.html#af28aca202004c4246dc53aa4fa9326ec">00129</a>   <a class="code" href="classBakery_1_1ViewBase.html" title="This is a base class for View.">ViewBase</a>* <a class="code" href="classBakery_1_1Document.html#af28aca202004c4246dc53aa4fa9326ec">m_pView</a>;
<a name="l00130"></a>00130 
<a name="l00131"></a><a class="code" href="classBakery_1_1Document.html#a474174ef4b154310900bdf66623ce8e4">00131</a>   <a class="code" href="classBakery_1_1Document.html#a7a7f15c6db7cb0921386c4fb63066e93" title="For instance, void on_document_modified(bool modified);.">type_signal_modified</a> <a class="code" href="classBakery_1_1Document.html#a474174ef4b154310900bdf66623ce8e4">signal_modified_</a>;
<a name="l00132"></a><a class="code" href="classBakery_1_1Document.html#aba481cfda27ab0a49c856dc112aa3760">00132</a>   <a class="code" href="classBakery_1_1Document.html#ad8d08d5cecd049ab1516dcb13d4eabaa">type_signal_forget</a> <a class="code" href="classBakery_1_1Document.html#aba481cfda27ab0a49c856dc112aa3760">signal_forget_</a>;
<a name="l00133"></a>00133   
<a name="l00134"></a><a class="code" href="classBakery_1_1Document.html#a1b074335c4f6349d171114487f16cbac">00134</a>   <span class="keywordtype">bool</span> <a class="code" href="classBakery_1_1Document.html#a1b074335c4f6349d171114487f16cbac">m_bModified</a>;
<a name="l00135"></a><a class="code" href="classBakery_1_1Document.html#a57c705564f5f051878563bd1cc4710f9">00135</a>   <span class="keywordtype">bool</span> <a class="code" href="classBakery_1_1Document.html#a57c705564f5f051878563bd1cc4710f9">m_bIsNew</a>; <span class="comment">//see get_is_new().</span>
<a name="l00136"></a><a class="code" href="classBakery_1_1Document.html#a3ee81913d52df4a2c05df97b837dac03">00136</a>   <span class="keywordtype">bool</span> <a class="code" href="classBakery_1_1Document.html#a3ee81913d52df4a2c05df97b837dac03">m_bReadOnly</a>;
<a name="l00137"></a>00137 };
<a name="l00138"></a>00138 
<a name="l00139"></a>00139 } <span class="comment">//namespace</span>
<a name="l00140"></a>00140 
<a name="l00141"></a>00141 <span class="preprocessor">#endif //GNOME_APPWITHDOCS_DOCUMENT_H</span>
</pre></div></div>
<hr class="footer"/><address style="text-align: right;"><small>Generated by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2-20100208 </small></address>
</body>
</html>