00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __OP_ExprFunc_h__
00023 #define __OP_ExprFunc_h__
00024
00025 #include "OP_API.h"
00026 #include <iostream.h>
00027 #include <UT/UT_PtrArray.h>
00028
00029 class UT_IStream;
00030 class EX_ExprFunc;
00031 class CMD_Manager;
00032
00033 class OP_API OP_ExprFunc {
00034 public:
00035 OP_ExprFunc(CMD_Manager *cmd);
00036 ~OP_ExprFunc();
00037
00038 int load(const char *filename, ostream *err = 0, ostream *out = 0);
00039 int load(UT_IStream &is, ostream *err = 0, ostream *out = 0);
00040 int save(ostream &os) const;
00041
00042 int entries() const { return myFunctions.entries(); }
00043 EX_ExprFunc *getFunction(int idx) { return myFunctions(idx); }
00044
00045 public:
00046
00047 void ls(ostream &os);
00048 void rm(const char *funcname, ostream *out = 0);
00049 void removeAllFunctions();
00050 void edit(const char *funcname, ostream *err, int reedit=0);
00051 int cat(ostream &os, const char *funcname);
00052
00053 private:
00054 int find(const char *name);
00055 void sort();
00056 void install(CMD_Manager *cman);
00057 void printDeclaration(ostream &os, EX_ExprFunc *func);
00058
00059 UT_PtrArray<EX_ExprFunc *> myFunctions;
00060 };
00061
00062 #endif