Skip to content

Commit

Permalink
UPBGE: Clean up headers in Expression/ part.
Browse files Browse the repository at this point in the history
This cleanup contains:
- uncrustify pass
- comment reword
- remove extra lines
- move function definition to .cpp.
  • Loading branch information
panzergame committed Jan 4, 2017
1 parent 9602bf1 commit 005ec40
Show file tree
Hide file tree
Showing 23 changed files with 639 additions and 626 deletions.
30 changes: 14 additions & 16 deletions source/gameengine/Expressions/EXP_BoolValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@

#include "EXP_Value.h"

/**
* Smart Boolean Value class.
/** Smart Boolean Value class.
* Is used by parser when an expression tree is build containing booleans.
*/

class CBoolValue : public CPropValue
class CBoolValue : public CPropValue
{
public:
static const std::string sTrueString;
Expand All @@ -37,25 +35,25 @@ class CBoolValue : public CPropValue
CBoolValue(bool innie, const std::string& name);

virtual const std::string GetText();
virtual double GetNumber();
virtual int GetValueType();
bool GetBool();
virtual void SetValue(CValue* newval);
virtual CValue* Calc(VALUE_OPERATOR op, CValue *val);
virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val);
virtual CValue* GetReplica();
virtual double GetNumber();
virtual int GetValueType();
bool GetBool();
virtual void SetValue(CValue *newval);

virtual CValue *Calc(VALUE_OPERATOR op, CValue *val);
virtual CValue *CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val);

virtual CValue *GetReplica();
#ifdef WITH_PYTHON
virtual PyObject* ConvertValueToPython();
virtual PyObject *ConvertValueToPython();
#endif

private:
bool m_bool;
bool m_bool;

#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("GE:CBoolValue")
#endif
};

#endif /* __EXP_BOOLVALUE_H__ */
#endif // __EXP_BOOLVALUE_H__
19 changes: 9 additions & 10 deletions source/gameengine/Expressions/EXP_ConstExpr.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,25 @@
#define __EXP_CONSTEXPR_H__

#include "EXP_Expression.h"
#include "EXP_Value.h" // Added by ClassView
#include "EXP_Value.h"

class CConstExpr : public CExpression
class CConstExpr : public CExpression
{
public:
virtual unsigned char GetExpressionID();
virtual double GetNumber();
virtual CValue* Calculate();
CConstExpr(CValue* constval);
CConstExpr();
CConstExpr(CValue *constval);
virtual ~CConstExpr();


private:
CValue* m_value;
virtual unsigned char GetExpressionID();
virtual double GetNumber();
virtual CValue *Calculate();

private:
CValue *m_value;

#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("GE:CConstExpr")
#endif
};

#endif /* __EXP_CONSTEXPR_H__ */
#endif // __EXP_CONSTEXPR_H__
17 changes: 8 additions & 9 deletions source/gameengine/Expressions/EXP_ErrorValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,25 @@

#include "EXP_Value.h"

class CErrorValue : public CPropValue
class CErrorValue : public CPropValue
{

public:
virtual const std::string GetText();
virtual int GetValueType();
CErrorValue();
CErrorValue(const std::string& errmsg);
virtual ~CErrorValue();
virtual CValue* Calc(VALUE_OPERATOR op, CValue* val);
virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val);
virtual CValue* GetReplica();

virtual const std::string GetText();
virtual int GetValueType();
virtual CValue *Calc(VALUE_OPERATOR op, CValue *val);
virtual CValue *CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val);
virtual CValue *GetReplica();

private:
std::string m_strErrorText;


#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("GE:CErrorValue")
#endif
};

#endif /* __EXP_ERRORVALUE_H__ */
#endif // __EXP_ERRORVALUE_H__
42 changes: 14 additions & 28 deletions source/gameengine/Expressions/EXP_Expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,50 +21,36 @@

#include "EXP_Value.h"

class CExpression
class CExpression
{
public:
enum {
COPERATOR1EXPRESSIONID = 1,
COPERATOR2EXPRESSIONID = 2,
CCONSTEXPRESSIONID = 3,
CIFEXPRESSIONID = 4,
COPERATORVAREXPRESSIONID = 5,
CIDENTIFIEREXPRESSIONID = 6
COPERATOR1EXPRESSIONID = 1,
COPERATOR2EXPRESSIONID = 2,
CCONSTEXPRESSIONID = 3,
CIFEXPRESSIONID = 4,
COPERATORVAREXPRESSIONID = 5,
CIDENTIFIEREXPRESSIONID = 6
};


protected:
virtual ~CExpression() = 0; //pure virtual
virtual ~CExpression() = 0;

public:
CExpression();


virtual CValue* Calculate() = 0; //pure virtual
virtual unsigned char GetExpressionID() = 0;
virtual CValue *Calculate() = 0;
virtual unsigned char GetExpressionID() = 0;

virtual CExpression * AddRef() { // please leave multiline, for debugger !!!
m_refcount++;
return this;
};
virtual CExpression* Release(CExpression* complicatedtrick=NULL) {
if (--m_refcount < 1)
{
delete this;
} //else
// return this;
return complicatedtrick;
};

virtual CExpression *AddRef();
virtual CExpression *Release();

protected:

int m_refcount;


#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("GE:CExpression")
#endif
};

#endif /* __EXP_EXPRESSION_H__ */
#endif // __EXP_EXPRESSION_H__
17 changes: 8 additions & 9 deletions source/gameengine/Expressions/EXP_FloatValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,35 +21,34 @@

#include "EXP_Value.h"

class CFloatValue : public CPropValue
class CFloatValue : public CPropValue
{
public:
CFloatValue();
CFloatValue(float fl);
CFloatValue(float fl,const std::string& name);
CFloatValue(float fl, const std::string& name);

virtual const std::string GetText();

virtual double GetNumber();
virtual int GetValueType();
virtual void SetValue(CValue* newval);
virtual void SetValue(CValue *newval);
float GetFloat();
void SetFloat(float fl);
virtual ~CFloatValue();
virtual CValue* GetReplica();
virtual CValue* Calc(VALUE_OPERATOR op, CValue *val);
virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val);
virtual CValue *GetReplica();
virtual CValue *Calc(VALUE_OPERATOR op, CValue *val);
virtual CValue *CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val);
#ifdef WITH_PYTHON
virtual PyObject* ConvertValueToPython();
virtual PyObject *ConvertValueToPython();
#endif

protected:
float m_float;


#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("GE:CFloatValue")
#endif
};

#endif /* __EXP_FLOATVALUE_H__ */
#endif // __EXP_FLOATVALUE_H__
12 changes: 6 additions & 6 deletions source/gameengine/Expressions/EXP_HashedPtr.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,22 @@

class CHashedPtr
{
void* m_valptr;
private:
void *m_valptr;

public:
CHashedPtr(void* val);
CHashedPtr(void *val);

unsigned int hash() const;

inline friend bool operator ==( const CHashedPtr & rhs,const CHashedPtr & lhs)
inline friend bool operator ==(const CHashedPtr & rhs, const CHashedPtr & lhs)
{
return rhs.m_valptr == lhs.m_valptr;
}



#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("GE:CHashedPtr")
#endif
};

#endif /* __EXP_HASHEDPTR_H__ */
#endif // __EXP_HASHEDPTR_H__
14 changes: 8 additions & 6 deletions source/gameengine/Expressions/EXP_IdentifierExpr.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,20 @@

class CIdentifierExpr : public CExpression
{
CValue* m_idContext;
std::string m_identifier;
private:
CValue *m_idContext;
std::string m_identifier;

public:
CIdentifierExpr(const std::string& identifier,CValue* id_context);
CIdentifierExpr(const std::string& identifier, CValue *id_context);
virtual ~CIdentifierExpr();

virtual CValue* Calculate();
virtual unsigned char GetExpressionID();
virtual CValue *Calculate();
virtual unsigned char GetExpressionID();

#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("GE:CIdentifierExpr")
#endif
};

#endif /* __EXP_IDENTIFIEREXPR_H__ */
#endif // __EXP_IDENTIFIEREXPR_H__
16 changes: 9 additions & 7 deletions source/gameengine/Expressions/EXP_IfExpr.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,24 @@

#include "EXP_Expression.h"

class CIfExpr : public CExpression
class CIfExpr : public CExpression
{
private:
CExpression *m_guard, *m_e1, *m_e2;
CExpression *m_guard;
CExpression *m_e1;
CExpression *m_e2;

public:
CIfExpr(CExpression *guard, CExpression *e1, CExpression *e2);
CIfExpr();

virtual unsigned char GetExpressionID();
CIfExpr(CExpression *guard, CExpression *e1, CExpression *e2);
virtual ~CIfExpr();
virtual CValue* Calculate();

virtual unsigned char GetExpressionID();
virtual CValue *Calculate();

#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("GE:CIfExpr")
#endif
};

#endif /* __EXP_IFEXPR_H__ */
#endif // __EXP_IFEXPR_H__
37 changes: 16 additions & 21 deletions source/gameengine/Expressions/EXP_IntValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,44 +22,39 @@

#include "EXP_Value.h"

typedef long long cInt;
typedef long long cInt;

class CIntValue : public CPropValue
class CIntValue : public CPropValue
{
public:
virtual const std::string GetText();
virtual double GetNumber();
virtual int GetValueType();

cInt GetInt();
CIntValue();
CIntValue(cInt innie);
CIntValue(cInt innie, const std::string& name);

virtual CValue* Calc(VALUE_OPERATOR op,
CValue *val);
virtual ~CIntValue();

virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype,
VALUE_OPERATOR op,
CValue *val);
virtual const std::string GetText();
virtual double GetNumber();
virtual int GetValueType();

virtual void SetValue(CValue* newval);
cInt GetInt();

virtual CValue* GetReplica();
virtual CValue *Calc(VALUE_OPERATOR op, CValue *val);
virtual CValue *CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val);

virtual void SetValue(CValue *newval);

virtual CValue *GetReplica();

#ifdef WITH_PYTHON
virtual PyObject* ConvertValueToPython();
virtual PyObject *ConvertValueToPython();
#endif

protected:
virtual ~CIntValue();

private:
cInt m_int;
cInt m_int;

#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("GE:CIntValue")
#endif
};

#endif /* __EXP_INTVALUE_H__ */
#endif // __EXP_INTVALUE_H__
Loading

0 comments on commit 005ec40

Please sign in to comment.