adonthell-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Adonthell-commits] CVS: adonthell/src/tools/dlgedit cfg_data.cc,NONE,1.


From: Kai Sterker <address@hidden>
Subject: [Adonthell-commits] CVS: adonthell/src/tools/dlgedit cfg_data.cc,NONE,1.1 cfg_data.h,NONE,1.1 cfg_project.cc,NONE,1.1 cfg_project.h,NONE,1.1 Makefile.am,1.48,1.49 cfg_io.cc,1.1,1.2 cfg_io.h,1.1,1.2
Date: Thu, 17 Oct 2002 16:43:28 -0400

Update of /cvsroot/adonthell/adonthell/src/tools/dlgedit
In directory subversions:/tmp/cvs-serv3035

Modified Files:
        Makefile.am cfg_io.cc cfg_io.h 
Added Files:
        cfg_data.cc cfg_data.h cfg_project.cc cfg_project.h 
Log Message:
ADDED loading/saving of dlgedit config file


***** Error reading new file: [Errno 2] No such file or directory: 'cfg_data.cc'
***** Error reading new file: [Errno 2] No such file or directory: 'cfg_data.h'
***** Error reading new file: [Errno 2] No such file or directory: 
'cfg_project.cc'
***** Error reading new file: [Errno 2] No such file or directory: 
'cfg_project.h'
Index: Makefile.am
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/Makefile.am,v
retrieving revision 1.48
retrieving revision 1.49
diff -C2 -r1.48 -r1.49
*** Makefile.am 17 Oct 2002 10:08:42 -0000      1.48
--- Makefile.am 17 Oct 2002 20:42:59 -0000      1.49
***************
*** 10,14 ****
--- 10,16 ----
  
  dlgedit_SOURCES = \
+     cfg_data.cc \
      cfg_io.cc \
+     cfg_project.cc \
      dlg_arrow.cc \
      dlg_circle.cc \
***************
*** 42,46 ****
--- 44,50 ----
      lex.loadlg.cc \
      main.cc \
+     cfg_data.h \
      cfg_io.h \
+     cfg_project.h \
      dlg_arrow.h \
      dlg_circle.h \

Index: cfg_io.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/cfg_io.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** cfg_io.cc   17 Oct 2002 10:08:42 -0000      1.1
--- cfg_io.cc   17 Oct 2002 20:42:59 -0000      1.2
***************
*** 22,31 ****
  #include <stdio.h>
  #include "cfg_io.h"
  
! /**
!  * The config file opened by the lexical scanner
!  */
  extern FILE* loadcfgin;
  
  // ctor; load config
  CfgIO::CfgIO ()
--- 22,32 ----
  #include <stdio.h>
  #include "cfg_io.h"
+ #include "dlg_types.h"
  
! // The config file opened by the lexical scanner
  extern FILE* loadcfgin;
  
+ extern int parse_cfgfile (std::string&, int&);
+ 
  // ctor; load config
  CfgIO::CfgIO ()
***************
*** 55,59 ****
--- 56,85 ----
  void CfgIO::load ()
  {
+     int token = 1, n;
+     std::string s;
      
+     // as long as reading something from file ...
+     while (token)
+     {
+         // get next token
+         switch (token = parse_cfgfile (s, n))
+         {
+             case LOAD_FILE:
+             {
+                 if (parse_cfgfile (s, n) == LOAD_STR) Data.addFile (s);       
        
+                 break;
+             }
+             
+             case LOAD_PROJECT:
+             {
+                 if (parse_cfgfile (s, n) == LOAD_STR) Data.addProject (s);
+                 break;
+             }
+             
+             default: break;
+         }
+     }
+     
+     return;
  }
  
***************
*** 61,64 ****
  void CfgIO::save ()
  {
      
! }
\ No newline at end of file
--- 87,100 ----
  void CfgIO::save ()
  {
+     // open file for writing
+     std::ofstream out (Dlgeditrc.c_str ());
+     
+     // opening failed for some reasons    
+     if (!out) return;
      
!     // write header
!     out << "# Adonthell Dialogue Editor configuration file\n" << endl;
!             
!     // save data
!     Data.save (out);
! } 

Index: cfg_io.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/cfg_io.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** cfg_io.h    17 Oct 2002 10:08:42 -0000      1.1
--- cfg_io.h    17 Oct 2002 20:42:59 -0000      1.2
***************
*** 23,27 ****
  #define CFG_IO_H
  
! #include <string>
  
  /**
--- 23,27 ----
  #define CFG_IO_H
  
! #include "cfg_data.h"
  
  /**
***************
*** 59,65 ****
      void save ();
  
!     // CfgData     Data;           // Global configuration data
      std::string Dlgeditrc;      // Path to configuration file  
  };
  
! #endif // CFG_IO_H
\ No newline at end of file
--- 59,65 ----
      void save ();
  
!     CfgData     Data;           // Global configuration data
      std::string Dlgeditrc;      // Path to configuration file  
  };
  
! #endif // CFG_IO_H





reply via email to

[Prev in Thread] Current Thread [Next in Thread]