| 1 |
// $Id: b_object.h,v 1.5 2003/03/02 04:12:45 fukasawa Exp $ |
| 2 |
|
| 3 |
//============================================================================= |
| 4 |
/** |
| 5 |
* @file b_object.h |
| 6 |
* |
| 7 |
* @author Fukasawa Mitsuo |
| 8 |
* |
| 9 |
* |
| 10 |
* Copyright (C) 2001-2004 BEE Co.,Ltd. All rights reserved. |
| 11 |
* |
| 12 |
* This program is free software; you can redistribute it and/or |
| 13 |
* modify it under the terms of the GNU General Public License |
| 14 |
* as published by the Free Software Foundation; either version 2 |
| 15 |
* of the License, or (at your option) any later version. |
| 16 |
* |
| 17 |
* This program is distributed in the hope that it will be useful, |
| 18 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 |
* GNU General Public License for more details. |
| 21 |
* |
| 22 |
* You should have received a copy of the GNU General Public License |
| 23 |
* along with this program; if not, write to the Free Software |
| 24 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 25 |
*/ |
| 26 |
//============================================================================= |
| 27 |
|
| 28 |
#ifndef B_OBJECT_H |
| 29 |
#define B_OBJECT_H |
| 30 |
|
| 31 |
#include "b_specification.h" |
| 32 |
#include "b_attrdata.h" |
| 33 |
|
| 34 |
class b_objtype; |
| 35 |
class b_attribute; |
| 36 |
class b_attrdata; |
| 37 |
typedef vector<b_attrdata *> AttrDataVect; |
| 38 |
|
| 39 |
// |
| 40 |
// Object |
| 41 |
// |
| 42 |
class BEE_Export b_object |
| 43 |
{ |
| 44 |
friend class b_objtype; |
| 45 |
|
| 46 |
public: |
| 47 |
virtual ~b_object(); |
| 48 |
b_object& operator=(const b_object& rhs); |
| 49 |
|
| 50 |
virtual int link() { return BEE_SUCCESS; } |
| 51 |
|
| 52 |
string& name() { return m_name; } |
| 53 |
const BCHAR * charName() { return m_name.c_str(); } |
| 54 |
|
| 55 |
const string& objid() const { return m_name; } |
| 56 |
const string& objSpec() const { return m_spec; } |
| 57 |
const BCHAR * getObjSpec() const { return m_spec.c_str(); } |
| 58 |
const BCHAR * getObjID() const { return m_name.c_str(); } |
| 59 |
b_objtype * getObjType() const { return m_objtype; } |
| 60 |
AttrDataVect& getDataTable() { return m_values; } |
| 61 |
|
| 62 |
// Find attribute by name |
| 63 |
const b_attribute * findAttr(const string& name) const; |
| 64 |
b_attrdata * findData(const string& name) const; |
| 65 |
b_attrdata * findDataByUser(const string& name) const; |
| 66 |
|
| 67 |
// Set attribute data |
| 68 |
int set(const b_object& rhs); |
| 69 |
|
| 70 |
// Compare attribute data |
| 71 |
bool isEqual(const b_object& rhs); |
| 72 |
|
| 73 |
void dump() const; |
| 74 |
// |
| 75 |
protected: |
| 76 |
b_object() : m_objtype(NULL) {} |
| 77 |
b_object(b_objtype * oss, const BCHAR * name = NULL); |
| 78 |
b_object(const b_object& rhs); |
| 79 |
void copy(const b_object& rhs); |
| 80 |
void makeDataMap(); |
| 81 |
|
| 82 |
// |
| 83 |
protected: |
| 84 |
string m_name; |
| 85 |
string m_spec; |
| 86 |
b_objtype * m_objtype; |
| 87 |
AttrDataVect m_values; |
| 88 |
}; |
| 89 |
|
| 90 |
|
| 91 |
// Declare template |
| 92 |
typedef vector<b_object *> b_objects; |
| 93 |
|
| 94 |
#endif /* B_OBJECT_H */ |