Back to index

texmacs  1.0.7.15
new_buffer.hpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : new_buffer.hpp
00004 * DESCRIPTION: File related information for buffers
00005 * COPYRIGHT  : (C) 1999-2012  Joris van der Hoeven
00006 *******************************************************************************
00007 * This software falls under the GNU general public license version 3 or later.
00008 * It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
00009 * in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
00010 ******************************************************************************/
00011 
00012 #ifndef NEW_BUFFER_H
00013 #define NEW_BUFFER_H
00014 #include "tree.hpp"
00015 #include "hashmap.hpp"
00016 #include "url.hpp"
00017 #include "timer.hpp"
00018 
00019 class new_buffer;
00020 class new_buffer_rep: public concrete_struct {
00021 public:
00022   url name;               // full name
00023   url extra;              // for special buffers, like help buffer
00024   string fm;              // buffer format
00025   string abbr;            // abbreviated name
00026   bool read_only;         // buffer is read only?
00027   bool secure;            // is the buffer secure?
00028   bool in_menu;           // should the buffer be listed in the menus?
00029   time_t last_visit;      // time that the buffer was visited last
00030 
00031   inline new_buffer_rep (url name2):
00032     name (name2), extra (url_none ()),
00033     fm ("texmacs"), abbr (as_string (tail (name))),
00034     read_only (false), secure (is_secure (name2)), in_menu (true),
00035     last_visit (texmacs_time ()) {}
00036 };
00037 
00038 class new_buffer;
00039 class new_buffer {
00040 CONCRETE(new_buffer);
00041   inline new_buffer (url name): rep (tm_new<new_buffer_rep> (name)) {}
00042 };
00043 //CONCRETE_CODE(new_buffer);
00044 
00045 inline new_buffer::new_buffer (const new_buffer& x):
00046   rep(x.rep) { INC_COUNT (this->rep); }
00047 inline new_buffer::~new_buffer () { DEC_COUNT (this->rep); }
00048 inline new_buffer_rep* new_buffer::operator -> () {
00049   return rep; }
00050 inline new_buffer& new_buffer::operator = (new_buffer x) {
00051   INC_COUNT (x.rep); DEC_COUNT (this->rep);
00052   this->rep=x.rep; return *this; }
00053 
00054 #endif // NEW_BUFFER_H