Changeset 496
- Timestamp:
- 01/16/08 11:38:13 (1 year ago)
- Files:
-
- trunk/libx42.sln (modified) (2 diffs)
- trunk/libx42pp/include/x42model.h (modified) (2 diffs)
- trunk/libx42pp/x42model.cpp (modified) (2 diffs)
- trunk/x42info (added)
- trunk/x42info/main.cpp (added)
- trunk/x42info/x42info.vcproj (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libx42.sln
r348 r496 31 31 Release.AspNetCompiler.Debug = "False" 32 32 EndProjectSection 33 EndProject 34 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "x42info", "x42info\x42info.vcproj", "{4FEB16E4-CC84-4969-874A-3B5260A52D70}" 33 35 EndProject 34 36 Global … … 72 74 {CA9895E9-4CF3-49CC-A919-3BB4C4EF7909}.Release|x64.ActiveCfg = Release (8.5)|x64 73 75 {CA9895E9-4CF3-49CC-A919-3BB4C4EF7909}.Release|x64.Build.0 = Release (8.5)|x64 76 {4FEB16E4-CC84-4969-874A-3B5260A52D70}.Debug|Win32.ActiveCfg = Debug|Win32 77 {4FEB16E4-CC84-4969-874A-3B5260A52D70}.Debug|Win32.Build.0 = Debug|Win32 78 {4FEB16E4-CC84-4969-874A-3B5260A52D70}.Debug|x64.ActiveCfg = Debug|x64 79 {4FEB16E4-CC84-4969-874A-3B5260A52D70}.Debug|x64.Build.0 = Debug|x64 80 {4FEB16E4-CC84-4969-874A-3B5260A52D70}.Release|Win32.ActiveCfg = Release|Win32 81 {4FEB16E4-CC84-4969-874A-3B5260A52D70}.Release|Win32.Build.0 = Release|Win32 82 {4FEB16E4-CC84-4969-874A-3B5260A52D70}.Release|x64.ActiveCfg = Release|x64 83 {4FEB16E4-CC84-4969-874A-3B5260A52D70}.Release|x64.Build.0 = Release|x64 74 84 EndGlobalSection 75 85 GlobalSection(SolutionProperties) = preSolution trunk/libx42pp/include/x42model.h
r462 r496 37 37 //load a model from a file 38 38 explicit model( InStream &stream, persist_flags pers_flags = persist_flags::include_everything ); 39 explicit model( const char *path, persist_flags pers_flags = persist_flags::include_everything ); 39 40 40 41 model( const model &src, persist_flags pers_flags = persist_flags::include_everything ); … … 54 55 util::heap_mem buf; 55 56 x42data_t *_x42; 57 58 void initialize( InStream &stream, persist_flags pers_flags = persist_flags::include_everything ); 56 59 }; 57 60 trunk/libx42pp/x42model.cpp
r462 r496 43 43 model::model( InStream &stream, persist_flags pers_flags ) 44 44 { 45 x42header_t hbuf, *h;46 h = x42_LoadHeaderFromStream( &hbuf, &stream ); 45 initialize( stream, pers_flags ); 46 } 47 47 48 if( !h ) 49 throw std::exception(); 50 51 size_t cb = x42_GetLoadedSize( h, pers_flags ); 52 53 if( !cb ) 54 throw std::exception(); 55 56 buf.alloc( cb ); 57 58 _x42 = x42_LoadDataFromStream( buf.ptr(), h, pers_flags, &stream ); 59 60 if( !_x42 ) 61 throw std::exception(); 48 model::model( const char *path, persist_flags pers_flags ) 49 { 50 std::fstream file( path, std::ios_base::in | std::ios_base::binary ); 51 InStream stream( file ); 52 initialize( stream, pers_flags ); 62 53 } 63 54 … … 79 70 model::~model() 80 71 { 72 } 73 74 void model::initialize( InStream &stream, persist_flags pers_flags ) 75 { 76 x42header_t hbuf, *h; 77 h = x42_LoadHeaderFromStream( &hbuf, &stream ); 78 79 if( !h ) 80 throw std::exception(); 81 82 size_t cb = x42_GetLoadedSize( h, pers_flags ); 83 84 if( !cb ) 85 throw std::exception(); 86 87 buf.alloc( cb ); 88 89 _x42 = x42_LoadDataFromStream( buf.ptr(), h, pers_flags, &stream ); 90 91 if( !_x42 ) 92 throw std::exception(); 81 93 } 82 94
