使用soui开发的mbc,只支持windows版本
w1146869587
2022-01-24 4905e2e7537d507f218e8e9595485e09d9f3a2b4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#include "StdAfx.h"
#include "MBBaseDocMgr.h"
 
IMPLEMENT_DYNAMIC(CMBBaseDocMgr, CMBAbstBaseObj)
 
CMBBaseDocMgr::CMBBaseDocMgr(void)
{
    RemoveAllDocObj();
}
 
 
CMBBaseDocMgr::~CMBBaseDocMgr(void)
{
    RemoveAllDocObj();
}
 
bool  CMBBaseDocMgr::AddDocObj(CMBBaseDocObj *pDocObj)
{
    if( NULL ==  pDocObj || pDocObj->m_strID.IsEmpty() )
        return false;
     
    CMBBaseDocObjMap::iterator    it;
    CString strID;
 
    strID = pDocObj->m_strID;
    it = m_mapDocObj.find(strID);
 
    // Èç¹ûÕҵõ½ ·µ»Ø
    if( it != m_mapDocObj.end() )
        return false;
 
    m_mapDocObj[strID] = pDocObj; 
    m_vecotrDocObj.push_back(pDocObj);
    return true;  
}
 
CMBBaseDocObj* CMBBaseDocMgr::GetDocObj( CString strID )
{
    if( strID.IsEmpty() )
    {
        return NULL;
    }
 
    CMBBaseDocObjMap::iterator    it;
    CMBBaseDocObj *pDocInfo = NULL;
 
    it = m_mapDocObj.find(strID);
 
    if( it!= m_mapDocObj.end() )
        pDocInfo = it->second;
 
    return pDocInfo;  
}
 
// Çå¿ÕÈÝÆ÷
void  CMBBaseDocMgr::EmptyContainer()
{
    m_mapDocObj.clear(); 
    m_vecotrDocObj.clear();
}
 
bool  CMBBaseDocMgr::RemoveAllDocObj()
{
    CMBBaseDocObjMap::iterator    it;
    CMBBaseDocObj *pDocObj = NULL;
 
    for( it = m_mapDocObj.begin();it != m_mapDocObj.end();it++ )
    {
        pDocObj = it->second;
        delete pDocObj;
        pDocObj = NULL;        
    }
    m_mapDocObj.clear(); 
    m_vecotrDocObj.clear();
    return true;   
}
 
bool CMBBaseDocMgr::GetBaseObjVector( CMBBaseObjVector &vectorObj )
{
    CMBBaseDocObjVector::iterator    it;
    CMBBaseDocObj *pDocObj = NULL;
 
    for( it = m_vecotrDocObj.begin();it != m_vecotrDocObj.end();it++ )
    {
        pDocObj = *it;
        vectorObj.push_back(pDocObj);    
    }
 
    return true;
}
 
bool  CMBBaseDocMgr::RemoveDocObj( CMBBaseDocObj *pDocObj )
{
    bool bDelte = false;
    if( NULL ==  pDocObj )
        return false;
    CMBBaseDocObjMap::iterator    it = m_mapDocObj.find(pDocObj->m_strID);
 
    if( it!= m_mapDocObj.end() )
    {
        bDelte = true;
        m_mapDocObj.erase(it);
    } 
    CMBBaseDocObjVector::iterator    it1 = std::find(m_vecotrDocObj.begin( ), m_vecotrDocObj.end( ), pDocObj); //²éÕÒ3
    if( it1 != m_vecotrDocObj.end( ) ){
        bDelte = true;
        m_vecotrDocObj.erase(it1);
    }    
    if( bDelte ){
        delete pDocObj;
        pDocObj = NULL;
    }
    return true;
}
 
// ÒƳýÎļþÐÅÏ¢ 
bool  CMBBaseDocMgr::RemoveDocObj( CString strID )
{
    CMBBaseDocObj *pBase= GetDocObj( strID );
    return RemoveDocObj( pBase );
}
 
void   CMBBaseDocMgr::GetDocObjMap( CMBBaseDocObjMap &mapDocObj)
{
    mapDocObj.clear();
    mapDocObj = m_mapDocObj;
}
 
void   CMBBaseDocMgr::GetDocObjVector( CMBBaseDocObjVector &vecotrDocObj)
{
    vecotrDocObj.clear();
    vecotrDocObj = m_vecotrDocObj;
}
 
// ÒÀ¸½ÓÚ¶ÔÏóÊý×é
//void   CMBBaseDocMgr::AttachObjVector( CMBBaseObjVector &objVecotr )
//{
//     
//}
 
void    CMBBaseDocMgr::SetAllCheck( bool bCheck )
{
    CMBBaseDocObjMap::iterator    it;
    CMBBaseDocObj *pDocObj = NULL;
 
    for( it = m_mapDocObj.begin();it != m_mapDocObj.end();it++ )
    {
        pDocObj = it->second;
        pDocObj->m_bCheck = bCheck;
    } 
}
 
 
int   CMBBaseDocMgr::GetCount()
    return m_mapDocObj.size();
}