casa
$Rev:20696$
|
00001 //# NewFile: Do checks for a new (non-existent) file 00002 //# Copyright (C) 1996,1999,2002,2004 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# 00027 //# $Id: NewFile.h 20551 2009-03-25 00:11:33Z Malte.Marquarding $ 00028 00029 #ifndef TABLES_NEWFILE_H 00030 #define TABLES_NEWFILE_H 00031 00032 #include <casa/aips.h> 00033 #include <casa/BasicSL/String.h> 00034 00035 namespace casa { //# NAMESPACE CASA - BEGIN 00036 00037 // <summary> 00038 // Do checks for a new (non-existent) file. 00039 // </summary> 00040 00041 // <use visibility=export> 00042 00043 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 00044 // </reviewed> 00045 // 00046 // <etymology> 00047 // Use this if you want a New File. 00048 // </etymology> 00049 // 00050 // <synopsis> 00051 // NewFile is a class checking if a new file already exists. 00052 // If the file exists, then the user is asked via Choice::choice whether or not 00053 // he or she wants to delete the file before using it. 00054 // </synopsis> 00055 // 00056 // <example> 00057 // NewFile validFile; 00058 // String newFileName("bigone"), error; 00059 // Bool ok = validFile.valueOK(newFileName, error); 00060 // if (!ok) { 00061 // cout << error << endl; 00062 // } 00063 // </example> 00064 // 00065 // <motivation> 00066 // Output file names are fairly common parameters, this consolidates the error 00067 // checking and "remove if it already exists" logic. 00068 // </motivation> 00069 // 00070 // <todo asof="1996/12/10"> 00071 // <li> We should probably make sure that the file is writable 00072 // </todo> 00073 00074 class NewFile 00075 { 00076 public: 00077 // Currently the deleteIfExists argument has no affect 00078 NewFile(Bool deleteIfExists = True); 00079 00080 // Copy constructor (copy semantics) 00081 NewFile(const NewFile &other); 00082 00083 // Assignment (copy semantics) 00084 NewFile &operator=(const NewFile &other); 00085 00086 // Destructor 00087 ~NewFile(); 00088 00089 // Indicates whether the specified string is a valid new file, 00090 // invoking the choice GUI. If it returns False, an error 00091 // message is returned. 00092 Bool valueOK(const String &value, String &error) const; 00093 00094 private: 00095 Bool delete_p; 00096 }; 00097 00098 00099 00100 } //# NAMESPACE CASA - END 00101 00102 #endif