| 1 |
////////////////////////////////////////////////////////////////////////////// |
| 2 |
////////////////////////////////////////////////////////////////////////////// |
| 3 |
// |
| 4 |
// Copyright : (C) 2015 Eran Ifrah |
| 5 |
// File name : PHPEntityVariable.h |
| 6 |
// |
| 7 |
// ------------------------------------------------------------------------- |
| 8 |
// A |
| 9 |
// _____ _ _ _ _ |
| 10 |
// / __ \ | | | | (_) | |
| 11 |
// | / \/ ___ __| | ___| | _| |_ ___ |
| 12 |
// | | / _ \ / _ |/ _ \ | | | __/ _ ) |
| 13 |
// | \__/\ (_) | (_| | __/ |___| | || __/ |
| 14 |
// \____/\___/ \__,_|\___\_____/_|\__\___| |
| 15 |
// |
| 16 |
// F i l e |
| 17 |
// |
| 18 |
// This program is free software; you can redistribute it and/or modify |
| 19 |
// it under the terms of the GNU General Public License as published by |
| 20 |
// the Free Software Foundation; either version 2 of the License, or |
| 21 |
// (at your option) any later version. |
| 22 |
// |
| 23 |
////////////////////////////////////////////////////////////////////////////// |
| 24 |
////////////////////////////////////////////////////////////////////////////// |
| 25 |
|
| 26 |
#ifndef PHPENTITYVARIABLE_H |
| 27 |
#define PHPENTITYVARIABLE_H |
| 28 |
|
| 29 |
#include "codelite_exports.h" |
| 30 |
#include "PHPEntityBase.h" // Base class: PHPEntityBase |
| 31 |
#include <wx/string.h> |
| 32 |
|
| 33 |
class WXDLLIMPEXP_CL PHPEntityVariable : public PHPEntityBase |
| 34 |
{ |
| 35 |
public: |
| 36 |
virtual wxString FormatPhpDoc(const CommentConfigData& data) const; |
| 37 |
virtual wxString GetDisplayName() const; |
| 38 |
virtual bool Is(eEntityType type) const; |
| 39 |
virtual wxString Type() const; |
| 40 |
virtual void FromResultSet(wxSQLite3ResultSet& res); |
| 41 |
|
| 42 |
protected: |
| 43 |
wxString m_typeHint; |
| 44 |
|
| 45 |
// Incase this variable is instantiated with an expression |
| 46 |
// keep it |
| 47 |
wxString m_expressionHint; |
| 48 |
wxString m_defaultValue; |
| 49 |
|
| 50 |
public: |
| 51 |
/** |
| 52 |
* @brief |
| 53 |
* @return |
| 54 |
*/ |
| 55 |
wxString GetScope() const; |
| 56 |
virtual void Store(PHPLookupTable* lookup); |
| 57 |
virtual void PrintStdout(int indent) const; |
| 58 |
|
| 59 |
void FromJSON(const JSONItem& json); |
| 60 |
JSONItem ToJSON() const; |
| 61 |
|
| 62 |
/** |
| 63 |
* @brief format this variable |
| 64 |
*/ |
| 65 |
wxString ToFuncArgString() const; |
| 66 |
PHPEntityVariable(); |
| 67 |
virtual ~PHPEntityVariable(); |
| 68 |
|
| 69 |
void SetExpressionHint(const wxString& expressionHint) { this->m_expressionHint = expressionHint; } |
| 70 |
const wxString& GetExpressionHint() const { return m_expressionHint; } |
| 71 |
void SetVisibility(int visibility); |
| 72 |
void SetTypeHint(const wxString& typeHint) { this->m_typeHint = typeHint; } |
| 73 |
const wxString& GetTypeHint() const { return m_typeHint; } |
| 74 |
void SetDefaultValue(const wxString& defaultValue) { this->m_defaultValue = defaultValue; } |
| 75 |
const wxString& GetDefaultValue() const { return m_defaultValue; } |
| 76 |
wxString GetNameNoDollar() const; |
| 77 |
virtual wxString ToTooltip() const; |
| 78 |
|
| 79 |
// Aliases |
| 80 |
void SetIsReference(bool isReference) { SetFlag(kVar_Reference, isReference); } |
| 81 |
void SetIsNullable(bool isNullable) { SetFlag(kVar_Nullable, isNullable); } |
| 82 |
bool IsMember() const { return HasFlag(kVar_Member); } |
| 83 |
bool IsPublic() const { return HasFlag(kVar_Public); } |
| 84 |
bool IsPrivate() const { return HasFlag(kVar_Private); } |
| 85 |
bool IsProtected() const { return HasFlag(kVar_Protected); } |
| 86 |
bool IsFunctionArg() const { return HasFlag(kVar_FunctionArg); } |
| 87 |
bool IsConst() const { return HasFlag(kVar_Const); } |
| 88 |
bool IsReference() const { return HasFlag(kVar_Reference); } |
| 89 |
bool IsNullable() const { return HasFlag(kVar_Nullable); } |
| 90 |
bool IsStatic() const { return HasFlag(kVar_Static); } |
| 91 |
bool IsDefine() const { return HasFlag(kVar_Define); } |
| 92 |
bool IsBoolean() const { return GetTypeHint() == "boolean" || GetTypeHint() == "bool"; } |
| 93 |
}; |
| 94 |
|
| 95 |
#endif // PHPENTITYVARIABLE_H |