HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OP_ExprFunc.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: OP library (C++)
7  *
8  * COMMENTS: Expression function manager
9  * We handle expression functions at this level to support
10  * saving and loading of the functions...
11  *
12  */
13 
14 #ifndef __OP_ExprFunc_h__
15 #define __OP_ExprFunc_h__
16 
17 #include "OP_API.h"
18 #include <UT/UT_ValArray.h>
19 #include <UT/UT_SymbolTable.h>
20 #include <iosfwd>
21 
22 class UT_IStream;
23 class EX_ExprFunc;
24 class EV_FUNCTION;
25 class CMD_Manager;
26 
28 public:
30  ~OP_ExprFunc();
31 
32  int load(const char *filename,
33  std::ostream *err = 0, std::ostream *out = 0);
34  int load(const char *filename,
35  std::ostream *err, std::ostream *out, bool notify_new);
36  int load(UT_IStream &is,
37  std::ostream *err = 0, std::ostream *out = 0);
38  int load(UT_IStream &is,
39  std::ostream *err, std::ostream *out, bool notify_new);
40  int save(std::ostream &os) const;
41 
42  int entries() const { return myFunctions.entries(); }
43  EX_ExprFunc *getFunction(int idx) { return myFunctions(idx); }
44 
45 public:
46  // Methods used by commands
47  void ls(std::ostream &os);
48  void rm(const char *funcname, std::ostream *out = 0);
49  void removeAllFunctions();
50  void edit(const char *funcname, std::ostream *err, int reedit=0);
51  int cat(std::ostream &os, const char *funcname);
52 
53 private:
54  int find(const char *name);
55  void sort();
56  void install(CMD_Manager *cman);
57  void printDeclaration(std::ostream &os, EX_ExprFunc *func);
58 
59  UT_ValArray<EX_ExprFunc *> myFunctions;
60  UT_SymbolMap<EV_FUNCTION *> myOldFunctions;
61 };
62 
63 #endif
int entries() const
Definition: OP_ExprFunc.h:42
GT_API const UT_StringHolder filename
GLuint const GLchar * name
Definition: glcorearb.h:786
GLenum func
Definition: glcorearb.h:783
EX_ExprFunc * getFunction(int idx)
Definition: OP_ExprFunc.h:43
#define OP_API
Definition: OP_API.h:10
void sort(I begin, I end, const Pred &pred)
Definition: pugixml.cpp:7334
FMT_CONSTEXPR auto find(Ptr first, Ptr last, T value, Ptr &out) -> bool
Definition: core.h:2089