aboutsummaryrefslogtreecommitdiff
path: root/src/filemgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/filemgr.cpp48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/filemgr.cpp b/src/filemgr.cpp
index 00f0410..16f2ba7 100644
--- a/src/filemgr.cpp
+++ b/src/filemgr.cpp
@@ -1,46 +1,46 @@
1#include "filemgr.h" 1#include "filemgr.h"
2 2
3FileMgr::FileMgr() : 3FileMgr::FileMgr() :
4 iNextId( 1 ) 4 iNextId( 1 )
5{ 5{
6} 6}
7 7
8FileMgr::~FileMgr() 8FileMgr::~FileMgr()
9{ 9{
10 for( FileHash::iterator i = hFile.begin(); i; i++ ) 10 for( FileHash::iterator i = hFile.begin(); i; i++ )
11 { 11 {
12 delete *i; 12 delete *i;
13 } 13 }
14} 14}
15 15
16int FileMgr::open( const Bu::String &sPath, int iMode ) 16int FileMgr::open( const Bu::String &sPath, int iMode )
17{ 17{
18 hFile.insert( iNextId, new Bu::File( sPath, iMode ) ); 18 hFile.insert( iNextId, new Bu::File( sPath, iMode ) );
19 return iNextId++; 19 return iNextId++;
20} 20}
21 21
22Bu::File &FileMgr::get( int iId ) 22Bu::File &FileMgr::get( int iId )
23{ 23{
24 try 24 try
25 { 25 {
26 return *hFile.get( iId ); 26 return *hFile.get( iId );
27 } 27 }
28 catch(...) 28 catch(...)
29 { 29 {
30 throw Bu::ExceptionBase("Invalid file handle accessed."); 30 throw Bu::ExceptionBase("Invalid file handle accessed.");
31 } 31 }
32} 32}
33 33
34void FileMgr::close( int iId ) 34void FileMgr::close( int iId )
35{ 35{
36 try 36 try
37 { 37 {
38 delete hFile.get( iId ); 38 delete hFile.get( iId );
39 hFile.erase( iId ); 39 hFile.erase( iId );
40 } 40 }
41 catch(...) 41 catch(...)
42 { 42 {
43 throw Bu::ExceptionBase("Invalid file handle accessed."); 43 throw Bu::ExceptionBase("Invalid file handle accessed.");
44 } 44 }
45} 45}
46 46