00001 // Copyright (C) 2001, Compaq Computer Corporation 00002 // 00003 // This file is part of Vesta. 00004 // 00005 // Vesta is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU Lesser General Public 00007 // License as published by the Free Software Foundation; either 00008 // version 2.1 of the License, or (at your option) any later version. 00009 // 00010 // Vesta is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 // Lesser General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public 00016 // License along with Vesta; if not, write to the Free Software 00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 00019 // File: Files.H 00020 // Last modified On Fri Sep 9 19:33:17 EDT 2005 by ken@xorian.net 00021 // modified On Mon May 2 13:15:59 EDT 2005 by irina.furman@intel.com 00022 // modified On Thu Jan 4 15:41:50 PST 2001 by mann 00023 // modified On Tue Nov 4 15:16:42 PST 1997 by yuanyu 00024 // modified On Tue Mar 5 12:10:41 PST 1996 by levin 00025 // modified On Fri Jan 26 17:45:53 PST 1996 by horning 00026 00027 #ifndef Files_H 00028 #define Files_H 00029 00030 #include "EvalBasics.H" 00031 #include "Location.H" 00032 #include <VestaSource.H> 00033 00034 // If s does not have a suffix, append suff: 00035 Text setSuffix(const Text& s, const Text& suff); 00036 00037 // Test whether path starts with slash or backslash: 00038 bool IsAbsolutePath(const Text& path); 00039 00040 // Put path's final arc in name, the rest in prefix: 00041 void SplitPath(const Text& path, Text& prefix, Text& name); 00042 00043 // Check for Delimiter; not platform-specific 00044 bool IsDelimiter(const char c); 00045 00046 // Returns the main model name, given a possibly partial name or 00047 // directory name. Will append ".ves" if needed, or the given 00048 // default filename (e.g., ".main.ves") if needed. 00049 Text MainModel(const Text& filename, const Text& defaultmain); 00050 00051 // Determine if a given path names a directory 00052 bool IsDirectory(VestaSource *mRoot, Text& path, VestaSource*& vSource, 00053 VestaSource::errorCode& vSourceErr); 00054 00055 // Open a file (either in the repository or in NFS), and record information 00056 // to allow subsequent relative file names to be interpreted correctly. 00057 bool OpenSource(VestaSource *mRoot, // directory of the model 00058 const Text& fname, // file name 00059 SrcLoc *loc, // where this model is included 00060 std::fstream*& iFile, // (out) resulting stream 00061 VestaSource*& newRoot, // (out) directory of the model file 00062 ShortId& shortId, // (out) shortid, 00063 VestaSource*& vSource); // (out) directory of the model file 00064 00065 // Replicate in missing objects. The function trys to find a real copy 00066 // of the object in other repositories which might be defined in 00067 // [UserInterface]DefaultHints and replicate it in. 00068 // Returns true if replication suceeded and a pointer to a replicated object. 00069 bool ReplicateMissing(VestaSource* root, const Text& name, 00070 /*OUT*/VestaSource*& vSource); 00071 00072 #endif // Files_H