Changeset 496

Show
Ignore:
Timestamp:
01/16/08 11:38:13 (1 year ago)
Author:
phill
Message:

o Firing up an info tool.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libx42.sln

    r348 r496  
    3131                Release.AspNetCompiler.Debug = "False" 
    3232        EndProjectSection 
     33EndProject 
     34Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "x42info", "x42info\x42info.vcproj", "{4FEB16E4-CC84-4969-874A-3B5260A52D70}" 
    3335EndProject 
    3436Global 
     
    7274                {CA9895E9-4CF3-49CC-A919-3BB4C4EF7909}.Release|x64.ActiveCfg = Release (8.5)|x64 
    7375                {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 
    7484        EndGlobalSection 
    7585        GlobalSection(SolutionProperties) = preSolution 
  • trunk/libx42pp/include/x42model.h

    r462 r496  
    3737        //load a model from a file 
    3838        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 ); 
    3940 
    4041        model( const model &src, persist_flags pers_flags = persist_flags::include_everything ); 
     
    5455        util::heap_mem buf; 
    5556        x42data_t *_x42; 
     57 
     58        void initialize( InStream &stream, persist_flags pers_flags = persist_flags::include_everything );  
    5659}; 
    5760 
  • trunk/libx42pp/x42model.cpp

    r462 r496  
    4343model::model( InStream &stream, persist_flags pers_flags ) 
    4444{ 
    45         x42header_t hbuf, *h
    46         h = x42_LoadHeaderFromStream( &hbuf, &stream ); 
     45        initialize( stream, pers_flags )
     46
    4747 
    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(); 
     48model::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 ); 
    6253} 
    6354 
     
    7970model::~model() 
    8071{ 
     72} 
     73 
     74void 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(); 
    8193} 
    8294