00001 #ifndef ctxtioobj_H
00002 #define ctxtioobj_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "namedobj.h"
00017 #include "multiid.h"
00018 #include "enums.h"
00019 #include "ioobj.h"
00020 #include "iopar.h"
00021 class IOPar;
00022 class TranslatorGroup;
00023
00026 mClass IOObjSelConstraints
00027 {
00028 public:
00029
00030 IOObjSelConstraints();
00031 IOObjSelConstraints(const IOObjSelConstraints&);
00032 ~IOObjSelConstraints();
00033 IOObjSelConstraints& operator =(const IOObjSelConstraints&);
00034
00035 IOPar& require_;
00036 IOPar& dontallow_;
00037
00038 BufferString allowtransls_;
00039 bool allownonreaddefault_;
00040
00041 bool isGood(const IOObj&) const;
00042 void clear();
00043 };
00044
00045
00056 mClass IOObjContext : public NamedObject
00057 {
00058 public:
00059
00060 enum StdSelType { Seis=0, Surf, Loc, Feat, WllInf, NLA, Misc, Attr, Mdl,
00061 None };
00062 DeclareEnumUtils(StdSelType)
00063
00064 IOObjContext(const TranslatorGroup*,
00065 const char* prefname=0);
00066 IOObjContext(const IOObjContext&);
00067 IOObjContext& operator =(const IOObjContext&);
00068
00070 StdSelType stdseltype;
00071 const TranslatorGroup* trgroup;
00072 int newonlevel;
00073 bool multi;
00074 bool maychdir;
00075
00077 bool forread;
00078 MultiID selkey;
00079 bool maydooper;
00080 BufferString deftransl;
00081 IOObjSelConstraints toselect;
00082
00083 bool validIOObj(const IOObj&) const;
00084
00085 struct StdDirData
00086 {
00087 const char* id;
00088 const char* dirnm;
00089 const char* desc;
00090 };
00091
00092 static int totalNrStdDirs();
00093 static const StdDirData* getStdDirData(StdSelType);
00094 static BufferString getDataDirName(StdSelType);
00096
00097 inline bool hasStdSelKey() const { return stdseltype != None; }
00098 MultiID getSelKey() const;
00099 void fillTrGroup();
00102 };
00103
00104
00113 mClass CtxtIOObj : public NamedObject
00114 {
00115 public:
00116 CtxtIOObj( const IOObjContext& ct, IOObj* o=0 )
00117 : NamedObject(""), ctxt(ct), ioobj(o), iopar(0)
00118 { setLinked(&ctxt); }
00119 CtxtIOObj( const CtxtIOObj& ct )
00120 : NamedObject(""), ctxt(ct.ctxt)
00121 , ioobj(ct.ioobj?ct.ioobj->clone():0)
00122 , iopar(ct.iopar?new IOPar(*ct.iopar):0)
00123 { setLinked(&ctxt); }
00124 void destroyAll();
00125
00126 void setObj(IOObj*);
00127 void setObj(const MultiID&);
00128 void setPar(IOPar*);
00129 int fillObj(bool mktmpifnew=false);
00132 void fillIfOnlyOne();
00135 void fillDefault(bool alsoifonlyone=true);
00137 void fillDefaultWithKey(const char*,bool alsoifonlyone=true);
00139
00140 IOObjContext ctxt;
00141 IOObj* ioobj;
00142 IOPar* iopar;
00143
00144 };
00145
00146
00147 #endif