[475] | 1 | #include "stdafx.h"
|
---|
| 2 |
|
---|
[3] | 3 | #include "common.h"
|
---|
| 4 |
|
---|
[651] | 5 | CFileInfo::CFileInfo( const std::string &filepath, HTREEITEM hTreeItem )
|
---|
| 6 | : filepath( filepath )
|
---|
| 7 | , m_hTreeItem( hTreeItem )
|
---|
| 8 | {
|
---|
[3] | 9 | }
|
---|
| 10 | void CFileInfo::GetFullPath(char *buffer){
|
---|
[651] | 11 | lstrcpy(buffer,this->GetPath().c_str());
|
---|
[620] | 12 | lstrcpy( buffer, projectInfo.GetWorkDir().GetFullPath( buffer ).c_str() );
|
---|
[3] | 13 | }
|
---|
| 14 |
|
---|
| 15 |
|
---|
| 16 | CDBFileInfo::CDBFileInfo(){
|
---|
| 17 | iNum=0;
|
---|
| 18 | ppobj_FileInfo=(CFileInfo **)HeapAlloc(hHeap,0,1);
|
---|
| 19 | }
|
---|
| 20 | CDBFileInfo::~CDBFileInfo(){
|
---|
| 21 | int i;
|
---|
| 22 | for(i=0;i<iNum;i++){
|
---|
| 23 | delete ppobj_FileInfo[i];
|
---|
| 24 | }
|
---|
| 25 | HeapDefaultFree(ppobj_FileInfo);
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | void CDBFileInfo::add(char *path,HTREEITEM hTreeItem){
|
---|
| 29 | ppobj_FileInfo=(CFileInfo **)HeapReAlloc(hHeap,0,ppobj_FileInfo,(iNum+1)*sizeof(CFileInfo *));
|
---|
| 30 | ppobj_FileInfo[iNum]=new CFileInfo(path,hTreeItem);
|
---|
| 31 | iNum++;
|
---|
| 32 | }
|
---|
| 33 | void CDBFileInfo::del(HTREEITEM hTreeItem){
|
---|
| 34 | int i;
|
---|
| 35 | for(i=0;i<iNum;i++){
|
---|
| 36 | if(ppobj_FileInfo[i]->m_hTreeItem==hTreeItem) break;
|
---|
| 37 | }
|
---|
| 38 | if(i==iNum) return;
|
---|
| 39 |
|
---|
| 40 | delete ppobj_FileInfo[i];
|
---|
| 41 |
|
---|
| 42 | iNum--;
|
---|
| 43 | for(;i<iNum;i++) ppobj_FileInfo[i]=ppobj_FileInfo[i+1];
|
---|
| 44 | }
|
---|
[651] | 45 | const std::string &CDBFileInfo::GetPath(HTREEITEM hTreeItem)
|
---|
| 46 | {
|
---|
| 47 | for( int i=0; i<iNum; i++ )
|
---|
| 48 | {
|
---|
| 49 | if(ppobj_FileInfo[i]->m_hTreeItem==hTreeItem)
|
---|
| 50 | {
|
---|
| 51 | return ppobj_FileInfo[i]->GetPath();
|
---|
| 52 | }
|
---|
[3] | 53 | }
|
---|
[651] | 54 |
|
---|
| 55 | _ASSERTE( false );
|
---|
| 56 | throw;
|
---|
[3] | 57 | }
|
---|
| 58 | BOOL CDBFileInfo::IsMainFile(HTREEITEM hTreeItem){
|
---|
| 59 | int i;
|
---|
| 60 | for(i=0;i<iNum;i++){
|
---|
| 61 | if(ppobj_FileInfo[i]->m_hTreeItem==hTreeItem) break;
|
---|
| 62 | }
|
---|
| 63 | if(i==0) return 1;
|
---|
| 64 | return 0;
|
---|
| 65 | }
|
---|
| 66 | BOOL CDBFileInfo::dupli_check(char *path){
|
---|
| 67 | //重複チェック
|
---|
| 68 | int i;
|
---|
| 69 | for(i=0;i<iNum;i++){
|
---|
[651] | 70 | if(lstrcmpi(ppobj_FileInfo[i]->GetPath().c_str(),path)==0){
|
---|
[3] | 71 | return 1;
|
---|
| 72 | }
|
---|
| 73 | }
|
---|
| 74 | return 0;
|
---|
| 75 | }
|
---|