Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

/home/vlg/develop/gwavmerger/src/Config.h

Go to the documentation of this file.
00001 // -*- c++ -*-
00002 //------------------------------------------------------------------------------
00003 //                              Config.h
00004 //------------------------------------------------------------------------------
00005 // $Id: Config.h,v 1.6 2003/02/07 05:15:09 vlg Exp $
00006 //------------------------------------------------------------------------------
00007 //  Copyright (c) 2001-2003 by Vladislav Grinchenko
00008 //
00009 //  This program is free software; you can redistribute it and/or
00010 //  modify it under the terms of the GNU General Public License
00011 //  as published by the Free Software Foundation; either version
00012 //  2 of the License, or (at your option) any later version.
00013 //------------------------------------------------------------------------------
00014 // 01/12/2002 VLG  Created
00015 //------------------------------------------------------------------------------
00016 #ifndef CONFIG_H
00017 #define CONFIG_H
00018 
00019 #include <string>
00020 #include <deque>
00021 using std::deque;
00022 using std::string;
00023 
00024 class Config 
00025 {
00026 public:
00027     typedef deque<string> DHList; // document history list
00028     typedef DHList::iterator DHList_Iter;
00029     typedef DHList::const_iterator DHList_CIter;
00030 
00031 public:
00032     Config ();
00033     ~Config ();
00034 
00035     int load_project (const string& fname_);
00036     int save_project ();
00037 
00038     void save_config ();
00039     void load_config ();
00040 
00041     void dont_save_project () { m_dont_save_project = true; }
00042 
00043     // Accessors
00044     void set_proj_name  (const string& name_) { m_proj_name = name_; }
00045     void set_proj_path  (const string& path_) { m_path_name = path_; }
00046     void set_A_prefix   (const string& ap_)   { m_A_prefix = ap_;    }
00047     void set_B_prefix   (const string& bp_)   { m_B_prefix = bp_;    }
00048     void set_A_dir      (const string& ad_)   { m_A_dir = ad_;       }
00049     void set_B_dir      (const string& bd_)   { m_B_dir = bd_;       }
00050     void set_pre_delay  (const string& pd_)   { m_pre_delay = pd_;   }
00051     void set_post_delay (const string& pd_)   { m_post_delay = pd_;  }
00052     void set_jump_next_row (bool b_)          { m_jump_next_row =b_; }
00053 
00054     const string& get_proj_name () const      { return m_proj_name;  }
00055     const string& get_proj_path () const      { return m_path_name;  }
00056     const string& get_A_prefix () const       { return m_A_prefix;   }
00057     const string& get_B_prefix () const       { return m_B_prefix;   }
00058     const string& get_A_dir () const          { return m_A_dir;      }
00059     const string& get_B_dir () const          { return m_B_dir;      }
00060     const string& get_pre_delay () const      { return m_pre_delay;  }
00061     const string& get_post_delay () const     { return m_post_delay; }
00062     bool          get_jump_next_row () const  { return m_jump_next_row; }
00063 
00064     // Utilities to make various paths
00065     string make_pathname (const string& type_, const string& name_,
00066                           bool absolute_ = false) const;
00067     string make_abs_pathname (const string& type_, const string& name_) const;
00068     string make_rel_pathname (const string& type_, const string& name_) const;
00069     string make_pause_pathname (int type_, const string& name_) const;
00070 
00071     // History-related functions
00072     string add_document_history ();
00073     void   remove_document_history (const string& fullpath_);
00074 
00075     const DHList& get_document_history () const { return m_history; }
00076 
00077     // Object state dump
00078     void dump () const;
00079     void dump_document_history () const;
00080 
00081 private:
00082     Config (const Config&);     // copy constructor
00083     Config& operator= (const Config&); // copy assignment: cleanup & copy
00084 
00085 private:
00086     string m_proj_name;         // Project name
00087     string m_path_name;         // Path to configuration file
00088     bool   m_dont_save_project; // Don't save project file
00089 
00090     string m_A_prefix;          // A prefix
00091     string m_B_prefix;          // B prefix
00092     string m_A_dir;             // A dir
00093     string m_B_dir;             // B dir
00094     string m_pre_delay;         // Delay inserted before segment B
00095     string m_post_delay;        // Delay inserted after segment B
00096     
00097     bool   m_jump_next_row;
00098 
00099     DHList m_history;
00100 
00101 };
00102 
00103 //------------------------------------------------------------------------------
00104 // Inlines
00105 //------------------------------------------------------------------------------
00106 
00107 inline string 
00108 
00109 Config::make_abs_pathname (const string& type_, const string& name_) const
00110 {
00111     return make_pathname (type_, name_, true);
00112 }
00113 
00114 inline string 
00115 
00116 Config::make_rel_pathname (const string& type_, const string& name_) const
00117 {
00118     return make_pathname (type_, name_);
00119 }
00120 
00121     
00122 #endif /* CONFIG_H */

Generated on Tue Feb 11 23:05:19 2003 for gwavmerger by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002