00001 // Filename: cppFile.h 00002 // Created by: drose (11Nov99) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef CPPFILE_H 00020 #define CPPFILE_H 00021 00022 #include <dtoolbase.h> 00023 #include <filename.h> 00024 00025 /////////////////////////////////////////////////////////////////// 00026 // Class : CPPFile 00027 // Description : This defines a source file (typically a C++ header 00028 // file) that is parsed by the CPPParser. Each 00029 // declaration indicates the source file where it 00030 // appeared. 00031 //////////////////////////////////////////////////////////////////// 00032 class CPPFile { 00033 public: 00034 enum Source { 00035 S_local, // File resides in the current directory 00036 S_alternate, // File resides in some other directory 00037 S_system, // File resides in a system directory 00038 S_none, // File is internally generated 00039 }; 00040 00041 CPPFile(const Filename &filename = "", 00042 const Filename &filename_as_referenced = "", 00043 Source source = S_none); 00044 CPPFile(const CPPFile ©); 00045 void operator = (const CPPFile ©); 00046 ~CPPFile(); 00047 00048 bool is_c_or_i_file() const; 00049 static bool is_c_or_i_file(const Filename &filename); 00050 00051 bool is_c_file() const; 00052 static bool is_c_file(const Filename &filename); 00053 00054 void replace_nearer(const CPPFile &other); 00055 00056 bool operator < (const CPPFile &other) const; 00057 bool operator == (const CPPFile &other) const; 00058 bool operator != (const CPPFile &other) const; 00059 00060 const char *c_str() const; 00061 bool empty() const; 00062 00063 Filename _filename; 00064 Filename _filename_as_referenced; 00065 Source _source; 00066 }; 00067 00068 inline ostream &operator << (ostream &out, const CPPFile &file) { 00069 return out << file._filename; 00070 } 00071 00072 #endif 00073