includeEntry.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "includeEntry.H"
00028 #include "dictionary.H"
00029 #include "IFstream.H"
00030 #include "addToMemberFunctionSelectionTable.H"
00031
00032
00033
00034 const Foam::word Foam::functionEntries::includeEntry::typeName
00035 (
00036 Foam::functionEntries::includeEntry::typeName_()
00037 );
00038
00039
00040
00041 int Foam::functionEntries::includeEntry::debug(0);
00042
00043 namespace Foam
00044 {
00045 namespace functionEntries
00046 {
00047 addToMemberFunctionSelectionTable
00048 (
00049 functionEntry,
00050 includeEntry,
00051 execute,
00052 dictionaryIstream
00053 );
00054
00055 addToMemberFunctionSelectionTable
00056 (
00057 functionEntry,
00058 includeEntry,
00059 execute,
00060 primitiveEntryIstream
00061 );
00062 }
00063 }
00064
00065
00066
00067 Foam::fileName Foam::functionEntries::includeEntry::includeFileName
00068 (
00069 Istream& is
00070 )
00071 {
00072 fileName fName(is);
00073 fName.expand();
00074
00075
00076 if (fName.size() && fName[0] != '/')
00077 {
00078 fName = fileName(is.name()).path()/fName;
00079 }
00080
00081 return fName;
00082 }
00083
00084
00085
00086
00087 bool Foam::functionEntries::includeEntry::execute
00088 (
00089 dictionary& parentDict,
00090 Istream& is
00091 )
00092 {
00093 IFstream ifs(includeFileName(is));
00094
00095 if (ifs)
00096 {
00097 parentDict.read(ifs);
00098 return true;
00099 }
00100 else
00101 {
00102 FatalIOErrorIn
00103 (
00104 "functionEntries::includeEntry::includeEntry"
00105 "(dictionary& parentDict, Istream&)",
00106 is
00107 ) << "Cannot open include file " << ifs.name()
00108 << " while reading dictionary " << parentDict.name()
00109 << exit(FatalIOError);
00110
00111 return false;
00112 }
00113 }
00114
00115
00116 bool Foam::functionEntries::includeEntry::execute
00117 (
00118 const dictionary& parentDict,
00119 primitiveEntry& entry,
00120 Istream& is
00121 )
00122 {
00123 IFstream ifs(includeFileName(is));
00124
00125 if (ifs)
00126 {
00127 entry.read(parentDict, ifs);
00128 return true;
00129 }
00130 else
00131 {
00132 FatalIOErrorIn
00133 (
00134 "functionEntries::includeEntry::includeEntry"
00135 "(dictionary& parentDict, primitiveEntry&, Istream&)",
00136 is
00137 ) << "Cannot open include file " << ifs.name()
00138 << " while reading dictionary " << parentDict.name()
00139 << exit(FatalIOError);
00140
00141 return false;
00142 }
00143 }
00144
00145
Copyright © 2000-2009 OpenCFD Ltd