]> git.lyx.org Git - features.git/blobdiff - src/mathed/math_iter.h
make doc++ able to generate the source documentation for lyx
[features.git] / src / mathed / math_iter.h
index 304de0f0fc76079b82d48b5af812e6f98bf59e92..dd4b1cb98286f7a0b9b242f9a203796b97a10c3c 100644 (file)
@@ -8,7 +8,7 @@
  *
  *  Dependencies: Xlib
  *
- *  Copyright: (c) 1996, 1997 Alejandro Aguilar Sierra
+ *  Copyright: 1996, 1997 Alejandro Aguilar Sierra
  *
  *   Version: 0.8beta, Mathed & Lyx project.
  *
@@ -17,8 +17,8 @@
  * 
  */
 
-#ifndef __MATH_ITER__
-#define __MATH_ITER__
+#ifndef MATH_ITER
+#define MATH_ITER
 
 #ifdef __GNUG__
 #pragma interface
 
 ///
 enum mathIterFlags {
-       /// Allow newlines
+    /// Allow newlines
     MthIF_CR = 1,
     /// Allow tabs
     MthIF_Tabs = 2
 };
 
 
-/**
- Specialized array iterator for amth paragraph.  Used for
- storing and querying data operations
- */
+/** Specialized array iterator for math paragraph.
+    Used for storing and querying data operations
+*/
 class MathedIter {
  public:
     ///
-    MathedIter()
-    {
+    MathedIter() {
        pos = 0;
        fcode = 0;
        array = 0;
@@ -51,29 +49,30 @@ class MathedIter {
        ncols = row = col = 0;
     }
     ///
+    explicit
     MathedIter(LyxArrayBase *);
     ///
-    virtual ~MathedIter() { }
+    virtual ~MathedIter() {}
     ///
     bool goNextCode(MathedTextCodes);
     ///
-   void goPosRel(int);
+    void goPosRel(int);
     ///
     void goPosAbs(int);
     ///
-    int Empty() { return array->last<=1; }
+    int Empty() { return array->Last()<= 1; }
     ///
-    int OK() { return array && (pos < array->last); }
+    int OK() { return array && (pos < array->Last()); }
     ///
-    int IsFirst() { return (pos==0); }
+    int IsFirst() { return (pos == 0); }
     ///
     byte GetChar();
     ///
-    byte* GetString(int& len);
+    byte * GetString(int& len);
     ///
-    MathedInset* GetInset();
+    MathedInset * GetInset();
     ///
-    MathParInset* GetActiveInset();
+    MathParInset * GetActiveInset();
     ///
     bool IsInset();
     ///
@@ -89,9 +88,9 @@ class MathedIter {
     ///
     virtual void Reset();
     ///
-    virtual void Insert(byte, MathedTextCodes c=LM_TC_CONST);
+    virtual void Insert(byte, MathedTextCodes c = LM_TC_CONST);
     ///
-    virtual void Insert(MathedInset*, int t=LM_TC_INSET);
+    virtual void Insert(MathedInset *, int t = LM_TC_INSET);
     ///
     virtual bool Delete();
     ///
@@ -111,12 +110,12 @@ class MathedIter {
     ///
     void setNumCols(int n) { ncols = n; }
     ///
-    void SetData(LyxArrayBase *a) { array = a; Reset(); }
+    void SetData(LyxArrayBase * a) { array = a; Reset(); }
     ///
-    LyxArrayBase *GetData() { return array; }
+    LyxArrayBase * GetData() { return array; }
     
     /// Copy every object from position p1 to p2
-    LyxArrayBase *Copy(int p1=0, int p2=10000);
+    LyxArrayBase * Copy(int p1= 0, int p2= 10000);
    
     /// Delete every object from position p1 to p2
     void Clear();
@@ -138,14 +137,15 @@ class MathedIter {
     LyxArrayBase *array;
     // one element stack
     struct MIState {
-           ///
+       ///
        short fcode;
-           ///
+       ///
        int x, y;
-           ///
+       ///
        int pos, row, col;
-    } stck;
-    
+    };
+    ///
+    MIState stck;
     /// Saves the current state of the iterator
     virtual void ipush();
     /// Recover previous state
@@ -165,15 +165,16 @@ class MathedIter {
 class MathedXIter: public MathedIter {
  public:
     ///
-    MathedXIter(): MathedIter() { x = y = size = 0;  p = 0; crow = 0; }
-    ///
-    MathedXIter(MathParInset*);
-    ///
-    ~MathedXIter() { };
+    MathedXIter()
+           : MathedIter(), sx(0), sw(0) {
+           x = y = size = 0;  p = 0; crow = 0;
+    }
+    //
+    MathedXIter(MathParInset *);
     ///
     void SetData(MathParInset *);
     ///
-    MathParInset *getPar() { return p; }
+    MathParInset * getPar() { return p; }
     ///
     bool Next();
     ///
@@ -191,11 +192,13 @@ class MathedXIter: public MathedIter {
     ///
     void Adjust();
     ///
-    inline void GetPos(int&, int&);
+    inline
+    void GetPos(int &, int &);
     ///
-    inline void GetIncPos(int&, int&);
+    inline
+    void GetIncPos(int &, int &);
     ///
-    byte* GetString(int&);
+    byte * GetString(int &);
     ///
     int GetX();
     ///
@@ -205,22 +208,19 @@ class MathedXIter: public MathedIter {
     ///
     void fitCoord(int, int);
     /// 
-    void getAD(int& a, int& d);
+    void getAD(int & a, int & d);
     
     /// Create a new row and insert #ncols# tabs.
     void addRow();
-       ///
-       void delRow();
+    ///
+    void delRow();
     
-       /**$ These two functions will be moved from here */
-         //@{
-       ///
+    ///
     bool setLabel(char* label);
-       ///
+    ///
     bool setNumbered(bool);
-       //@}
        
-       ///
+    ///
     void setTab(int, int);
     /// Merge the array at current position
     void Merge(LyxArrayBase*);
@@ -228,7 +228,7 @@ class MathedXIter: public MathedIter {
     void Clean(int pos2);
     MathedRowSt *adjustVerticalSt();
     
- private:
+private:
     /// This function is not recursive, as MathPar::Metrics is
     void IMetrics(int, int&, int&, int&);
     /// Font size (display, text, script, script2) 
@@ -243,20 +243,20 @@ class MathedXIter: public MathedIter {
     // Limits auxiliary variables
     /// Position and max width of a script
     int sx, sw;
-    /// true=center, false=left align (default)
+    /// true= center, false= left align (default)
     bool limits;
     /// Type of previous script
     short s_type;  
-
+    ///
     void ipush();
-
+    ///
     void ipop();
 
- protected:
+protected:
     /// 
     MathedRowSt *crow;
     
- private:
+private:
     ///
     friend class MathedCursor;
 };
@@ -268,48 +268,48 @@ class MathedXIter: public MathedIter {
 inline
 bool MathedIter::IsInset()
 {
-    return MathIsInset(array->bf[pos]);
+    return MathIsInset((*array)[pos]);
 }
  
 inline
 bool MathedIter::IsActive()
 {
-    return MathIsActive(array->bf[pos]);
+    return MathIsActive((*array)[pos]);
 }
 
 inline
 bool MathedIter::IsFont()
 {
-    return MathIsFont(array->bf[pos]);
+    return MathIsFont((*array)[pos]);
 }
 
 
 inline
 bool MathedIter::IsScript()
 {
-    return MathIsScript(array->bf[pos]);
+    return MathIsScript((*array)[pos]);
 }   
 
 inline
 bool MathedIter::IsTab()
 {
-    return (array->bf[pos]==LM_TC_TAB);
+    return ((*array)[pos] == LM_TC_TAB);
 }  
 
 
 inline
 bool MathedIter::IsCR()
 {
-    return (array->bf[pos]==LM_TC_CR);
+    return ((*array)[pos] == LM_TC_CR);
 }  
 
 
 inline
-MathedIter::MathedIter(LyxArrayBase *d): array(d)
+MathedIter::MathedIter(LyxArrayBase * d): array(d)
 {
     pos = 0;
     row = col = 0;
-    fcode = (array && IsFont()) ? array->bf[0]: 0;
+    fcode = (array && IsFont()) ? (*array)[0]: 0;
 }