]> git.lyx.org Git - features.git/blobdiff - src/mathed/math_macro.h
make doc++ able to generate the source documentation for lyx
[features.git] / src / mathed / math_macro.h
index abf40f2eb4efdc39b9e5dee63f7c019c1708159e..bd87b701af471c7b5a4284f474fa6e57dd39fc9c 100644 (file)
@@ -8,7 +8,7 @@
  *
  *  Dependencies: Mathed
  *
- *  Copyright: (c) 1996, 1997 Alejandro Aguilar Sierra
+ *  Copyright: 1996, 1997 Alejandro Aguilar Sierra
  *
  *   Version: 0.2, Mathed & Lyx project.
  *
@@ -35,138 +35,122 @@ class MathMacroTemplate;
 /// This class contains the data for a macro
 class MathMacro : public MathParInset
 {
- public:
+public:
     /// A macro can only be builded from an existing template
+    explicit
     MathMacro(MathMacroTemplate *);
     /// or from another macro.
+    explicit
     MathMacro(MathMacro *);
-       ///
+    ///
     ~MathMacro();
-#ifdef USE_PAINTER
-       ///
-       void draw(Painter &, int, int);
-#else
-       ///
-    void Draw(int, int);
-#endif
-       ///
+    ///
+    void draw(Painter &, int, int);
+    ///
     void Metrics();
-       ///
+    ///
     MathedInset * Clone();
-       ///
-    void Write(ostream &);
-       ///
-    void Write(string &);
-       ///
+    ///
+    void Write(std::ostream &, bool fragile);
+    ///
     bool setArgumentIdx(int);
-       ///
+    ///
     int  getArgumentIdx();
-       ///
+    ///
     int  getMaxArgumentIdx();
-       ///
+    ///
     int GetColumns();
-       ///
+    ///
     void GetXY(int &, int &) const;
-       ///
+    ///
     void SetFocus(int, int);
-       ///
+    ///
     LyxArrayBase * GetData();
-       ///
+    ///
     MathedRowSt * getRowSt() const { return args[idx].row; }
-       ///
+    ///
     void SetData(LyxArrayBase *);
-       ///
+    ///
     MathedTextCodes getTCode() { return tcode; }
-       ///
+    ///
     bool Permit(short);
     
- private:
-       ///
-       MathMacroTemplate * tmplate;
-       ///
-       struct MacroArgumentBase {
-               /// Position of the macro
-               int x, y;
-               ///
-               MathedRowSt * row;
-               ///
-               LyxArrayBase * array;
-               ///
-               MacroArgumentBase() { x = y = 0;  array = 0; row = 0; }
-       };
-       MacroArgumentBase * args;
-       ///
-       int idx;
+private:
+    ///
+    MathMacroTemplate * tmplate;
+    ///
+    struct MacroArgumentBase {
+       /// Position of the macro
+       int x, y;
        ///
-       int nargs;
+       MathedRowSt * row;
        ///
-       MathedTextCodes tcode;
+       LyxArrayBase * array;
        ///
-       friend class MathMacroTemplate;
+       MacroArgumentBase() { x = y = 0;  array = 0; row = 0; }
+    };
+    MacroArgumentBase * args;
+    ///
+    int idx;
+    ///
+    int nargs;
+    ///
+    MathedTextCodes tcode;
+    ///
+    friend class MathMacroTemplate;
 };
 
 
 /// An argument
-class MathMacroArgument: public MathParInset
-{
- public:
+class MathMacroArgument: public MathParInset {
+public:
     ///
-    MathMacroArgument() { expnd_mode = false; number = 1;  SetType(LM_OT_MACRO_ARG); }
+    MathMacroArgument() {
+           expnd_mode = false;
+           number = 1;
+           SetType(LM_OT_MACRO_ARG);
+    }
     ///
+    explicit
     MathMacroArgument(int);
     ///
-       ~MathMacroArgument() { lyxerr << "help, destroyme!" << endl; }
+    ~MathMacroArgument() { lyxerr << "help, destroyme!" << std::endl; }
     ///
     MathedInset * Clone() { return this; }
-       ///
+    ///
     void Metrics();
-#ifdef USE_PAINTER
-       ///
-       void draw(Painter &, int x, int baseline);
-#else
-       ///
-    void Draw(int x, int baseline);
-#endif
-       ///
-    void Write(ostream &);
-       ///
-    void Write(string &);
+    ///
+    void draw(Painter &, int x, int baseline);
+    ///
+    void Write(std::ostream &, bool fragile);
     ///
     void setNumber(int n) { number = n; }
     /// Is expanded or not
     void setExpand(bool e) { expnd_mode = e; }
     /// Is expanded or not
     bool getExpand() { return expnd_mode; }
-    
- private:
-       ///
+private:
+    ///
     bool expnd_mode;
-       ///
+    ///
     int number;
 };
 
 
 /// This class contains the macro definition
-class MathMacroTemplate: public MathParInset
-{
- public:
+class MathMacroTemplate: public MathParInset {
+public:
     /// A template constructor needs all the data
+    explicit
     MathMacroTemplate(char const *, int na = 0, int f = 0);
-       ///
+    ///
     ~MathMacroTemplate();
-#ifdef USE_PAINTER
-       ///
-       void draw(Painter &, int, int);
-#else
-       ///
-    void Draw(int, int);
-#endif
-       ///
+    ///
+    void draw(Painter &, int, int);
+    ///
     void Metrics();
-       ///
-    void WriteDef(ostream &);
-       ///
-    void WriteDef(string &); 
+    ///
+    void WriteDef(std::ostream &, bool fragile);
     /// useful for special insets
     void  setTCode(MathedTextCodes t) { tcode = t; }
     ///
@@ -181,13 +165,13 @@ class MathMacroTemplate: public MathParInset
     MathParInset * getMacroPar(int) const;
     ///
     void SetMacroFocus(int &, int, int);
-       ///
+    ///
     void setEditMode(bool);
 
     /// Replace the appropriate arguments with a specific macro's data
     void update(MathMacro * m = 0);
       
- private:
+private:
     ///
     short flags;
     ///
@@ -207,32 +191,32 @@ typedef MathMacro * MathMacroP;
 typedef MathMacroTemplate * MathMacroTemplateP;
 
 ///
-class MathMacroTable 
-{
- public:
-       ///
+class MathMacroTable {
+public:
+    ///
+    explicit
     MathMacroTable(int);
-       ///
+    ///
     ~MathMacroTable();
-       ///
+    ///
     void addTemplate(MathMacroTemplate *);
-       ///
+    ///
     MathMacro * getMacro(char const *) const;
-       ///
+    ///
     MathMacroTemplate * getTemplate(char const *) const;
-       ///
+    ///
     void builtinMacros();
-       ///
+    ///
     static MathMacroTable mathMTable;
-       ///
+    ///
     static bool built;
     
- private:
-       ///
+private:
+    ///
     const int max_macros;
-       ///
+    ///
     int num_macros;
-       ///
+    ///
     MathMacroTemplateP * macro_table;
 };
 
@@ -279,10 +263,10 @@ void MathMacro::SetData(LyxArrayBase * a)
 
 inline 
 MathMacro * MathMacroTable::getMacro(char const * name) const
- {
-     MathMacroTemplate * mt = getTemplate(name);
-     return (mt) ? new MathMacro(mt): 0;
- }
+{
+       MathMacroTemplate * mt = getTemplate(name);
+       return (mt) ? new MathMacro(mt): 0;
+}
 
 
 #endif