| 1 |
////////////////////////////////////////////////////////////////////////////// |
| 2 |
////////////////////////////////////////////////////////////////////////////// |
| 3 |
// |
| 4 |
// Copyright : (C) 2015 Eran Ifrah |
| 5 |
// File name : PHPEntityClass.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 PHPENTITYCLASSIMPL_H |
| 27 |
#define PHPENTITYCLASSIMPL_H |
| 28 |
|
| 29 |
#include "codelite_exports.h" |
| 30 |
#include "PHPEntityBase.h" // Base class: PHPEntityBase |
| 31 |
#include "PHPDocVar.h" |
| 32 |
|
| 33 |
class WXDLLIMPEXP_CL PHPEntityClass : public PHPEntityBase |
| 34 |
{ |
| 35 |
wxString m_extends; |
| 36 |
wxArrayString m_implements; |
| 37 |
wxArrayString m_traits; |
| 38 |
PHPDocVar::List_t m_varPhpDocs; // List of @var defined inside the class body |
| 39 |
|
| 40 |
public: |
| 41 |
virtual wxString FormatPhpDoc(const CommentConfigData& data) const; |
| 42 |
virtual wxString GetDisplayName() const; |
| 43 |
virtual bool Is(eEntityType type) const; |
| 44 |
virtual wxString Type() const; |
| 45 |
// Save the class into teh database |
| 46 |
virtual void Store(PHPLookupTable* lookup); |
| 47 |
virtual void FromResultSet(wxSQLite3ResultSet& res); |
| 48 |
virtual void PrintStdout(int indent) const; |
| 49 |
|
| 50 |
void FromJSON(const JSONItem& json); |
| 51 |
JSONItem ToJSON() const; |
| 52 |
|
| 53 |
/** |
| 54 |
* @brief return an array of inheritance (extends, implementes and traits) |
| 55 |
*/ |
| 56 |
wxArrayString GetInheritanceArray() const; |
| 57 |
|
| 58 |
PHPEntityClass(); |
| 59 |
virtual ~PHPEntityClass(); |
| 60 |
void SetExtends(const wxString& extends) { this->m_extends = extends; } |
| 61 |
const wxString& GetExtends() const { return m_extends; } |
| 62 |
void SetImplements(const wxArrayString& implements) { this->m_implements = implements; } |
| 63 |
const wxArrayString& GetImplements() const { return m_implements; } |
| 64 |
void SetTraits(const wxArrayString& traits) { this->m_traits = traits; } |
| 65 |
const wxArrayString& GetTraits() const { return m_traits; } |
| 66 |
wxString GetImplementsAsString() const { return ::wxJoin(m_implements, ';'); } |
| 67 |
wxString GetTraitsAsString() const { return ::wxJoin(m_traits, ';'); } |
| 68 |
|
| 69 |
const PHPDocVar::List_t& GetVarPhpDocs() const { return m_varPhpDocs; } |
| 70 |
PHPDocVar::List_t& GetVarPhpDocs() { return m_varPhpDocs; } |
| 71 |
void AddVarPhpDoc(PHPDocVar::Ptr_t doc) { GetVarPhpDocs().push_back(doc); } |
| 72 |
|
| 73 |
// Aliases |
| 74 |
void SetIsInterface(bool b) { SetFlag(kClass_Interface, b); } |
| 75 |
bool IsInterface() const { return HasFlag(kClass_Interface); } |
| 76 |
void SetIsTrait(bool b) { SetFlag(kClass_Trait, b); } |
| 77 |
bool IsTrait() const { return HasFlag(kClass_Trait); } |
| 78 |
void SetIsAbstractClass(bool b) { SetFlag(kClass_Abstract, b); } |
| 79 |
bool IsAbstractClass() const { return HasFlag(kClass_Abstract); } |
| 80 |
}; |
| 81 |
|
| 82 |
#endif // PHPENTITYCLASSIMPL_H |