Changeset 1154 for trunk/libffado

Show
Ignore:
Timestamp:
05/10/08 08:39:39 (16 years ago)
Author:
ppalmers
Message:

add expat based parsing of the device cache. add compile-time selection between libxml++ and expat. will allow to get rid of the libxml++ dependency on the long run. scons SERIALIZE_USE_EXPAT=0Only compile testedscons SERIALIZE_USE_EXPAT=0

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/config.h.in

    r1116 r1154  
    3737/* Define indicatin availability of lrintf() */ 
    3838#define HAVE_LRINTF $HAVE_LRINTF 
     39 
     40// serialization 
     41#define SERIALIZE_USE_EXPAT $SERIALIZE_USE_EXPAT 
    3942 
    4043// use a RT-safe message buffer for debug output 
  • trunk/libffado/SConstruct

    r1153 r1154  
    7474  this code.""", False ), 
    7575        BoolOption( "ENABLE_ALL", "Enable/Disable support for all devices.", False ), 
     76        BoolOption( "SERIALIZE_USE_EXPAT", "Use libexpat for XML serialization.", False ), 
    7677        BoolOption( "BUILD_TESTS", """\ 
    7778Build the tests in their directory. As some contain quite some functionality, 
     
    162163        log_file = "cache/" + build_base + 'config.log' ) 
    163164 
     165if env['SERIALIZE_USE_EXPAT']: 
     166        env['SERIALIZE_USE_EXPAT']=1 
     167else: 
     168        env['SERIALIZE_USE_EXPAT']=0 
     169 
    164170if not env.GetOption('clean'): 
    165171        # 
     
    182188        # 
    183189        allpresent = 1; 
     190        # for DBUS C++ bindings 
    184191        allpresent &= conf.CheckHeader( "expat.h" ) 
    185192        allpresent &= conf.CheckLib( 'expat', 'XML_ExpatVersion', '#include <expat.h>' ) 
     
    191198                'libavc1394' : '0.5.3', 
    192199                'libiec61883' : '1.1.0', 
    193                 'libxml++-2.6' : '2.13.0', 
    194200                'dbus-1' : '1.0', 
    195201                } 
     202        if not env['SERIALIZE_USE_EXPAT']: 
     203                pkgs['libxml++-2.6'] = '2.13.0' 
     204 
    196205        for pkg in pkgs: 
    197206                name2 = pkg.replace("+","").replace(".","").replace("-","").upper() 
  • trunk/libffado/src/bebob/bebob_avdevice.cpp

    r1066 r1154  
    380380 
    381381bool 
    382 AvDevice::serialize( Glib::ustring basePath, 
     382AvDevice::serialize( std::string basePath, 
    383383                     Util::IOSerialize& ser ) const 
    384384{ 
     
    389389 
    390390bool 
    391 AvDevice::deserialize( Glib::ustring basePath, 
     391AvDevice::deserialize( std::string basePath, 
    392392                       Util::IODeserialize& deser ) 
    393393{ 
     
    397397} 
    398398 
    399 Glib::ustring 
     399std::string 
    400400AvDevice::getCachePath() 
    401401{ 
    402     Glib::ustring cachePath; 
     402    std::string cachePath; 
    403403    char* pCachePath; 
    404404 
     
    422422AvDevice::loadFromCache() 
    423423{ 
    424     Glib::ustring sDevicePath = getCachePath() + getConfigRom().getGuidString(); 
     424    std::string sDevicePath = getCachePath() + getConfigRom().getGuidString(); 
    425425 
    426426    char* configId; 
     
    431431    } 
    432432 
    433     Glib::ustring sFileName = sDevicePath + "/" + configId + ".xml"; 
     433    std::string sFileName = sDevicePath + "/" + configId + ".xml"; 
    434434    free( configId ); 
    435435    debugOutput( DEBUG_LEVEL_NORMAL, "filename %s\n", sFileName.c_str() ); 
  • trunk/libffado/src/bebob/bebob_avdevice.h

    r864 r1154  
    9090 
    9191public: 
    92     virtual bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const; 
    93     virtual bool deserialize( Glib::ustring basePath, Util::IODeserialize& deser ); 
     92    virtual bool serialize( std::string basePath, Util::IOSerialize& ser ) const; 
     93    virtual bool deserialize( std::string basePath, Util::IODeserialize& deser ); 
    9494 
    9595    int getConfigurationIdSampleRate(); 
     
    9898    int getConfigurationId(); 
    9999 
    100     Glib::ustring getCachePath(); 
     100    std::string getCachePath(); 
    101101 
    102102protected: 
  • trunk/libffado/src/bebob/bebob_avdevice_subunit.cpp

    r1110 r1154  
    339339 
    340340bool 
    341 BeBoB::SubunitAudio::serializeChild( Glib::ustring basePath, 
     341BeBoB::SubunitAudio::serializeChild( std::string basePath, 
    342342                                     Util::IOSerialize& ser ) const 
    343343{ 
     
    362362 
    363363bool 
    364 BeBoB::SubunitAudio::deserializeChild( Glib::ustring basePath, 
     364BeBoB::SubunitAudio::deserializeChild( std::string basePath, 
    365365                                       Util::IODeserialize& deser, 
    366366                                       AVC::Unit& avDevice ) 
     
    387387 
    388388bool 
    389 BeBoB::SubunitAudio::deserializeUpdateChild( Glib::ustring basePath, 
     389BeBoB::SubunitAudio::deserializeUpdateChild( std::string basePath, 
    390390                                             Util::IODeserialize& deser ) 
    391391{ 
     
    467467 
    468468bool 
    469 BeBoB::SubunitMusic::serializeChild( Glib::ustring basePath, 
     469BeBoB::SubunitMusic::serializeChild( std::string basePath, 
    470470                                             Util::IOSerialize& ser ) const 
    471471{ 
     
    474474 
    475475bool 
    476 BeBoB::SubunitMusic::deserializeChild( Glib::ustring basePath, 
     476BeBoB::SubunitMusic::deserializeChild( std::string basePath, 
    477477                                               Util::IODeserialize& deser, 
    478478                                               AVC::Unit& avDevice ) 
     
    482482 
    483483bool  
    484 BeBoB::SubunitMusic::deserializeUpdateChild( Glib::ustring basePath, 
     484BeBoB::SubunitMusic::deserializeUpdateChild( std::string basePath, 
    485485                                             Util::IODeserialize& deser ) 
    486486{ 
  • trunk/libffado/src/bebob/bebob_avdevice_subunit.h

    r1110 r1154  
    7777        AVC::function_block_special_purpose_t specialPurpose ); 
    7878 
    79     virtual bool serializeChild( Glib::ustring basePath, 
     79    virtual bool serializeChild( std::string basePath, 
    8080                                 Util::IOSerialize& ser ) const; 
    81     virtual bool deserializeChild( Glib::ustring basePath, 
     81    virtual bool deserializeChild( std::string basePath, 
    8282                                   Util::IODeserialize& deser, 
    8383                                   AVC::Unit& unit ); 
    84     virtual bool deserializeUpdateChild( Glib::ustring basePath, 
     84    virtual bool deserializeUpdateChild( std::string basePath, 
    8585                                         Util::IODeserialize& deser ); 
    8686 
     
    112112 
    113113protected: 
    114     virtual bool serializeChild( Glib::ustring basePath, 
     114    virtual bool serializeChild( std::string basePath, 
    115115                                 Util::IOSerialize& ser ) const; 
    116     virtual bool deserializeChild( Glib::ustring basePath, 
     116    virtual bool deserializeChild( std::string basePath, 
    117117                                   Util::IODeserialize& deser, 
    118118                                   AVC::Unit& unit ); 
    119     virtual bool deserializeUpdateChild( Glib::ustring basePath, 
     119    virtual bool deserializeUpdateChild( std::string basePath, 
    120120                                         Util::IODeserialize& deser ); 
    121121 
  • trunk/libffado/src/bebob/bebob_avplug.h

    r864 r1154  
    3636 
    3737#include "debugmodule/debugmodule.h" 
    38  
    39 #include <glibmm/ustring.h> 
    4038 
    4139class Ieee1394Service; 
  • trunk/libffado/src/bebob/bebob_functionblock.cpp

    r1110 r1154  
    162162 
    163163bool 
    164 FunctionBlock::serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const 
     164FunctionBlock::serialize( std::string basePath, Util::IOSerialize& ser ) const 
    165165{ 
    166166    bool result; 
     
    178178 
    179179FunctionBlock* 
    180 FunctionBlock::deserialize( Glib::ustring basePath, 
     180FunctionBlock::deserialize( std::string basePath, 
    181181                            Util::IODeserialize& deser, 
    182182                            AVC::Unit& unit, 
     
    241241 
    242242bool  
    243 FunctionBlock::deserializeUpdate( Glib::ustring basePath, 
     243FunctionBlock::deserializeUpdate( std::string basePath, 
    244244                                  Util::IODeserialize& deser ) 
    245245{ 
     
    293293 
    294294bool 
    295 FunctionBlockSelector::serializeChild( Glib::ustring basePath, 
     295FunctionBlockSelector::serializeChild( std::string basePath, 
    296296                                       Util::IOSerialize& ser ) const 
    297297{ 
     
    300300 
    301301bool 
    302 FunctionBlockSelector::deserializeChild( Glib::ustring basePath, 
     302FunctionBlockSelector::deserializeChild( std::string basePath, 
    303303                                         Util::IODeserialize& deser, 
    304304                                         AvDevice& unit ) 
     
    349349 
    350350bool 
    351 FunctionBlockFeature::serializeChild( Glib::ustring basePath, 
     351FunctionBlockFeature::serializeChild( std::string basePath, 
    352352                                      Util::IOSerialize& ser ) const 
    353353{ 
     
    356356 
    357357bool 
    358 FunctionBlockFeature::deserializeChild( Glib::ustring basePath, 
     358FunctionBlockFeature::deserializeChild( std::string basePath, 
    359359                                        Util::IODeserialize& deser, 
    360360                                        AvDevice& unit ) 
     
    452452 
    453453bool 
    454 FunctionBlockEnhancedMixer::serializeChild( Glib::ustring basePath, 
     454FunctionBlockEnhancedMixer::serializeChild( std::string basePath, 
    455455                                            Util::IOSerialize& ser ) const 
    456456{ 
     
    459459 
    460460bool 
    461 FunctionBlockEnhancedMixer::deserializeChild( Glib::ustring basePath, 
     461FunctionBlockEnhancedMixer::deserializeChild( std::string basePath, 
    462462                                              Util::IODeserialize& deser, 
    463463                                              AvDevice& unit ) 
     
    508508 
    509509bool 
    510 FunctionBlockProcessing::serializeChild( Glib::ustring basePath, 
     510FunctionBlockProcessing::serializeChild( std::string basePath, 
    511511                                         Util::IOSerialize& ser ) const 
    512512{ 
     
    515515 
    516516bool 
    517 FunctionBlockProcessing::deserializeChild( Glib::ustring basePath, 
     517FunctionBlockProcessing::deserializeChild( std::string basePath, 
    518518                                           Util::IODeserialize& deser, 
    519519                                           AvDevice& unit ) 
     
    563563 
    564564bool 
    565 FunctionBlockCodec::serializeChild( Glib::ustring basePath, 
     565FunctionBlockCodec::serializeChild( std::string basePath, 
    566566                                    Util::IOSerialize& ser ) const 
    567567{ 
     
    570570 
    571571bool 
    572 FunctionBlockCodec::deserializeChild( Glib::ustring basePath, 
     572FunctionBlockCodec::deserializeChild( std::string basePath, 
    573573                                      Util::IODeserialize& deser, 
    574574                                      AvDevice& unit ) 
  • trunk/libffado/src/bebob/bebob_functionblock.h

    r1110 r1154  
    3030 
    3131#include "debugmodule/debugmodule.h" 
     32 
     33#include <string> 
    3234 
    3335namespace AVC { 
     
    7779    AVC::no_of_output_plugs_t getNrOfOutputPlugs() {return m_nrOfOutputPlugs;}; 
    7880 
    79     bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const; 
    80  
    81     static FunctionBlock* deserialize( Glib::ustring basePath, 
     81    bool serialize( std::string basePath, Util::IOSerialize& ser ) const; 
     82 
     83    static FunctionBlock* deserialize( std::string basePath, 
    8284                                       Util::IODeserialize& deser, 
    8385                                       AVC::Unit& unit, 
    8486                                       AVC::Subunit& subunit ); 
    85     bool deserializeUpdate( Glib::ustring basePath, 
     87    bool deserializeUpdate( std::string basePath, 
    8688                            Util::IODeserialize& deser ); 
    8789protected: 
     
    124126 
    125127protected: 
    126     virtual bool serializeChild( Glib::ustring basePath, 
    127                                  Util::IOSerialize& ser ) const; 
    128     virtual bool deserializeChild( Glib::ustring basePath, 
     128    virtual bool serializeChild( std::string basePath, 
     129                                 Util::IOSerialize& ser ) const; 
     130    virtual bool deserializeChild( std::string basePath, 
    129131                                   Util::IODeserialize& deser, 
    130132                                   AvDevice& avDevice ); 
     
    166168 
    167169protected: 
    168     virtual bool serializeChild( Glib::ustring basePath, 
    169                                  Util::IOSerialize& ser ) const; 
    170     virtual bool deserializeChild( Glib::ustring basePath, 
     170    virtual bool serializeChild( std::string basePath, 
     171                                 Util::IOSerialize& ser ) const; 
     172    virtual bool deserializeChild( std::string basePath, 
    171173                                   Util::IODeserialize& deser, 
    172174                                   AvDevice& avDevice ); 
     
    193195 
    194196protected: 
    195     virtual bool serializeChild( Glib::ustring basePath, 
    196                                  Util::IOSerialize& ser ) const; 
    197     virtual bool deserializeChild( Glib::ustring basePath, 
     197    virtual bool serializeChild( std::string basePath, 
     198                                 Util::IOSerialize& ser ) const; 
     199    virtual bool deserializeChild( std::string basePath, 
    198200                                   Util::IODeserialize& deser, 
    199201                                   AvDevice& avDevice ); 
     
    218220 
    219221protected: 
    220     virtual bool serializeChild( Glib::ustring basePath, 
    221                                  Util::IOSerialize& ser ) const; 
    222     virtual bool deserializeChild( Glib::ustring basePath, 
     222    virtual bool serializeChild( std::string basePath, 
     223                                 Util::IOSerialize& ser ) const; 
     224    virtual bool deserializeChild( std::string basePath, 
    223225                                   Util::IODeserialize& deser, 
    224226                                   AvDevice& avDevice ); 
     
    243245 
    244246protected: 
    245     virtual bool serializeChild( Glib::ustring basePath, 
    246                                  Util::IOSerialize& ser ) const; 
    247     virtual bool deserializeChild( Glib::ustring basePath, 
     247    virtual bool serializeChild( std::string basePath, 
     248                                 Util::IOSerialize& ser ) const; 
     249    virtual bool deserializeChild( std::string basePath, 
    248250                                   Util::IODeserialize& deser, 
    249251                                   AvDevice& avDevice ); 
  • trunk/libffado/src/devicemanager.h

    r967 r1154  
    3535#include "libutil/OptionContainer.h" 
    3636#include "libcontrol/BasicElements.h" 
    37  
    38 #include <glibmm/ustring.h> 
    3937 
    4038#include "libutil/Functors.h" 
  • trunk/libffado/src/genericavc/avc_avdevice.cpp

    r1135 r1154  
    754754 
    755755bool 
    756 AvDevice::serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const 
     756AvDevice::serialize( std::string basePath, Util::IOSerialize& ser ) const 
    757757{ 
    758758    bool result; 
     
    763763 
    764764bool 
    765 AvDevice::deserialize( Glib::ustring basePath, Util::IODeserialize& deser ) 
     765AvDevice::deserialize( std::string basePath, Util::IODeserialize& deser ) 
    766766{ 
    767767    bool result; 
  • trunk/libffado/src/genericavc/avc_avdevice.h

    r864 r1154  
    5555    static FFADODevice * createDevice( DeviceManager& d, std::auto_ptr<ConfigRom>( configRom )); 
    5656 
    57     virtual bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const; 
    58     virtual bool deserialize( Glib::ustring basePath, Util::IODeserialize& deser ); 
     57    virtual bool serialize( std::string basePath, Util::IOSerialize& ser ) const; 
     58    virtual bool deserialize( std::string basePath, Util::IODeserialize& deser ); 
    5959 
    6060    virtual void setVerboseLevel(int l); 
  • trunk/libffado/src/libavc/audiosubunit/avc_audiosubunit.h

    r1110 r1154  
    5151 
    5252protected: 
    53     virtual bool serializeChild( Glib::ustring basePath, 
     53    virtual bool serializeChild( std::string basePath, 
    5454                                 Util::IOSerialize& ser ) const { return true; } 
    55     virtual bool deserializeChild( Glib::ustring basePath, 
     55    virtual bool deserializeChild( std::string basePath, 
    5656                                   Util::IODeserialize& deser, 
    5757                                   Unit& avDevice ) { return true; } 
    58     virtual bool deserializeUpdateChild( Glib::ustring basePath, 
     58    virtual bool deserializeUpdateChild( std::string basePath, 
    5959                                         Util::IODeserialize& deser ) { return true; } 
    6060 
  • trunk/libffado/src/libavc/general/avc_plug.cpp

    r1110 r1154  
    14281428 
    14291429bool 
    1430 Plug::serializeChannelInfos( Glib::ustring basePath, 
     1430Plug::serializeChannelInfos( std::string basePath, 
    14311431                             Util::IOSerialize& ser, 
    14321432                             const ClusterInfo& clusterInfo ) const 
     
    14521452 
    14531453bool 
    1454 Plug::deserializeChannelInfos( Glib::ustring basePath, 
     1454Plug::deserializeChannelInfos( std::string basePath, 
    14551455                               Util::IODeserialize& deser, 
    14561456                               ClusterInfo& clusterInfo ) 
     
    14881488 
    14891489bool 
    1490 Plug::serializeClusterInfos( Glib::ustring basePath, 
     1490Plug::serializeClusterInfos( std::string basePath, 
    14911491                             Util::IOSerialize& ser ) const 
    14921492{ 
     
    15141514 
    15151515bool 
    1516 Plug::deserializeClusterInfos( Glib::ustring basePath, 
     1516Plug::deserializeClusterInfos( std::string basePath, 
    15171517                               Util::IODeserialize& deser ) 
    15181518{ 
     
    15521552 
    15531553bool 
    1554 Plug::serializeFormatInfos( Glib::ustring basePath, 
     1554Plug::serializeFormatInfos( std::string basePath, 
    15551555                            Util::IOSerialize& ser ) const 
    15561556{ 
     
    15761576 
    15771577bool 
    1578 Plug::deserializeFormatInfos( Glib::ustring basePath, 
     1578Plug::deserializeFormatInfos( std::string basePath, 
    15791579                              Util::IODeserialize& deser ) 
    15801580{ 
     
    16121612 
    16131613bool 
    1614 Plug::serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const 
     1614Plug::serialize( std::string basePath, Util::IOSerialize& ser ) const 
    16151615{ 
    16161616    bool result=true; 
     
    16371637 
    16381638Plug* 
    1639 Plug::deserialize( Glib::ustring basePath, 
     1639Plug::deserialize( std::string basePath, 
    16401640                   Util::IODeserialize& deser, 
    16411641                   Unit& unit, 
     
    16921692 
    16931693bool 
    1694 Plug::deserializeConnections( Glib::ustring basePath, 
     1694Plug::deserializeConnections( std::string basePath, 
    16951695                              Util::IODeserialize& deser ) 
    16961696{ 
     
    21512151 
    21522152bool 
    2153 PlugManager::serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const 
     2153PlugManager::serialize( std::string basePath, Util::IOSerialize& ser ) const 
    21542154{ 
    21552155    bool result = true; 
     
    21702170 
    21712171PlugManager* 
    2172 PlugManager::deserialize( Glib::ustring basePath, 
     2172PlugManager::deserialize( std::string basePath, 
    21732173                          Util::IODeserialize& deser, 
    21742174                          Unit& unit ) 
     
    22022202 
    22032203bool 
    2204 PlugManager::deserializeUpdate( Glib::ustring basePath, 
     2204PlugManager::deserializeUpdate( std::string basePath, 
    22052205                                Util::IODeserialize& deser) 
    22062206{ 
     
    22392239 
    22402240bool 
    2241 PlugConnection::serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const 
     2241PlugConnection::serialize( std::string basePath, Util::IOSerialize& ser ) const 
    22422242{ 
    22432243    bool result; 
     
    22482248 
    22492249PlugConnection* 
    2250 PlugConnection::deserialize( Glib::ustring basePath, 
     2250PlugConnection::deserialize( std::string basePath, 
    22512251                               Util::IODeserialize& deser, 
    22522252                               Unit& unit ) 
     
    23582358 
    23592359bool 
    2360 serializePlugVector( Glib::ustring basePath, 
     2360serializePlugVector( std::string basePath, 
    23612361                     Util::IOSerialize& ser, 
    23622362                     const PlugVector& vec) 
     
    23792379 
    23802380bool 
    2381 deserializePlugVector( Glib::ustring basePath, 
     2381deserializePlugVector( std::string basePath, 
    23822382                       Util::IODeserialize& deser, 
    23832383                       const PlugManager& plugManager, 
  • trunk/libffado/src/libavc/general/avc_plug.h

    r864 r1154  
    3535#include "debugmodule/debugmodule.h" 
    3636 
    37 #include <glibmm/ustring.h
     37#include <string
    3838 
    3939class Ieee1394Service; 
     
    155155    void showPlug() const; 
    156156 
    157     bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const; 
    158     static Plug* deserialize( Glib::ustring basePath, 
     157    bool serialize( std::string basePath, Util::IOSerialize& ser ) const; 
     158    static Plug* deserialize( std::string basePath, 
    159159                              Util::IODeserialize& deser, 
    160160                              Unit& avDevice, 
    161161                              PlugManager& plugManager ); 
    162     bool deserializeConnections( Glib::ustring basePath,  
     162    bool deserializeConnections( std::string basePath,  
    163163                                 Util::IODeserialize& deser ); 
    164164    bool deserializeUpdateSubunit(); 
     
    168168        stream_position_t          m_streamPosition; 
    169169        stream_position_location_t m_location; 
    170         Glib::ustring              m_name; 
     170        std::string              m_name; 
    171171    }; 
    172172    typedef std::vector<ChannelInfo> ChannelInfoVector; 
     
    175175        int                 m_index; 
    176176        port_type_t         m_portType; 
    177         Glib::ustring       m_name; 
     177        std::string         m_name; 
    178178 
    179179        nr_of_channels_t    m_nrOfChannels; 
     
    240240    const ClusterInfo* getClusterInfoByIndex( int index ) const; 
    241241 
    242     bool serializeChannelInfos( Glib::ustring basePath, 
     242    bool serializeChannelInfos( std::string basePath, 
    243243                                Util::IOSerialize& ser, 
    244244                                const ClusterInfo& clusterInfo ) const; 
    245     bool deserializeChannelInfos( Glib::ustring basePath, 
     245    bool deserializeChannelInfos( std::string basePath, 
    246246                                  Util::IODeserialize& deser, 
    247247                                  ClusterInfo& clusterInfo ); 
    248248 
    249     bool serializeClusterInfos( Glib::ustring basePath, 
     249    bool serializeClusterInfos( std::string basePath, 
    250250                                Util::IOSerialize& ser ) const; 
    251     bool deserializeClusterInfos( Glib::ustring basePath, 
     251    bool deserializeClusterInfos( std::string basePath, 
    252252                                  Util::IODeserialize& deser ); 
    253253 
    254     bool serializeFormatInfos( Glib::ustring basePath, 
     254    bool serializeFormatInfos( std::string basePath, 
    255255                               Util::IOSerialize& ser ) const; 
    256     bool deserializeFormatInfos( Glib::ustring basePath, 
     256    bool deserializeFormatInfos( std::string basePath, 
    257257                                 Util::IODeserialize& deser ); 
    258258 
     
    287287    EPlugType                   m_infoPlugType; 
    288288    nr_of_channels_t            m_nrOfChannels; 
    289     Glib::ustring               m_name; 
     289    std::string                 m_name; 
    290290    ClusterInfoVector           m_clusterInfos; 
    291291    sampling_frequency_t        m_samplingFrequency; 
     
    334334                               Plug::EPlugType type) const; 
    335335 
    336     bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const; 
    337     static  PlugManager* deserialize( Glib::ustring basePath, 
     336    bool serialize( std::string basePath, Util::IOSerialize& ser ) const; 
     337    static  PlugManager* deserialize( std::string basePath, 
    338338                                      Util::IODeserialize& deser, 
    339339                                      Unit& avDevice ); 
     
    343343    bool tidyPlugConnections(PlugConnectionVector&); 
    344344 
    345     bool deserializeUpdate( Glib::ustring basePath,   
     345    bool deserializeUpdate( std::string basePath,   
    346346                            Util::IODeserialize& deser ); 
    347347 
     
    362362        { return *m_destPlug; } 
    363363 
    364     bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const; 
    365     static PlugConnection* deserialize( Glib::ustring basePath, 
     364    bool serialize( std::string basePath, Util::IOSerialize& ser ) const; 
     365    static PlugConnection* deserialize( std::string basePath, 
    366366                                        Util::IODeserialize& deser, 
    367367                                        Unit& avDevice ); 
     
    377377 
    378378 
    379 bool serializePlugVector( Glib::ustring basePath, 
     379bool serializePlugVector( std::string basePath, 
    380380                          Util::IOSerialize& ser, 
    381381                          const PlugVector& vec); 
    382382 
    383 bool deserializePlugVector( Glib::ustring basePath, 
     383bool deserializePlugVector( std::string basePath, 
    384384                            Util::IODeserialize& deser, 
    385385                            const PlugManager& plugManager, 
  • trunk/libffado/src/libavc/general/avc_subunit.cpp

    r1110 r1154  
    231231 
    232232bool 
    233 Subunit::serialize( Glib::ustring basePath, 
     233Subunit::serialize( std::string basePath, 
    234234                    Util::IOSerialize& ser ) const 
    235235{ 
     
    245245 
    246246Subunit* 
    247 Subunit::deserialize( Glib::ustring basePath, 
     247Subunit::deserialize( std::string basePath, 
    248248                      Util::IODeserialize& deser, 
    249249                      Unit& unit ) 
     
    278278 
    279279bool 
    280 Subunit::deserializeUpdate( Glib::ustring basePath, 
     280Subunit::deserializeUpdate( std::string basePath, 
    281281                            Util::IODeserialize& deser ) 
    282282{ 
  • trunk/libffado/src/libavc/general/avc_subunit.h

    r1110 r1154  
    7878    virtual void setVerboseLevel(int l); 
    7979 
    80     bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const; 
    81     static Subunit* deserialize( Glib::ustring basePath, 
     80    bool serialize( std::string basePath, Util::IOSerialize& ser ) const; 
     81    static Subunit* deserialize( std::string basePath, 
    8282                                 Util::IODeserialize& deser, Unit& avDevice ); 
    83     bool deserializeUpdate( Glib::ustring basePath, 
     83    bool deserializeUpdate( std::string basePath, 
    8484                            Util::IODeserialize& deser ); 
    8585 
     
    8787    Subunit(); 
    8888 
    89     virtual bool serializeChild( Glib::ustring basePath, 
     89    virtual bool serializeChild( std::string basePath, 
    9090                                 Util::IOSerialize& ser ) const = 0; 
    91     virtual bool deserializeChild( Glib::ustring basePath, 
     91    virtual bool deserializeChild( std::string basePath, 
    9292                                   Util::IODeserialize& deser, 
    9393                                   Unit& avDevice ) = 0; 
    94     virtual bool deserializeUpdateChild( Glib::ustring basePath, 
     94    virtual bool deserializeUpdateChild( std::string basePath, 
    9595                                         Util::IODeserialize& deser ) = 0; 
    9696 
  • trunk/libffado/src/libavc/general/avc_unit.cpp

    r1110 r1154  
    845845template <typename T> 
    846846bool 
    847 serializeVector( Glib::ustring path, 
     847serializeVector( std::string path, 
    848848                 Util::IOSerialize& ser, 
    849849                 const T& vec ) 
     
    862862template <typename T, typename VT> 
    863863bool 
    864 deserializeVector( Glib::ustring path, 
     864deserializeVector( std::string path, 
    865865                   Util::IODeserialize& deser, 
    866866                   Unit& unit, 
     
    885885 
    886886bool 
    887 Unit::serializeSyncInfoVector( Glib::ustring basePath, 
     887Unit::serializeSyncInfoVector( std::string basePath, 
    888888                               Util::IOSerialize& ser, 
    889889                               const SyncInfoVector& vec ) const 
     
    903903        result &= ser.write( strstrm.str() + "m_source", info.m_source->getGlobalId() ); 
    904904        result &= ser.write( strstrm.str() + "m_destination", info.m_destination->getGlobalId() ); 
    905         result &= ser.write( strstrm.str() + "m_description", Glib::ustring( info.m_description ) ); 
     905        result &= ser.write( strstrm.str() + "m_description", std::string( info.m_description ) ); 
    906906 
    907907        i++; 
     
    912912 
    913913bool 
    914 Unit::deserializeSyncInfoVector( Glib::ustring basePath, 
     914Unit::deserializeSyncInfoVector( std::string basePath, 
    915915                                 Util::IODeserialize& deser, 
    916916                                 SyncInfoVector& vec ) 
     
    925925        plug_id_t sourceId; 
    926926        plug_id_t destinationId; 
    927         Glib::ustring description; 
     927        std::string description; 
    928928 
    929929        if ( deser.isExisting( strstrm.str() + "m_source" ) ) { 
     
    952952 
    953953bool 
    954 Unit::serialize( Glib::ustring basePath, 
     954Unit::serialize( std::string basePath, 
    955955                 Util::IOSerialize& ser ) const 
    956956{ 
     
    980980 
    981981bool 
    982 Unit::deserialize( Glib::ustring basePath, 
     982Unit::deserialize( std::string basePath, 
    983983                   Util::IODeserialize& deser ) 
    984984{ 
  • trunk/libffado/src/libavc/general/avc_unit.h

    r864 r1154  
    9393    virtual bool setActiveSync( const SyncInfo& syncInfo ); 
    9494 
    95     virtual bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const; 
    96     virtual bool deserialize( Glib::ustring basePath, Util::IODeserialize& deser ); 
     95    virtual bool serialize( std::string basePath, Util::IOSerialize& ser ) const; 
     96    virtual bool deserialize( std::string basePath, Util::IODeserialize& deser ); 
    9797 
    9898    SubunitAudio* getAudioSubunit( subunit_id_t subunitId ) 
     
    152152 
    153153 
    154     bool serializeSyncInfoVector( Glib::ustring basePath, 
     154    bool serializeSyncInfoVector( std::string basePath, 
    155155                                  Util::IOSerialize& ser, 
    156156                                  const SyncInfoVector& vec ) const; 
    157     bool deserializeSyncInfoVector( Glib::ustring basePath, 
     157    bool deserializeSyncInfoVector( std::string basePath, 
    158158                                    Util::IODeserialize& deser, 
    159159                                    SyncInfoVector& vec ); 
  • trunk/libffado/src/libavc/musicsubunit/avc_musicsubunit.cpp

    r1110 r1154  
    304304 
    305305bool 
    306 SubunitMusic::serializeChild( Glib::ustring basePath, 
     306SubunitMusic::serializeChild( std::string basePath, 
    307307                              Util::IOSerialize& ser ) const 
    308308{ 
     
    311311 
    312312bool 
    313 SubunitMusic::deserializeChild( Glib::ustring basePath, 
     313SubunitMusic::deserializeChild( std::string basePath, 
    314314                                Util::IODeserialize& deser, 
    315315                                Unit& unit ) 
     
    319319 
    320320bool 
    321 SubunitMusic::deserializeUpdateChild( Glib::ustring basePath, 
     321SubunitMusic::deserializeUpdateChild( std::string basePath, 
    322322                                      Util::IODeserialize& deser ) 
    323323{ 
  • trunk/libffado/src/libavc/musicsubunit/avc_musicsubunit.h

    r1110 r1154  
    5454    virtual const char* getName(); 
    5555protected: 
    56     virtual bool serializeChild( Glib::ustring basePath, 
     56    virtual bool serializeChild( std::string basePath, 
    5757                                 Util::IOSerialize& ser ) const; 
    58     virtual bool deserializeChild( Glib::ustring basePath, 
     58    virtual bool deserializeChild( std::string basePath, 
    5959                                   Util::IODeserialize& deser, 
    6060                                   Unit& avDevice ); 
    61     virtual bool deserializeUpdateChild( Glib::ustring basePath, 
     61    virtual bool deserializeUpdateChild( std::string basePath, 
    6262                                         Util::IODeserialize& deser ); 
    6363 
  • trunk/libffado/src/libieee1394/configrom.cpp

    r1073 r1154  
    398398} 
    399399 
    400 const Glib::ustring 
     400const std::string 
    401401ConfigRom::getGuidString() const 
    402402{ 
     
    405405              ( unsigned int ) ( getGuid() >> 32 ), 
    406406              ( unsigned int ) ( getGuid() & 0xffffffff ) ); 
    407     Glib::ustring result = buf; 
     407    std::string result = buf; 
    408408    free( buf ); 
    409409    return result; 
    410410} 
    411411  
    412 const Glib::ustring 
     412const std::string 
    413413ConfigRom::getModelName() const 
    414414{ 
     
    439439} 
    440440 
    441 const Glib::ustring 
     441const std::string 
    442442ConfigRom::getVendorName() const 
    443443{ 
     
    599599 
    600600bool 
    601 ConfigRom::serialize( Glib::ustring path, Util::IOSerialize& ser ) 
     601ConfigRom::serialize( std::string path, Util::IOSerialize& ser ) 
    602602{ 
    603603    bool result; 
     
    605605    result &= ser.write( path + "m_avcDevice",  m_avcDevice ); 
    606606    result &= ser.write( path + "m_guid", m_guid ); 
    607     result &= ser.write( path + "m_vendorName", Glib::ustring( m_vendorName ) ); 
    608     result &= ser.write( path + "m_modelName", Glib::ustring( m_modelName ) ); 
     607    result &= ser.write( path + "m_vendorName", std::string( m_vendorName ) ); 
     608    result &= ser.write( path + "m_modelName", std::string( m_modelName ) ); 
    609609    result &= ser.write( path + "m_vendorId", m_vendorId ); 
    610610    result &= ser.write( path + "m_modelId", m_modelId ); 
     
    624624 
    625625ConfigRom* 
    626 ConfigRom::deserialize( Glib::ustring path, Util::IODeserialize& deser, Ieee1394Service& ieee1394Service ) 
     626ConfigRom::deserialize( std::string path, Util::IODeserialize& deser, Ieee1394Service& ieee1394Service ) 
    627627{ 
    628628    ConfigRom* pConfigRom = new ConfigRom; 
  • trunk/libffado/src/libieee1394/configrom.h

    r898 r1154  
    5454    const fb_nodeid_t getNodeId() const; 
    5555    const fb_octlet_t getGuid() const; 
    56     const Glib::ustring getGuidString() const; 
    57     const Glib::ustring getModelName() const; 
    58     const Glib::ustring getVendorName() const; 
     56    const std::string getGuidString() const; 
     57    const std::string getModelName() const; 
     58    const std::string getVendorName() const; 
    5959 
    6060    const unsigned int getModelId() const; 
     
    100100    static bool compareGUID(  const ConfigRom& a, const ConfigRom& b ); 
    101101 
    102     bool serialize( Glib::ustring path, Util::IOSerialize& ser ); 
    103     static ConfigRom* deserialize( Glib::ustring path, 
     102    bool serialize( std::string path, Util::IOSerialize& ser ); 
     103    static ConfigRom* deserialize( std::string path, 
    104104                   Util::IODeserialize& deser, 
    105105                   Ieee1394Service& ieee1394Service ); 
     
    123123    bool             m_avcDevice; 
    124124    fb_octlet_t      m_guid; 
    125     Glib::ustring    m_vendorName; 
    126     Glib::ustring    m_modelName; 
     125    std::string    m_vendorName; 
     126    std::string    m_modelName; 
    127127    unsigned int     m_vendorId; 
    128128    unsigned int     m_modelId; 
  • trunk/libffado/src/libutil/OptionContainer.cpp

    r864 r1154  
    108108 
    109109bool 
    110 OptionContainer::Option::serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const 
     110OptionContainer::Option::serialize( std::string basePath, Util::IOSerialize& ser ) const 
    111111{ 
    112112    bool result; 
    113     result  = ser.write( basePath + "m_Name", Glib::ustring(m_Name) ); 
    114     result &= ser.write( basePath + "m_stringValue", Glib::ustring(m_stringValue) ); 
     113    result  = ser.write( basePath + "m_Name", std::string(m_Name) ); 
     114    result &= ser.write( basePath + "m_stringValue", std::string(m_stringValue) ); 
    115115    result &= ser.write( basePath + "m_boolValue", m_boolValue ); 
    116116    result &= ser.write( basePath + "m_doubleValue", m_doubleValue ); 
     
    124124 
    125125OptionContainer::Option 
    126 OptionContainer::Option::deserialize( Glib::ustring basePath, 
     126OptionContainer::Option::deserialize( std::string basePath, 
    127127                     Util::IODeserialize& deser ) 
    128128{ 
    129129    bool result; 
    130130    Option op=Option(); 
    131     Glib::ustring tmpstr; 
     131    std::string tmpstr; 
    132132 
    133133    result  = deser.read( basePath + "m_Name", tmpstr ); 
     
    412412 
    413413bool 
    414 OptionContainer::serializeOptions( Glib::ustring basePath, 
     414OptionContainer::serializeOptions( std::string basePath, 
    415415                                   Util::IOSerialize& ser) const 
    416416{ 
     
    434434 
    435435bool 
    436 OptionContainer::deserializeOptions( Glib::ustring basePath, 
     436OptionContainer::deserializeOptions( std::string basePath, 
    437437                                     Util::IODeserialize& deser, 
    438438                                     OptionContainer& container) 
  • trunk/libffado/src/libutil/OptionContainer.h

    r864 r1154  
    7474 
    7575    public: // serialization support 
    76         bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const; 
    77         static Option deserialize( Glib::ustring basePath, 
     76        bool serialize( std::string basePath, Util::IOSerialize& ser ) const; 
     77        static Option deserialize( std::string basePath, 
    7878                                    Util::IODeserialize& deser); 
    7979    private: 
     
    153153 
    154154protected: // serialization support 
    155     bool serializeOptions( Glib::ustring basePath, 
     155    bool serializeOptions( std::string basePath, 
    156156                           Util::IOSerialize& ser) const; 
    157     static bool deserializeOptions( Glib::ustring basePath, 
     157    static bool deserializeOptions( std::string basePath, 
    158158                                    Util::IODeserialize& deser, 
    159159                                    OptionContainer& container); 
  • trunk/libffado/src/libutil/serialize_expat.cpp

    r864 r1154  
    11/* 
    22 * Copyright (C) 2005-2008 by Daniel Wagner 
     3 * Copyright (C) 2005-2008 by Pieter Palmers 
    34 * 
    45 * This file is part of FFADO 
     
    3132IMPL_DEBUG_MODULE( Util::XMLDeserialize, XMLDeserialize, DEBUG_LEVEL_NORMAL ); 
    3233 
    33 Util::XMLSerialize::XMLSerialize( Glib::ustring fileName ) 
     34Util::XMLSerialize::XMLSerialize( std::string fileName ) 
    3435    : IOSerialize() 
    3536    , m_filepath( fileName ) 
     
    4546} 
    4647 
    47 Util::XMLSerialize::XMLSerialize( Glib::ustring fileName, int verboseLevel ) 
     48Util::XMLSerialize::XMLSerialize( std::string fileName, int verboseLevel ) 
    4849    : IOSerialize() 
    4950    , m_filepath( fileName ) 
     
    7273Util::XMLSerialize::writeVersion() 
    7374{ 
    74     xmlpp::Node* pNode = m_doc.get_root_node(); 
    75     xmlpp::Element* pElem = pNode->add_child( "CacheVersion" ); 
    76     char* valstr; 
    77     asprintf( &valstr, "%s", CACHE_VERSION ); 
    78     pElem->set_child_text( valstr ); 
    79     free( valstr ); 
     75    Xml::Node* pNode = m_doc.get_root_node(); 
     76    if(pNode) { 
     77        char* valstr; 
     78        asprintf( &valstr, "%s", CACHE_VERSION ); 
     79 
     80        // check whether we already have a version node 
     81        Xml::Nodes versionfields = (*pNode)["CacheVersion"]; 
     82 
     83        if(versionfields.size()) { // set the value 
     84            versionfields.at(0)->set_child_text( valstr ); 
     85        } else { 
     86            // make a new field 
     87            Xml::Node &n = pNode->add( Xml::Node("CacheVersion", NULL) ); 
     88            n.set_child_text( valstr ); 
     89        } 
     90        free( valstr ); 
     91    } else { 
     92        debugError("No root node\n"); 
     93    } 
    8094} 
    8195 
     
    88102                 strMemberName.c_str(), value ); 
    89103 
    90     vector<string> tokens; 
     104    std::vector<std::string> tokens; 
    91105    tokenize( strMemberName, tokens, "/" ); 
    92106 
     
    96110    } 
    97111 
    98     xmlpp::Node* pNode = m_doc.get_root_node(); 
    99     pNode = getNodePath( pNode, tokens ); 
    100  
    101     // element to be added 
    102     xmlpp::Element* pElem = pNode->add_child( tokens[tokens.size() - 1] ); 
    103     char* valstr; 
    104     asprintf( &valstr, "%lld", value ); 
    105     pElem->set_child_text( valstr ); 
    106     free( valstr ); 
    107  
     112    Xml::Node* pNode = m_doc.get_root_node(); 
     113    if(pNode) { 
     114        pNode = getNodePath( pNode, tokens ); 
     115        if(pNode) { 
     116            // element to be added 
     117            Xml::Node& n = pNode->add( Xml::Node(tokens[tokens.size() - 1].c_str(), NULL) ); 
     118            char* valstr; 
     119            asprintf( &valstr, "%lld", value ); 
     120            n.set_child_text( valstr ); 
     121            free( valstr ); 
     122        } else { 
     123            return false; 
     124        } 
     125    } else { 
     126        return false; 
     127    } 
    108128    return true; 
    109129} 
     
    111131bool 
    112132Util::XMLSerialize::write( std::string strMemberName, 
    113                            Glib::ustring str) 
     133                           std::string str) 
    114134{ 
    115135    debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "write %s = %s\n", 
    116136                 strMemberName.c_str(), str.c_str() ); 
    117137 
    118     vector<string> tokens; 
     138    std::vector<std::string> tokens; 
    119139    tokenize( strMemberName, tokens, "/" ); 
    120140 
     
    124144    } 
    125145 
    126     xmlpp::Node* pNode = m_doc.get_root_node(); 
    127     pNode = getNodePath( pNode, tokens ); 
    128  
    129     // element to be added 
    130     xmlpp::Element* pElem = pNode->add_child( tokens[tokens.size() - 1] ); 
    131     pElem->set_child_text( str ); 
    132  
     146    Xml::Node* pNode = m_doc.get_root_node(); 
     147    if(pNode) { 
     148        pNode = getNodePath( pNode, tokens ); 
     149        if(pNode) { 
     150            // element to be added 
     151            Xml::Node& n = pNode->add( Xml::Node(tokens[tokens.size() - 1].c_str(), NULL) ); 
     152            n.set_child_text( str ); 
     153        } else { 
     154            return false; 
     155        } 
     156    } else { 
     157        return false; 
     158    } 
    133159    return true; 
    134 
    135  
    136 xmlpp::Node* 
    137 Util::XMLSerialize::getNodePath( xmlpp::Node* pRootNode, 
     160 
     161
     162 
     163Util::Xml::Node* 
     164Util::XMLSerialize::getNodePath( Util::Xml::Node* pRootNode, 
    138165                                 std::vector<string>& tokens ) 
    139166{ 
     
    146173 
    147174    unsigned int iTokenIdx = 0; 
    148     xmlpp::Node* pCurNode = pRootNode; 
     175    Xml::Node* pCurNode = pRootNode; 
    149176    for (bool bFound = false; 
    150177         ( iTokenIdx < tokens.size() - 1 ); 
    151178         bFound = false, iTokenIdx++ ) 
    152179    { 
    153         xmlpp::Node::NodeList nodeList = pCurNode->get_children()
    154         for ( xmlpp::Node::NodeList::iterator it = nodeList.begin(); 
     180        Xml::Node::Children& nodeList = pCurNode->children
     181        for ( Xml::Node::Children::iterator it = nodeList.begin(); 
    155182              it != nodeList.end(); 
    156183              ++it ) 
    157184        { 
    158             if ( ( *it )->get_name() == tokens[iTokenIdx] ) { 
    159                 pCurNode = *it; 
     185            Xml::Node* thisNode = &( *it ); 
     186            if ( thisNode->name.compare(tokens[iTokenIdx]) == 0 ) { 
     187                pCurNode = thisNode; 
    160188                bFound = true; 
    161189                break; 
     
    168196 
    169197    for ( unsigned int i = iTokenIdx; i < tokens.size() - 1; i++, iTokenIdx++ ) { 
    170         pCurNode = pCurNode->add_child( tokens[iTokenIdx] ); 
     198        Xml::Node& n = pCurNode->add( Xml::Node(tokens[iTokenIdx].c_str(), NULL) ); 
     199        pCurNode = &n; 
    171200    } 
    172201    return pCurNode; 
    173  
    174202} 
    175203 
    176204/***********************************/ 
    177205 
    178 Util::XMLDeserialize::XMLDeserialize( Glib::ustring fileName ) 
     206Util::XMLDeserialize::XMLDeserialize( std::string fileName ) 
    179207    : IODeserialize() 
    180208    , m_filepath( fileName ) 
     
    183211    setDebugLevel(DEBUG_LEVEL_NORMAL); 
    184212    try { 
    185         m_parser.set_substitute_entities(); //We just want the text to 
     213//         m_parser.set_substitute_entities(); //We just want the text to 
    186214                                            //be resolved/unescaped 
    187215                                            //automatically. 
    188         m_parser.parse_file( m_filepath ); 
     216        m_doc.load_from_file(m_filepath); 
    189217    } catch ( const exception& ex ) { 
    190218        cout << "Exception caught: " << ex.what(); 
     
    192220} 
    193221 
    194 Util::XMLDeserialize::XMLDeserialize( Glib::ustring fileName, int verboseLevel ) 
     222Util::XMLDeserialize::XMLDeserialize( std::string fileName, int verboseLevel ) 
    195223    : IODeserialize() 
    196224    , m_filepath( fileName ) 
     
    199227    setDebugLevel(verboseLevel); 
    200228    try { 
    201         m_parser.set_substitute_entities(); //We just want the text to 
     229//         m_parser.set_substitute_entities(); //We just want the text to 
    202230                                            //be resolved/unescaped 
    203231                                            //automatically. 
    204         m_parser.parse_file( m_filepath ); 
     232        m_doc.load_from_file(m_filepath); 
    205233    } catch ( const exception& ex ) { 
    206234        cout << "Exception caught: " << ex.what(); 
     
    221249Util::XMLDeserialize::checkVersion() 
    222250{ 
    223     Glib::ustring savedVersion; 
     251    std::string savedVersion; 
    224252    if (read( "CacheVersion", savedVersion )) { 
    225         Glib::ustring expectedVersion = CACHE_VERSION; 
     253        std::string expectedVersion = CACHE_VERSION; 
    226254        debugOutput( DEBUG_LEVEL_NORMAL, "Cache version: %s, expected: %s.\n", savedVersion.c_str(), expectedVersion.c_str() ); 
    227255        if (expectedVersion == savedVersion) { 
     
    242270    debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "lookup %s\n", strMemberName.c_str() ); 
    243271 
    244     xmlpp::Document *pDoc=m_parser.get_document(); 
    245     if(!pDoc) { 
    246         debugWarning( "no document found\n" ); 
    247         return false; 
    248     } 
    249     xmlpp::Node* pNode = pDoc->get_root_node(); 
    250  
    251     debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "pNode = %s\n", pNode->get_name().c_str() ); 
    252  
    253     xmlpp::NodeSet nodeSet = pNode->find( strMemberName ); 
    254     for ( xmlpp::NodeSet::iterator it = nodeSet.begin(); 
    255           it != nodeSet.end(); 
    256           ++it ) 
    257     { 
    258         const xmlpp::Element* pElement = 
    259             dynamic_cast< const xmlpp::Element* >( *it ); 
    260         if ( pElement && pElement->has_child_text() ) { 
    261             char* tail; 
    262             value = strtoll( pElement->get_child_text()->get_content().c_str(), 
    263                              &tail, 0 ); 
    264             debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "found %s = %d\n", 
    265                          strMemberName.c_str(), value ); 
    266             return true; 
    267         } 
     272    Xml::Node* pNode = m_doc.get_root_node(); 
     273 
     274    debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "pNode = %s\n", pNode->name.c_str() ); 
     275    if(pNode) { 
     276        Xml::Nodes nodeSet = pNode->find( strMemberName ); 
     277        for ( Xml::Nodes::iterator it = nodeSet.begin(); 
     278            it != nodeSet.end(); 
     279            ++it ) 
     280        { 
     281            Xml::Node *n = *it; 
     282            if(n && n->has_child_text() ) { 
     283                char* tail; 
     284                value = strtoll( n->get_child_text().c_str(), 
     285                                &tail, 0 ); 
     286                debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "found %s = %d\n", 
     287                            strMemberName.c_str(), value ); 
     288                return true; 
     289            } 
     290            debugWarning( "no such a node %s\n", strMemberName.c_str() ); 
     291            return false; 
     292        } 
     293     
    268294        debugWarning( "no such a node %s\n", strMemberName.c_str() ); 
    269295        return false; 
    270     } 
    271  
    272     debugWarning( "no such a node %s\n", strMemberName.c_str() )
    273     return false; 
     296    } else { 
     297        debugError("No root node\n"); 
     298        return false
     299    } 
    274300} 
    275301 
    276302bool 
    277303Util::XMLDeserialize::read( std::string strMemberName, 
    278                             Glib::ustring& str ) 
     304                            std::string& str ) 
    279305{ 
    280306    debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "lookup %s\n", strMemberName.c_str() ); 
    281307 
    282     xmlpp::Document *pDoc=m_parser.get_document(); 
    283     if(!pDoc) { 
    284         debugWarning( "no document found\n" ); 
    285         return false; 
    286     } 
    287     xmlpp::Node* pNode = pDoc->get_root_node(); 
    288  
    289     xmlpp::NodeSet nodeSet = pNode->find( strMemberName ); 
    290     for ( xmlpp::NodeSet::iterator it = nodeSet.begin(); 
    291           it != nodeSet.end(); 
    292           ++it ) 
    293     { 
    294         const xmlpp::Element* pElement = dynamic_cast< const xmlpp::Element* >( *it ); 
    295         if ( pElement ) { 
    296             if ( pElement->has_child_text() ) { 
    297                 str = pElement->get_child_text()->get_content(); 
    298             } else { 
    299                 str = ""; 
     308    Xml::Node* pNode = m_doc.get_root_node(); 
     309 
     310    debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "pNode = %s\n", pNode->name.c_str() ); 
     311    if(pNode) { 
     312        Xml::Nodes nodeSet = pNode->find( strMemberName ); 
     313        for ( Xml::Nodes::iterator it = nodeSet.begin(); 
     314            it != nodeSet.end(); 
     315            ++it ) 
     316        { 
     317            Xml::Node *n = *it; 
     318            if(n) { 
     319                if(n->has_child_text() ) { 
     320                    str = n->get_child_text(); 
     321                } else { 
     322                    str = ""; 
     323                } 
     324                debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "found %s = %s\n", 
     325                            strMemberName.c_str(), str.c_str() ); 
     326                return true; 
    300327            } 
    301             debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "found %s = %s\n", 
    302                          strMemberName.c_str(), str.c_str() )
    303             return true; 
    304         } 
     328            debugWarning( "no such a node %s\n", strMemberName.c_str() ); 
     329            return false
     330        } 
     331     
    305332        debugWarning( "no such a node %s\n", strMemberName.c_str() ); 
    306333        return false; 
    307     } 
    308  
    309     debugWarning( "no such a node %s\n", strMemberName.c_str() )
    310     return false; 
     334    } else { 
     335        debugError("No root node\n"); 
     336        return false
     337    } 
    311338} 
    312339 
     
    314341Util::XMLDeserialize::isExisting( std::string strMemberName ) 
    315342{ 
    316     xmlpp::Document *pDoc=m_parser.get_document(); 
    317     if(!pDoc) { 
    318         return false; 
    319     } 
    320     xmlpp::Node* pNode = pDoc->get_root_node(); 
    321     xmlpp::NodeSet nodeSet = pNode->find( strMemberName ); 
    322     return nodeSet.size() > 0; 
     343    Xml::Node* pNode = m_doc.get_root_node(); 
     344    if(pNode) { 
     345        Xml::Nodes nodeSet = pNode->find( strMemberName ); 
     346        return nodeSet.size() > 0; 
     347    } else return false; 
    323348} 
    324349 
  • trunk/libffado/src/libutil/serialize_expat.h

    r864 r1154  
    11/* 
    22 * Copyright (C) 2005-2008 by Daniel Wagner 
     3 * Copyright (C) 2005-2008 by Pieter Palmers 
    34 * 
    45 * This file is part of FFADO 
     
    2223 */ 
    2324 
    24 #ifndef bebob_serialize_h 
    25 #define bebob_serialize_h 
     25#ifndef __FFADO_UTIL_SERIALIZE_EXPAT_H__ 
     26#define __FFADO_UTIL_SERIALIZE_EXPAT_H__ 
    2627 
    2728#include "debugmodule/debugmodule.h" 
    2829 
    29 #include <libxml++/libxml++.h> 
     30#include "serialize_expat_xml.h" 
    3031 
    3132#include <iostream> 
     33#include <string> 
    3234 
    3335namespace Util { 
     
    4143                             long long value ) = 0; 
    4244         virtual bool write( std::string strMemberName, 
    43                              Glib::ustring str) = 0; 
     45                             std::string str) = 0; 
    4446 
    4547         template <typename T>  bool write( std::string strMemberName, T value ); 
     
    5456                           long long& value ) = 0; 
    5557        virtual bool read( std::string strMemberName, 
    56                            Glib::ustring& str ) = 0; 
     58                           std::string& str ) = 0; 
    5759 
    5860        template <typename T> bool read( std::string strMemberName, T& value ); 
     
    6365    class XMLSerialize: public IOSerialize { 
    6466    public: 
    65         XMLSerialize( Glib::ustring fileName ); 
    66        XMLSerialize( Glib::ustring fileName, int verboseLevel ); 
     67        XMLSerialize( std::string fileName ); 
     68        XMLSerialize( std::string fileName, int verboseLevel ); 
    6769        virtual ~XMLSerialize(); 
    6870 
     
    7072                            long long value ); 
    7173        virtual bool write( std::string strMemberName, 
    72                             Glib::ustring str); 
     74                            std::string str); 
    7375    private: 
    7476        void writeVersion(); 
    7577 
    76         Glib::ustring    m_filepath; 
    77         xmlpp::Document  m_doc; 
     78        std::string      m_filepath; 
     79        Xml::Document    m_doc; 
    7880        int              m_verboseLevel; 
    7981 
    8082        DECLARE_DEBUG_MODULE; 
    8183 
    82         xmlpp::Node* getNodePath( xmlpp::Node* pRootNode, 
    83                                   std::vector<std::string>& tokens ); 
     84        Xml::Node* getNodePath( Xml::Node* pRootNode, 
     85                                std::vector<std::string>& tokens ); 
    8486    }; 
    8587 
    8688    class XMLDeserialize: public IODeserialize { 
    8789    public: 
    88         XMLDeserialize( Glib::ustring fileName ); 
    89        XMLDeserialize( Glib::ustring fileName, int verboseLevel ); 
     90        XMLDeserialize( std::string fileName ); 
     91        XMLDeserialize( std::string fileName, int verboseLevel ); 
    9092        virtual ~XMLDeserialize(); 
    9193 
     
    9395                           long long& value ); 
    9496        virtual bool read( std::string strMemberName, 
    95                            Glib::ustring& str ); 
     97                           std::string& str ); 
    9698 
    9799        virtual bool isExisting( std::string strMemberName ); 
     
    99101        bool checkVersion(); 
    100102    private: 
    101         Glib::ustring    m_filepath; 
    102         xmlpp::DomParser m_parser
     103        std::string      m_filepath; 
     104        Xml::Document    m_doc
    103105        int              m_verboseLevel; 
    104106 
  • trunk/libffado/src/libutil/serialize_libxml.cpp

    r864 r1154  
    3131IMPL_DEBUG_MODULE( Util::XMLDeserialize, XMLDeserialize, DEBUG_LEVEL_NORMAL ); 
    3232 
    33 Util::XMLSerialize::XMLSerialize( Glib::ustring fileName ) 
     33Util::XMLSerialize::XMLSerialize( std::string fileName ) 
    3434    : IOSerialize() 
    3535    , m_filepath( fileName ) 
     
    4545} 
    4646 
    47 Util::XMLSerialize::XMLSerialize( Glib::ustring fileName, int verboseLevel ) 
     47Util::XMLSerialize::XMLSerialize( std::string fileName, int verboseLevel ) 
    4848    : IOSerialize() 
    4949    , m_filepath( fileName ) 
     
    111111bool 
    112112Util::XMLSerialize::write( std::string strMemberName, 
    113                            Glib::ustring str) 
     113                           std::string str) 
    114114{ 
    115115    debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "write %s = %s\n", 
     
    176176/***********************************/ 
    177177 
    178 Util::XMLDeserialize::XMLDeserialize( Glib::ustring fileName ) 
     178Util::XMLDeserialize::XMLDeserialize( std::string fileName ) 
    179179    : IODeserialize() 
    180180    , m_filepath( fileName ) 
     
    192192} 
    193193 
    194 Util::XMLDeserialize::XMLDeserialize( Glib::ustring fileName, int verboseLevel ) 
     194Util::XMLDeserialize::XMLDeserialize( std::string fileName, int verboseLevel ) 
    195195    : IODeserialize() 
    196196    , m_filepath( fileName ) 
     
    221221Util::XMLDeserialize::checkVersion() 
    222222{ 
    223     Glib::ustring savedVersion; 
     223    std::string savedVersion; 
    224224    if (read( "CacheVersion", savedVersion )) { 
    225225        Glib::ustring expectedVersion = CACHE_VERSION; 
     
    276276bool 
    277277Util::XMLDeserialize::read( std::string strMemberName, 
    278                             Glib::ustring& str ) 
     278                            std::string& str ) 
    279279{ 
    280280    debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "lookup %s\n", strMemberName.c_str() ); 
  • trunk/libffado/src/libutil/serialize_libxml.h

    r864 r1154  
    2222 */ 
    2323 
    24 #ifndef bebob_serialize_h 
    25 #define bebob_serialize_h 
     24#ifndef __FFADO_UTIL_SERIALIZE_XMLPP_H__ 
     25#define __FFADO_UTIL_SERIALIZE_XMLPP_H__ 
    2626 
    2727#include "debugmodule/debugmodule.h" 
     
    3030 
    3131#include <iostream> 
     32#include <string> 
    3233 
    3334namespace Util { 
     
    4142                             long long value ) = 0; 
    4243         virtual bool write( std::string strMemberName, 
    43                              Glib::ustring str) = 0; 
     44                             std::string str) = 0; 
    4445 
    4546         template <typename T>  bool write( std::string strMemberName, T value ); 
     
    5455                           long long& value ) = 0; 
    5556        virtual bool read( std::string strMemberName, 
    56                            Glib::ustring& str ) = 0; 
     57                           std::string& str ) = 0; 
    5758 
    5859        template <typename T> bool read( std::string strMemberName, T& value ); 
     
    6364    class XMLSerialize: public IOSerialize { 
    6465    public: 
    65         XMLSerialize( Glib::ustring fileName ); 
    66         XMLSerialize( Glib::ustring fileName, int verboseLevel ); 
     66        XMLSerialize( std::string fileName ); 
     67        XMLSerialize( std::string fileName, int verboseLevel ); 
    6768        virtual ~XMLSerialize(); 
    6869 
     
    7071                            long long value ); 
    7172        virtual bool write( std::string strMemberName, 
    72                             Glib::ustring str); 
     73                            std::string str); 
    7374    private: 
    7475        void writeVersion(); 
    7576 
    76         Glib::ustring    m_filepath; 
     77        std::string    m_filepath; 
    7778        xmlpp::Document  m_doc; 
    7879        int              m_verboseLevel; 
     
    8687    class XMLDeserialize: public IODeserialize { 
    8788    public: 
    88         XMLDeserialize( Glib::ustring fileName ); 
    89         XMLDeserialize( Glib::ustring fileName, int verboseLevel ); 
     89        XMLDeserialize( std::string fileName ); 
     90        XMLDeserialize( std::string fileName, int verboseLevel ); 
    9091        virtual ~XMLDeserialize(); 
    9192 
     
    9394                           long long& value ); 
    9495        virtual bool read( std::string strMemberName, 
    95                            Glib::ustring& str ); 
     96                           std::string& str ); 
    9697 
    9798        virtual bool isExisting( std::string strMemberName ); 
     
    99100        bool checkVersion(); 
    100101    private: 
    101         Glib::ustring    m_filepath; 
     102        std::string    m_filepath; 
    102103        xmlpp::DomParser m_parser; 
    103104        int              m_verboseLevel; 
  • trunk/libffado/src/libutil/unittests.cpp

    r864 r1154  
    366366{ 
    367367    bool result; 
    368     result  = ser.write( "m_pString", Glib::ustring( m_pString ) ); 
     368    result  = ser.write( "m_pString", std::string( m_pString ) ); 
    369369    return result; 
    370370} 
     
    374374{ 
    375375    bool result; 
    376     Glib::ustring str; 
     376    std::string str; 
    377377    result  = deser.read( "m_pString", str ); 
    378378 
  • trunk/libffado/src/maudio/maudio_avdevice.cpp

    r864 r1154  
    3131 
    3232#include "debugmodule/debugmodule.h" 
    33  
    34 #include <libxml/xmlmemory.h> 
    35 #include <libxml/parser.h> 
    3633 
    3734#include <string> 
  • trunk/libffado/src/SConscript

    r1066 r1154  
    7878        libutil/PosixThread.cpp \ 
    7979        libutil/ringbuffer.c \ 
    80         libutil/serialize.cpp \ 
    8180        libutil/StreamStatistics.cpp \ 
    8281        libutil/SystemTimeSource.cpp \ 
     
    8988        libcontrol/Nickname.cpp \ 
    9089') 
     90 
     91if env['SERIALIZE_USE_EXPAT']: 
     92        ffado_source.append('libutil/serialize_expat.cpp') 
     93        ffado_source.append('libutil/serialize_expat_xml.cpp') 
     94else: 
     95        ffado_source.append('libutil/serialize_libxml.cpp') 
     96 
    9197 
    9298bebob_source = env.Split( '\ 
     
    216222        libenv.MergeFlags( env['LIBAVC1394_FLAGS'] ) 
    217223        libenv.MergeFlags( env['LIBIEC61883_FLAGS'] ) 
    218         libenv.MergeFlags( env['LIBXML26_FLAGS'] ) 
     224        if not env['SERIALIZE_USE_EXPAT']: 
     225                libenv.MergeFlags( env['LIBXML26_FLAGS'] ) 
     226        else: 
     227                libenv.PrependUnique( LIBS=["expat"] ) 
    219228 
    220229#env1.AppendUnique( LINKFLAGS = env.Split("-Wl,-rpath $libdir -Wl,-soname -Wl,libffado.so.1 --version-info=1:0:0") ) 
  • trunk/libffado/support/dbus/SConscript

    r864 r1154  
    3636if not env.GetOption( "clean" ): 
    3737    env.MergeFlags( env["DBUS1_FLAGS"] ) 
    38     env.MergeFlags( env['LIBRAW1394_FLAGS'] ) 
    39     env.MergeFlags( env['LIBXML26_FLAGS'] ) 
     38    if not env['SERIALIZE_USE_EXPAT']: 
     39        env.MergeFlags( env['LIBXML26_FLAGS'] ) 
     40    else: 
     41        env.PrependUnique( LIBS=["expat"] ) 
    4042 
    4143env.Xml2Cpp_Proxy('controlclient-glue.h', 'control-interface.xml') 
  • trunk/libffado/support/firmware/SConscript

    r900 r1154  
    3333    env.MergeFlags( env['LIBAVC1394_FLAGS'] ) 
    3434    env.MergeFlags( env['LIBIEC61883_FLAGS'] ) 
    35     env.MergeFlags( env['LIBXML26_FLAGS'] ) 
     35    if not env['SERIALIZE_USE_EXPAT']: 
     36        env.MergeFlags( env['LIBXML26_FLAGS'] ) 
     37    else: 
     38        env.PrependUnique( LIBS=["expat"] ) 
    3639 
    3740static_env = env.Copy() 
  • trunk/libffado/tests/SConscript

    r1121 r1154  
    3232if not env.GetOption( "clean" ): 
    3333        env.MergeFlags( env['LIBRAW1394_FLAGS'] ) 
    34         env.MergeFlags( env['LIBXML26_FLAGS'] ) 
     34        if not env['SERIALIZE_USE_EXPAT']: 
     35                env.MergeFlags( env['LIBXML26_FLAGS'] ) 
     36        else: 
     37                env.PrependUnique( LIBS=["expat"] ) 
    3538 
    3639static_env = env.Copy() 
  • trunk/libffado/tests/systemtests/SConscript

    r1148 r1154  
    3232if not env.GetOption( "clean" ): 
    3333        env.MergeFlags( env['LIBRAW1394_FLAGS'] ) 
    34         env.MergeFlags( env['LIBXML26_FLAGS'] ) 
    3534 
    3635static_env = env.Copy()